Guide to easy publishing and distributing your python application

On by oxalorg

Let me be real for a second. It’s a goddamn pain to get your python app distributed easily, unless you already know how to. Then it’s a breeze. Here’s a clean, small, and quick guide explaining just that. No bullshit.

First cd into your project folder, preferably with vitrualenv active. Then create a file in the directory similar to this:

from setuptools import setup
from proj import _VERSION
    long_description='Please visit<proj> for more details.',
    author='Mitesh Shah',
    download_url='<proj>/tarball/' +
    keywords=['python', 'proj'],
        'package1', 'package2', 'package3'
        'console_scripts': [

Now install the binary using:

python3 bdist_wheel
pip3 install dist/dystic...[TAB to autocomplete]

The application will get installed and a dist and build directory will be also be created.

With the virtualenv active, make sure the application got installed by either running the command line binary, or running a python interpreter and checking as follows:

>>> import dystic
>>> dystic
<module 'dystic' from '/home/ox/Dropbox/Projects/dystic/venv/lib/python3.5/site-packages/dystic/'>

Now inside your proj/ file, include a variable as follows:

_VERSION = 0.1.0

You only need to change this version and commit whenever making a version change, ofcourse also rebuilding the wheels.

To distribute the application on pypi, go to and create an account and create a file ~/.pypirc as follows:


repository =
username = MiteshNinja
password = password

repository =
username = MiteshNinja
password = password

Note: you can also create an account on pypitest server to test your app beforehand.

Now for uploading you need twine. Install as:

pip3 install twine

To upload to pypi, simply run:

twine upload dist/<proj>-<version>-py3-none-any.whl
# or any .whl file created in dist folder

Voila. That’s about it. You can now pip3 install <proj> from anywhere :)