Repolode
pypa

pypa/flit

A simple tool for building and publishing pure-Python packages and modules to PyPI with minimal configuration.

Stars
2,262
Forks
173
Open issues
125
Last commit
10 days ago

What is it?

Flit packages a single importable Python module or package and uploads it to PyPI. It is aimed at reducing the amount of decisions a maintainer has to make about packaging, and it guards against common packaging mistakes. The package name on PyPI matches the import name, and subpackages and data files inside it are included automatically.

The typical workflow is to add a version and a one-line docstring to the module, run `flit init` to generate a pyproject.toml, and then run `flit publish`. Version and description are read from the module itself. Command line scripts and other metadata are configured in pyproject.toml. Older flit.ini files can be converted with a bundled helper module.

For local development, `flit install` installs a package into an environment, optionally as a symlink so edits take effect immediately. Users installing from a published wheel get a standard package, while installing the sdist makes pip use Flit in a temporary environment.

Key features

  • 01Publishes a single module or package to PyPI using its import name.
  • 02Reads version and description from the module, so they are not duplicated.
  • 03Generates a pyproject.toml with `flit init`.
  • 04Includes subpackages and data files automatically.
  • 05Installs packages locally for development, optionally as symlinks.

Use cases

  • Publishing a small pure-Python library to PyPI without writing setup.py.
  • Converting an older flit.ini-based project to pyproject.toml.
  • Setting up an editable local install of a package during development.

Quick start

  1. 1

    Install flit with pip

    python3 -m pip install flit
  2. 2

    Add a one-line docstring and __version__ to your module

  3. 3

    Run flit init in the module directory to create pyproject.toml

    flit init
  4. 4

    Upload your package to PyPI

    flit publish

Things to know

  • Packages only a single importable module or package at a time.
  • Python 2 modules must also import without errors on Python 3 to be distributed.

Topics

FAQ

What is flit?
A simple tool for building and publishing pure-Python packages and modules to PyPI with minimal configuration. Flit packages a single importable Python module or package and uploads it to PyPI. It is aimed at reducing the amount of decisions a maintainer has to make about packaging, and it guards against common packaging mistakes. The package name on PyPI matches the import name, and subpackages and data files inside it are included automatically.
Is flit free to use? What license does it have?
flit is open source under the BSD-3-Clause license. Check the license terms before using it in commercial products.
Is flit still maintained?
Actively maintained. The last commit to flit was on Oct 27, 2026.
What can I use flit for?
Publishing a small pure-Python library to PyPI without writing setup.py. Converting an older flit.ini-based project to pyproject.toml. Setting up an editable local install of a package during development.
How do I install flit?
Install flit with pip: python3 -m pip install flit Add a one-line docstring and __version__ to your module Run flit init in the module directory to create pyproject.toml: flit init Upload your package to PyPI: flit publish
Where can I get flit?
The source code and installation instructions are on GitHub: https://github.com/pypa/flit

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects