flit
flit is a build and publishing tool that packages pure Python projects using pyproject.toml and the flit-core build backend.
Installation and Setup
Install it from PyPI:
Initialize packaging metadata:
$ flit init
This creates or updates pyproject.toml. A minimal example looks like:
[build-system]
requires = ["flit_core>=3.8,<4"]
build-backend = "flit_core.buildapi"
# ...
Key Features
- Uses
pyproject.tomland theflit-corebackend. - Builds wheels and source distributions with a single command and works well in CI systems.
- Publishes releases to PyPI or TestPyPI without additional tools once credentials are configured.
- Supports editable installs (
pip install -e .) through the backend. - Controls sdist contents with include/exclude patterns under
[tool.flit.sdist].
Usage
Build distributable artifacts:
$ flit build
Creates dist/*.whl and dist/*.tar.gz.
Publish to PyPI or TestPyPI:
$ flit publish
$ flit publish --repository testpypi
Install the project into the current environment for quick local testing:
$ flit install
Update only the wheel or sdist if needed:
$ flit build --format wheel
$ flit build --format sdist
Control what goes into the source distribution:
pyproject.toml
[tool.flit.sdist]
include = ["src", "README.md", "LICENSE"]
exclude = ["tests", "docs/_build"]
Related Resources
Tutorial
How to Publish an Open-Source Python Package to PyPI
In this step-by-step tutorial, you’ll learn how to create a Python package for your project and how to publish it to PyPI, the Python Package Repository. Quickly get up to speed on everything from naming your package to configuring it using setup.cfg.
For additional information on related topics, take a look at the following resources:
By Leodanis Pozo Ramos • Updated Dec. 15, 2025