# 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`. Both produce a [source distribution](https://pydevtools.com/handbook/reference/sdist.md) and a [wheel](https://pydevtools.com/handbook/reference/wheel.md) by calling the project's build backend through the PEP 517 interface.

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

If 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 `uv pip install` instead of `python setup.py install` or `python setup.py develop`:

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

[Editable installs](https://pydevtools.com/handbook/explanation/what-is-an-editable-install.md) link the source directory into the environment so changes take effect without reinstalling.

If not using uv:

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