packaging-problems icon indicating copy to clipboard operation
packaging-problems copied to clipboard

pyproject.toml and the cmdclass

Open achapkowski opened this issue 1 year ago • 7 comments

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.

achapkowski avatar Apr 05 '23 18:04 achapkowski

Port everything else then leave setup.py with just the one argument setup(cmdclass=...) call. (Technically a setuptools issue/question ;) )

henryiii avatar Apr 05 '23 18:04 henryiii

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 :)

achapkowski avatar Apr 05 '23 18:04 achapkowski

Port everything else then leave setup.py with just the one argument setup(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!

achapkowski avatar Apr 05 '23 18:04 achapkowski

Can you please post a minimal example. I don't get the solution. How does the pyproject.toml file looks like?

buhtz avatar Nov 17 '23 14:11 buhtz

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

AnandInguva avatar Nov 17 '23 14:11 AnandInguva

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.

merwok avatar Nov 17 '23 14:11 merwok