It seems that using setup.py
is deprecated in favor of using either setup.cfg
or pyproject.toml
. As of PEP 621 you can store your project metadata in pyproject.toml
, since I am basically already doing that I don't see why I shouldn't more formally use it.
I do think I would need to keep using setup.py
to build the C extension, but everything else can be moved to pyproject.toml
. This should eliminate having to keep both files up to date with each other, which I already forgot about once.
This does bring about an interesting situation. Poetry
does not currently support PEP 621
, so while it stores metadata in pyproject.toml
, it does not yet support storing the project metadata there, in the standardized way. This isn't a total dealbreaker, as I could just manually add the info needed. But I also could migrate to something like PDM.
There are a few thoughts I have regarding what tool to use:
- For a build backend, I'm going to have to use
setuptools
because I want to build a C extension. So even if I were to use Poetry
's build backend, I would still also need setuptools
...so I don't see a strong argument against simply using setuptools
.
- For a frontend, I really like having
pip
in the scripts (scriptopoly
and install
). It is very integral in the script commands and I think for what it does, nothing more than pip
is needed (and I suppose setuptools
as well) Plus, it is basically included for free when setting up the virtual environment. I like having something more featureful while developing so I can have a better tool for setting up and managing dependencies. Poetry
works great here, but moving forward, if it doesn't incorporate PEP 621
, I would have to manually do that myself. The whole point of this is to simplify and use the approach that is going to be supported moving forward. It would seem to me I'd only be accomplishing the latter, and not even totally, with Poetry
(for the time being, until it does add support for PEP 621
).
- This is where
PDM
comes into play. It does dependency management like Poetry
and Pipenv
, but it is also PEP 621
compliant. I know I came across it a while back when it was relatively new. Now it seems to have grown and looks like it would be nice to work with. I'm kind of interested in using it just to see how it compares. Virtual Environments are also optional with that, it lets you use a different approach to dependency isolation if desired. I wouldn't need that, but it does seem interesting.
So to sum up, for a build backend, just stick with setuptools
since I have a C extension. For the frontend stick with pip
in the scripts and switch to PDM
for development so I can fully migrate to using pyproject.toml
for storing the project metadata and dependencies in the Python blessed way. 🙏