Citing Why you shouldn't invoke setup.py directly by Paul Ganssle.
- The setuptools project has stopped maintaining all direct invocations of setup.py years ago, and distutils is deprecated.
- There are undoubtedly many ways that your setup.py-based system is broken today, even if it's not failing loudly or obviously.
- Direct invocations of setup.py cannot bootstrap their own dependencies, and so some CLI is necessary for dependency management.
- The setuptools project no longer wants to provide any public CLI, and will be actively removing the existing interface (though the time scale for this is long).
- PEP 517, 518 and other standards-based packaging are the future of the Python ecosystem and a lot of progress has been made on making this upgrade seamless.
Here's a summary table of the setup.py way and the newer recommended method:
| setup.py | New command |
|---|---|
| setup.py sdist | python -m build (with build) |
| setup.py bdist_wheel | python -m build (with build) |
| setup.py test | pytest (usually via tox or nox) |
| setup.py install | pip install |
| setup.py develop | pip install -e |
| setup.py upload | twine upload (with twine) |
| setup.py check | twine check (this doesn't do all the same checks but it's a start) |
| Custom commands | tox and nox environments. |
Python Developer's Guide
devguide.python.org › getting-started › setup-building
Setup and building - Python Developer's Guide
1 week ago - You can also do each configuration and build step separately; the command above is a convenience wrapper around the following commands: ... $ python Platforms/WASI configure-build-python --quiet -- --config-cache --with-pydebug $ python Platforms/WASI make-build-python --quiet $ python Platforms/WASI configure-host --quiet -- --config-cache $ python Platforms/WASI make-host --quiet Python 3.14
10:23
The Best way to build a Python command line tool - Python Typer ...
How to Build a Python CLI Tool People Actually Want to Use
00:26
Build a Python command line tool in 20 seconds - YouTube
20:28
How to Package and Publish Python Code the Right Way - YouTube
14:17
How To Build a Simple Command Line Tool with Python 2022 - YouTube
Python
docs.python.org › 2.0 › inst › how-build-works.html
2.3 How building works
As implied above, the build command is responsible for putting the files to install into a build directory. By default, this is build under the distribution root; if you're excessively concerned with speed, or want to keep the source tree pristine, you can change the build directory with the ...
Python Packaging
packaging.python.org › tutorials › packaging-projects
Packaging Python Projects - Python Packaging User Guide
The build-backend key is the name of the Python object that frontends will use to perform the build. Both of these values will be provided by the documentation for your build backend, or generated by its command line interface.
GitHub
github.com › pypa › build
GitHub - pypa/build: A simple, correct Python build frontend · GitHub
A simple, correct Python build frontend. See the documentation for more information. build can be installed via pip or an equivalent via: ... This will build the package in an isolated environment, generating a source-distribution and wheel in the directory dist/. See the documentation for full information. Build is also available via the command line as pyproject-build once installed.
Author: pypa
Reddit
reddit.com › r/python › question: best ways to build python command line utilities
r/Python on Reddit: Question: best ways to build Python command line utilities
March 28, 2022 -
I have two medium size (less than 1000 lines each) code bases that I would like to make into two command line utilities. Two obvious approaches are:
-
Add a __main__.py file and a setup.py to a module, and do a python setup.ps install
-
Copy all source files into a single Python source file that starts with #!/usr/bin/env python, and put script in PATH.
To complicate matters, I use several different condo environments that I switch between. Is there an accepted best practice for this?
Top answer 1 of 5
4
Pipx and install them as package (with cli) interface
2 of 5
2
If you're looking to create a package, I recommend flit (and project.toml, which is where you'll define the CLI entry points). If you're looking for CLI structure and arg parsing, I suggest plumbum. You don't need to do either of the things you suggested. If you add details about how you want to use different venvs, maybe we can sort it with pipx or similar.
PyPI
pypi.org › project › build
build · PyPI
A simple, correct Python build frontend. See the documentation for more information. build can be installed via pip or an equivalent via: ... This will build the package in an isolated environment, generating a source-distribution and wheel in the directory dist/. See the documentation for full information. Build is also available via the command line as pyproject-build once installed.
pytz
pythonhosted.org › an_example_pypi_project › setuptools.html
Getting Started With setuptools and setup.py — an_example_pypi_project v0.0.5 documentation
Standard commands: build build everything needed to install build_py "build" pure Python modules (copy to build directory) build_ext build C/C++ extensions (compile/link to build directory) build_clib build C/C++ libraries used by Python extensions build_scripts "build" scripts (copy and fixup ...
CodeRivers
coderivers.org › blog › python-build
Python Build: A Comprehensive Guide - CodeRivers
August 8, 2026 - To build your project, use the python -m build command (from the build package) in your project's root directory:
GitHub
github.com › 00200200 › build
GitHub - 00200200/build: A simple, correct Python build frontend · GitHub
A simple, correct Python build frontend. See the documentation for more information. build can be installed via pip or an equivalent via: ... This will build the package in an isolated environment, generating a source-distribution and wheel in the directory dist/. See the documentation for full information. Build is also available via the command line as pyproject-build once installed.
Author: 00200200
Pypa
build.pypa.io › en › latest
build - 1.6.1
uv build is essentially equivalent to python -m build --installer=uv. Both follow packaging standards. build offers features like --config-json for passing complex nested configuration to backends, and the pip installer works on systems that don’t have pre-compiled uv wheels. build is the modern equivalent of setup.py sdist bdist_wheel, supporting any backend — not just setuptools. hatch build is the build command from the Hatch project management tool.
Python Packaging
packaging.python.org › en › latest › guides › creating-command-line-tools
Creating and packaging command-line tools - Python Packaging User Guide
This guide will walk you through creating and packaging a standalone command-line application that can be installed with pipx, a tool for creating and managing Python Virtual Environments and exposing the executable scripts of packages (and available manual pages) for use on the command-line. First of all, create a source tree for the project. For the sake of an example, we’ll build a simple tool outputting a greeting (a string) for a person based on arguments given on the command-line.
Python Packaging
packaging.python.org › en › latest › guides › section-build-and-publish
Building and Publishing - Python Packaging User Guide
Toggle navigation of Building and Publishing · Writing your pyproject.toml · Packaging and distributing projects · Dropping support for older Python versions · Packaging binary extensions · Packaging namespace packages · Creating and packaging command-line tools ·