# 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](https://pydevtools.com/handbook/reference/setuptools.md) deprecated direct `setup.py` invocation because it let packages run arbitrary Python at install time with no standard interface. [PEP 517](https://pydevtools.com/handbook/explanation/what-is-pep-517.md) (2017) replaced that model with a stable interface between installers and [build backends](https://pydevtools.com/handbook/explanation/what-is-a-build-backend.md).

## Build a package

Use `uv build` or `python -m build` ([build](https://pydevtools.com/handbook/reference/build.md)) instead of `python setup.py sdist` or `python setup.py bdist_wheel`:

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

If you are not using [uv](https://pydevtools.com/handbook/reference/uv.md), install [build](https://pydevtools.com/handbook/reference/build.md) and invoke it directly:

```console
$ pip install build
$ python -m build
```

## Install from source

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

```console
$ pip install .              # replaces setup.py install
$ pip install --editable .   # replaces setup.py develop
```

## Learn More

- [Running setuptools commands](https://setuptools.pypa.io/en/latest/deprecated/commands.html#running-setuptools-commands) (setuptools deprecation notice)
- [Why you shouldn't invoke setup.py directly](https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html)
- [What is a build backend?](https://pydevtools.com/handbook/explanation/what-is-a-build-backend.md) covers the PEP 517 interface that replaced direct `setup.py` invocation
- [setuptools](https://pydevtools.com/handbook/reference/setuptools.md) reference page
