Augment/replace with pyproject.toml

Related: Minimal

pip ≥ 10 can use pyproject.toml instead of (or more commonly, along with), for simpler syntax. pyproject.toml is particularly useful for f2py programs where Numpy must be installed before running install.

flit uses pyproject.toml for simpler PyPi uploads, and can also install programs (as alternative to pip), even without End users can simply flit installfrom Github, without needing to git clone or use PyPi (unless they want to). flit and pyproject.toml lower Python program distribution difficulty for developers who don’t want to mess with PyPi, but also make it easier for those who do use PyPi.

Example: f2py

This example uses pyproject.toml to augment by first installing Numpy (setuptools.setup(setup_requires=['numpy']) is not recommended):


requires = ["setuptools", "numpy"] is constructed as usual, and when doing pip install -e . or pip install mypkg, Numpy will be installed first so that f2py or other Numpy-based extension modules can be built. A real-life example of this is in Lowtran

Example: pyproject.toml instead of

  1. author: flit publish to PyPi
  2. end-user: python -m pip install yourprogram this uses pyproject.toml alone to install.

Users can also install from local or remote Git repos:

  • end-user: flit installfrom this downloads and installs the latest Git commit to master branch (or other branch or release version they choose)
  • developer-user: git clone your repo and install in develop mode by flit install -s. This puts a symbolic link to your local Git directory (where you git clone’d).

This standard was defined in

Minimal pyproject.toml

Assuming your package is named myprogram, have a directory structure like


Ensure starts with a one-line description and version. You must increment this version for each PyPi upload (or use bumpversion).

"""Module docstring text"""
__version__ = '0.1.0'

pyproject.toml contains something like:

requires = ["flit"]
build-backend = "flit.buildapi"

module = "myprogram"
author = "Author Name"
author-email = ""
home-page = ""

requires=['numpy', 'matplotlib (>=2.1)']

'Development Status :: 4 - Beta',
'Programming Language :: Python']

PyPi upload

Sign up for PyPi account. It may take several hours to get the confirmation email.

Create ~/.pypirc with the content


Note that I did NOT save my password for security.

In your Python package directory that you want to upload

flit upload

Now your package is live to the world on PyPi. Anyone can install it via

python -m pip install myprogram


  • Obtain flit via

    python -m pip install flit
  • description-file must be .rst or .md format.

  • These old methods are superseded by the methods above.

    • python install python -m pip install .flit install
    • python develop python -m pip install -e .flit install -s
    • python sdist bdist_wheel uploadflit upload
  • flit reference

  • f2py needs invoking numpy.distutils and python -m pip install -e .

  • Python-only project should use flit