Skip to content

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. Both produce a source distribution and a wheel by calling the project’s build backend through the PEP 517 interface.

$ uv build           # builds both sdist and wheel
$ uv build --sdist   # sdist only
$ uv build --wheel   # wheel only

If not using uv, install build and invoke it directly:

$ pip install build
$ python -m build

Install from source

Use uv pip install instead of python setup.py install or python setup.py develop:

$ uv pip install .              # replaces setup.py install
$ uv pip install --editable .   # replaces setup.py develop

Editable installs link the source directory into the environment so changes take effect without reinstalling.

If not using uv:

$ pip install .              # replaces setup.py install
$ pip install --editable .   # replaces setup.py develop
Last updated on