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

How to use build with customized setuptools commands #729

Closed
T4mmi opened this issue Jan 30, 2024 · 2 comments
Closed

How to use build with customized setuptools commands #729

T4mmi opened this issue Jan 30, 2024 · 2 comments

Comments

@T4mmi
Copy link

T4mmi commented Jan 30, 2024

Hi, this issue might be out of scope and I apologize if that's the case.
I have a setuptools extension that implements custom build commands to generate some third-party formated extensions from a python package (typically generate some tweaked metadata files and wraps everything in a zip archive).

Since python -m build is to replace python setup.py build, how to tell build to run a custom command (extend the --sdist/--wheel) ?

@T4mmi
Copy link
Author

T4mmi commented Jan 30, 2024

example:
assuming we have a setuptools_custom.build_custom(setuptools.Command) registered (running python -c "import setuptools; setuptools.setup()" build_custom is OK but triggers a deprecation warning,
Is it possible/OK to ask build to run this build_custom command ? (I'd expect something like python -m build . --build_custom or python -m build . --command=setuptools_custom.build_custom)

@henryiii
Copy link
Contributor

Build does not run setuptools commands. Build runs build_wheel (and build_sdist) from your backend hooks, as defined by PEP 517. Build commands are an internal setuptools detail (and other build backends, like scikit-build-core, meson-python, and maturin to name a few for built extensions, use different designs). Setuptools doesn't have a clear plan AFAICT for how to handle custom build commands. What I've done for the scikit-build-core setuptools plugin is inject my build command into the build command list.

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

No branches or pull requests

3 participants