packaging-problems
packaging-problems copied to clipboard
pyproject.toml and the cmdclass
Problem description
Hello,
I am in the process of porting a legacy setup.py to pyproject.toml for a project I have and I have to deal with a cmdclass
in the setup.py.
How do I do this? The documentation for the metadata and the pyproject file is a bit everywhere and confusing. Much of the googling I have done seems to return outdated information. Any help would be greatly appreciated.
Port everything else then leave setup.py
with just the one argument setup(cmdclass=...)
call. (Technically a setuptools issue/question ;) )
To follow up, much of the doc I find points me to poetry and another packaging manager, which I don't want. I just want to use core python. I have enough trouble packing with conda, I don't need another one :)
Port everything else then leave
setup.py
with just the one argumentsetup(cmdclass=...)
call.
Ok, I didn't know I could do that based on all the deprecation warnings I was getting from my setup.py. Thank you very much!
Can you please post a minimal example. I don't get the solution. How does the pyproject.toml file looks like?
I recently added pyproject.toml to apache/beam. https://github.com/apache/beam/blob/master/sdks/python/pyproject.toml.
You want to use setup.py for cmdclass
but not for building your packages. For building packages, you need to use pyproject.toml. All the deprecation warnings might be related to using setup.py
in terms of building, installing your package using setup.py
, for example python setup.py sdist
-> which considered to be deprecated.
PTAL at https://github.com/apache/beam/blob/master/sdks/python/pyproject.toml on minimal pyproject.toml and how it is used in tandem with setup.py
More exactly, it’s direct invocation of python setup.py command
that is deprecated.
setup.py is still a configuration file for setuptools, and is invoked indirectly (via build frontend-backend hooks) when buiding using pip or (the tool badly named) build.