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 #34

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

ofek
Copy link

@ofek ofek commented Nov 25, 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 execution of setup.py files is now deprecated.

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. The build backend hatchling (of which I am a maintainer in the PyPA) is now used as that is the default in the official Python packaging tutorial. Hatchling is available on all the major distribution channels such as Debian, Fedora, Arch Linux, conda-forge, Nixpkgs, Alpine Linux, FreeBSD/OpenBSD, Gentoo Linux, MacPorts, OpenEmbedded, Spack, MSYS2, etc.

Notes

  • The licenses are now properly included in the environments when installed

@brycedrennan
Copy link

setup.py is something that works and that the community is familiar with, I don't think we should adopt hatchling (or any other newer packaging system).

If we were to though, here are some questions I'd have:

  • if I run pip install -e . in this repo will it still get installed? will it be installed in editable mode?
  • can I specify github repos as dependencies?
  • do I have to pre-install hatchling before installing a package?

@ofek
Copy link
Author

ofek commented Nov 25, 2022

if I run pip install -e . in this repo will it still get installed? will it be installed in editable mode?

Yup! pip introduced support for PEP 660 in v21-3. Also, with Hatchling:

  • the dev-mode-dirs option removes the need for directory traversal (find_packages()) in your case making installation faster
  • the implementation doesn't pollute the project with a *.egg-info directory
  • supports static analysis tools for editable installations by default whereas the new setuptools does not i.e. it requires enabling an option for IDEs to work

can I specify github repos as dependencies?

Yes, you can allow direct references

do I have to pre-install hatchling before installing a package?

Nope! The beauty of the modern PEP 517/PEP 518 way is that tools automatically handle build dependencies

@brycedrennan
Copy link

Thanks for your answers - they were better than I expected 😄

Still I've been burned by the newer packaging tools multiple times. Still occasionally run into errors with poetry not being installed because of whatever change some dependency made to their build system. I don't generally run into those problems with packages using the "old" way of doing things. Hope I'm wrong about everything though!

How does it interact with conda? I don't personally use conda but it seems like most people do in this space.

@ofek
Copy link
Author

ofek commented Nov 25, 2022

It supports Conda too https://anaconda.org/conda-forge/hatchling

@ofek
Copy link
Author

ofek commented Dec 12, 2022

Has anyone had time to review this?

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.

2 participants