How to configure, build, and publish your Python projects to PyPI
Learn to publish your Python projects in a modern way
When you want to share your Python project, either for private, open-source, or commercial purposes, you need to publish it to PyPI or other package repositories to make it available for other developers. In this post, the common settings and procedures for publishing a Python project to PyPI will be introduced in detail.
To begin this tutorial, the first tool you need is pip
, which will be used to install other tools required for configuring, building, and publishing Python projects. To install and/or upgrade pip
on your computer, run:
$ python3 -m pip install -U pip
In this post, we will use setuptools
to configure our projects and make them ready for publishing. setuptools
is the modern and official tool for packaging Python projects. It is a collection of enhancements to the Python distutils
package that allows developers to more easily build and distribute Python packages. setuptools
is a built-in library for Python versions newer than 3.4. However, it’s better to upgrade it to the latest version in order to use the latest features. Actually, many tutorials online are based on outdated versions of setuptools
and use deprecated features. For this tutorial, it is…