python setup.py: Legacy Build Command Reference
The legacy build interface -- and what replaces it.
python setup.py invokes setuptools commands directly. Direct invocation is deprecated; modern CI uses python -m build and pip instead, but you still encounter setup.py in older projects.
Common flags / usage
- setup.py sdist bdist_wheel -- legacy build (use python -m build)
- setup.py install -- legacy install (use pip install .)
- setup.py develop -- legacy editable (use pip install -e .)
- setup.py --version -- print the project version
Example
shell
# Legacy (deprecated):
# python setup.py sdist bdist_wheel
# Modern replacements:
- run: python -m pip install build
- run: python -m build # sdist + wheel
- run: pip install -e . # editable installIn CI
Recent pip/setuptools warn on or refuse "setup.py install" and "setup.py develop". Prefer "python -m build" for artifacts and "pip install ." / "pip install -e ." for installs so your pipeline does not break on toolchain upgrades.
Key takeaways
- Direct setup.py invocation is deprecated for builds and installs.
- Use python -m build for artifacts and pip for installs instead.
- You still meet setup.py in older projects; migrate when you can.
Related guides
python -m build: Build Distributions Command ReferenceReference for python -m build in CI: producing an sdist and wheel in an isolated environment from pyproject.t…
pip install -e: Editable Install Command ReferenceReference for pip install -e (editable installs) in CI: installing the project under test, extras, build-back…
twine upload: Publish to PyPI Command ReferenceReference for twine upload in CI: publishing built distributions to PyPI or a private index, token authentica…