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

Update package metadata #17

Merged
merged 2 commits into from
Jul 11, 2022

Conversation

ofek
Copy link
Contributor

@ofek ofek commented Mar 23, 2022

Background

Hello there! The Python packaging ecosystem has standardized on the interface for build backends (PEP 517/PEP 660) and the format for metadata declaration (PEP 621/PEP 631). As a result, the use of setup.py files is now heavily discouraged.

So, I'm spending my free time updating important projects so that they are modernized and set an example for others 😄

Summary of changes

This implements PEP 621, obviating the need for setup.py, setup.cfg, and MANIFEST.in. Support has not landed in setuptools, so builds will now use hatchling. It is quite stable and actively maintained, the only reason the version is 0.x is because 1.0.0 will drop support for Python 2. It's also on the major distribution channels such as Debian, Fedora, conda-forge, Nixpkgs, etc.

Other projects have done this such as pipx, tox, all Datadog Agent integrations, etc.

Notes

  • This fixes the .gitignore file to ignore the actual executables, the current pattern in fact matches src/python/ensureconda/
  • This documents support for Python 3.10, matching the CI test matrix
  • This also drops support for EOL Python 3.6 since hatchling and other build backends like setuptools have already done so. This will not break anything because pip only looks for version candidates that satisfy the requires-python field. Here are stats for the curious: https://pypistats.org/packages/ensureconda
  • The Git version is now shipped, removing the need for pkg_resources and thus reducing import/load time by ~400ms for me locally
  • The source distributions on PyPI are erroneously shipping a build artifact *.egg-info from python setup.py develop; this is now fixed:
    egg

@jezdez
Copy link
Member

jezdez commented Mar 23, 2022

@ofek While I appreciate your intentions here, it's worth waiting on setuptools since it's probably more likely to be maintained long-term than a single-author project hatch/hatchling.

I would suggest to wait for the implementation of PEP 621/631 in setuptools (which apparently is very close).

@ofek
Copy link
Contributor Author

ofek commented Mar 23, 2022

@jezdez Hello again!

I understand that critique but it's worth noting that setuptools is also mostly maintained by just one person. Additionally, it's an order of magnitude larger (making it less auditable and more prone to bugs), based on a deprecated standard library module that it now vendors, requires the presence of an additional package wheel to actually build wheels, and does not yet support the PEP 660 editable installation standard (related to the packaging error in the above screenshot).

Would you be open to a different build backend then? Some more info here: https://peps.python.org/pep-0517/#abstract

BTW that feature you linked will be experimental for some time.

@ofek
Copy link
Contributor Author

ofek commented Mar 23, 2022

Oh another benefit that encouraged python-tuf (which will soon be used by PyPI itself for PEP 458) to switch is that artifacts are reproducible 😄

@ofek
Copy link
Contributor Author

ofek commented Apr 13, 2022

@jezdez Sorry for not following up! I was out for a bit with bronchitis.

Do you want me to do anything else here?

@ofek
Copy link
Contributor Author

ofek commented Apr 30, 2022

Small update: Hatch will likely be adopted by PyPA in the next week

Nothing major will change, just the repo location

@jezdez
Copy link
Member

jezdez commented May 4, 2022

Small update: Hatch will likely be adopted by PyPA in the next week

Nothing major will change, just the repo location

This is indeed good news, thanks for making the move!

@ofek
Copy link
Contributor Author

ofek commented May 8, 2022

Transfer complete! https://github.com/pypa/hatch

pyproject.toml Outdated Show resolved Hide resolved
@mariusvniekerk mariusvniekerk merged commit 7359409 into conda-incubator:main Jul 11, 2022
@ofek ofek deleted the modernize-metadata branch July 11, 2022 16:25
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