Should I run `python setup.py`?
No. Commands like python setup.py sdist, python setup.py bdist_wheel, and python setup.py install are deprecated. Setuptools deprecated direct setup.py invocation because it let packages run arbitrary Python at install time with no standard interface. PEP 517 (2017) replaced that model with a stable interface between installers and build backends.
Build a package
Use uv build or python -m build (build) instead of python setup.py sdist or python setup.py bdist_wheel:
$ uv build # builds both sdist and wheel
$ uv build --sdist # sdist only
$ uv build --wheel # wheel only
If you are not using uv, install build and invoke it directly:
$ pip install build
$ python -m build
Install from source
Use pip install instead of python setup.py install or python setup.py develop:
$ pip install . # replaces setup.py install
$ pip install --editable . # replaces setup.py develop
Learn More
- Running setuptools commands (setuptools deprecation notice)
- Why you shouldn’t invoke setup.py directly
- What is a build backend? covers the PEP 517 interface that replaced direct
setup.pyinvocation - setuptools reference page
Last updated on