Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package for distribution #29

Merged
merged 1 commit into from
Dec 18, 2024
Merged

Package for distribution #29

merged 1 commit into from
Dec 18, 2024

Conversation

hugovk
Copy link
Contributor

@hugovk hugovk commented Dec 12, 2024

First step for #24.

This does several things to prepare for a PyPI release, like replacing setup.py with pyproject.toml, which is the new standard for Python packaging.

This defines several things:

  • A build "backend". I put the popular Hatchling here, I use this one for most things, it's extensible and standards compliant: https://pypi.org/project/hatchling/
  • Define the lowest Python version supported. This tells pip or uv to only install this package on that version or higher. When we drop 3.9 later in a future release, pip/uv will then install the last version that did support 3.9, so the end user still has a working install.
  • A list of "Trove" classifiers. Choose whatever you want from the list at https://pypi.org/classifiers/. These are all optional and show up on PyPI, and can be useful to help people/programs find things, but I don't think they're used too much. I find it useful to list the Python versions the package has been tested on.
  • The dependencies which will also be installed by pip or uv: NumPy and pandas.
  • The optional dependencies, when you install with "extras". For example, like we now do on the CI: pip install .[tests]. (You may need quotes on macOS: pip install ".[tests]".) This replaces the requirements.txt file.
  • Some URLs. You can add more here, like issues or documentation. See also https://packaging.python.org/en/latest/specifications/well-known-project-urls/#well-known-labels.

To try this out locally:

pip install build
python -m build

This will create a wheel and sdist in a dist directory, for example:

starpy-0.0.1-py3-none-any.whl
starpy-0.0.1.tar.gz

You can then install these, for example:

pip install starpy-0.0.1-py3-none-any.whl

And check the library works as expected.

After this, we could set up some a deploy workflow using Trusted Publishers.

README.md Show resolved Hide resolved
Copy link
Member

@ArendPeter ArendPeter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, I appreciate the update!

@ArendPeter ArendPeter merged commit 964a13e into Equal-Vote:main Dec 18, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants