stablediffusion
stablediffusion copied to clipboard
Update package metadata
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
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?
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
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.
It supports Conda too https://anaconda.org/conda-forge/hatchling
Has anyone had time to review this?