Related: Minimal setup.py
pip ≥ 9.1 can use
pyproject.toml instead of
setup.py, for simpler syntax.
pyproject.toml for simpler PyPi uploads, and can also install programs (as alternative to
End users can simply
flit installfrom Github, without needing to
git clone or use PyPi (unless they want to).
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.
flit publishto PyPi
python -m pip install yourprogramthis uses
pyproject.tomlalone to install.
Users can also install from local or remote Git repos:
flit installfrom https://github.com/username/yourprogram/archive/master.zipthis downloads and installs the latest Git commit to
masterbranch (or other branch or release version they choose)
git cloneyour repo and install in develop mode by
flit install -s. This puts a symbolic link to your local Git directory (where you
- assuming your package is named
myprogram, have a directory structure like
pyproject.toml myprogram/ __init__.py
- ensure your
__init__.pystarts with a one-line description and version. You must increment this version for each PyPi upload (or use
"""My program is 2x faster and 1/3 the size of Hello World.""" __version__ = '0.1.0'
pyproject.tomlcontains something like:
[build-system] requires = ["flit"] build-backend = "flit.buildapi" [tool.flit.metadata] module = "myprogram" author = "Author Name" author-email = "[email protected]" home-page = "https://github.com/username/reponame" requires=['numpy','matplotlib (>=2.1)'] requires-python='>=3.4' description-file='README.rst' classifiers=[ 'Development Status :: 4 - Beta', 'Programming Language :: Python']
- Sign up for PyPi account. It may take several hours to get the confirmation email.
~/.pypircwith the content
[distutils] index-servers = pypi [pypi] repository=https://pypi.python.org/pypi username=<your pypi username>
Note that I did NOT save my password for security.
- In your Python package directory that you want to upload
Now your package is live to the world on PyPi. Anyone can install it via
python -m pip install myprogram
python -m pip install flit
- These old methods are superceded by the methods above.
python setup.py install
python -m pip install .→
python setup.py develop
python -m pip install -e .→
flit install -s
python setup.py sdist bdist_wheel upload→
- flit reference
- To my knowledge,
python -m pip install -e .