Flit 0.10

Flit is a simple way to put Python packages and modules on PyPI.

Say you’re writing a module foobar—either as a single file foobar.py, or as a directory—and you want to distribute it.

  1. Make sure that foobar’s docstring starts with a one-line summary of what the module is, and that it has a __version__:

    """An amazing sample package!"""
    __version__ = '0.1'
  2. Create a file flit.ini next to the module. It should look like this:

    author=Sir Robin
    # If you want command line scripts, this is how to declare them.
    # If not, you can leave this section out completely.
    # foobar:main means the script will do: from foobar import main; main()

    You can use flit init to easily create a basic flit.ini file for your package.

    Besides the details shown above, there are other fields you can add—see the flit.ini page of the docs.

  3. Install flit if you don’t already have it:

    pip install flit
  4. Run this command to upload your code to PyPI:

    flit wheel --upload

If your package is not registered on PyPI yet, flit will try to register it for you during the upload step.

To install a package locally for development, run:

flit install [--symlink] [--python path/to/python]


Flit only creates packages in the new ‘wheel’ format. People using older versions of pip (<1.5) or easy_install will not be able to install them. People may also want a traditional sdist for other reasons, such as Linux distro packaging. I hope that these problems will diminish over time.

Flit packages a single importable module or package at a time, using the import name as the name on PyPI. All subpackages and data files within a package are included automatically.

Flit requires Python 3, but you can use it to distribute modules for Python 2, so long as they can be imported on Python 3.


Environment variables


New in version 0.10.

Setting this to any non-empty value will stop flit from making network connections (unless you explicitly ask to upload or register a package). This is intended for downstream packagers, so if you use this, it’s up to you to ensure any necessary dependencies are installed.


By default, flit install will fail when run as root on POSIX systems, because installing Python modules systemwide is not recommended. Setting this to any non-empty value allows installation as root. It has no effect on Windows.


To make reproducible builds, set this to a timestamp as a number of seconds since the start of the year 1970 in UTC. See the specification for more details.

Indices and tables