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

Switch to pyproject.toml #200

Merged
merged 5 commits into from Dec 6, 2022
Merged

Switch to pyproject.toml #200

merged 5 commits into from Dec 6, 2022

Conversation

marcelm
Copy link
Contributor

@marcelm marcelm commented Dec 1, 2022

This was suggested in #186.

This converts pyfaidx to the "modern" way of setting metadata for Python projects (see PEP 621: Storing project metadata in pyproject.toml for details).

setuptools has introduced support for this in version 61, and it appears to be stable now.

Some tutorials that were helpful:

Also, the setuptools-scm configuration needed to be converted from how it’s done in setup.py, but this is documented well at https://github.com/pypa/setuptools_scm/.

Since this removes setup.py, the README was updated to no longer recommend python setup.py install. Similarly, python setup.py sdist no longer works. Instead, the build tool needs to be used. This can be done with pip install build && python -m build (or "pipx run build" if pipx is available, as on the GitHub runners).

Note that build produces both an sdist and a wheel file where previously only an sdist was generated. The pypa/gh-action-pypi-publish action will then publish both to PyPI.

My original motivation for submitting this PR is actually mainly this last bit: I noticed that when installing WhatsHap via pip install, pyfaidx (which we have as a direct dependency) is the only package that does not provide a wheel, which makes the installation a tiny bit slower than it could be.

Additional changes:

  • Added a link to the GitHub repository to the PyPI project page
  • Removed some Python 2 compatibility code

Closes #186

Also, it would need to be a list, so as it was, it would be interpreted as
provides = ['p', 'y', 'f', 'a', 'i', 'd', 'x']
This is the "modern" way of setting metadata for Python projects
(see PEP 621: Storing project metadata in pyproject.toml).

setuptools has introduced support for this in version 61, and it appears to
be stable now.

Some helpful tutorials:
- https://packaging.python.org/en/latest/tutorials/packaging-projects/
- https://setuptools.pypa.io/en/latest/userguide/quickstart.html

Also, the setuptools-scm configuration needed to be converted from setup.py,
but this is documented well at <https://github.com/pypa/setuptools_scm/>.

Since setup.py is gone, the README was updated to no longer recommend
"python setup.py install". Similarly, "python setup.py sdist" no longer
works. Instead, the "build" tool should be used: "pip install build && python -m build"
(or "pipx run build" if pipx is available, as on the GitHub runners).

Closes #186
@marcelm
Copy link
Contributor Author

marcelm commented Dec 1, 2022

Test failures should be fixed by merging #199.

@mdshw5
Copy link
Owner

mdshw5 commented Dec 1, 2022

Thank you for dragging me into the modern python packaging ecosystem 😄! I'll merge these changes ASAP.

@mdshw5 mdshw5 merged commit 85bf293 into mdshw5:master Dec 6, 2022
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.

Migration to pyproject.toml?
2 participants