How to create a distribution file for your python scripts?

Here is the process to create a distribution file for your python scripts so that users can install the script on their machines. Just like the python modules that you install using pip3.

We will do that using the setup tools

Install setuptools

pipenv install -d setuptools


We use -d since we only need the setuptool for development

Create a file, it contains many tools. Here I list some of the common ones.

from setuptools import setup,
    name="HelloWorld", # Name of your package
    author="Dariush Azimi", # your name in this case
    author_email="your email addr",
    url="to your project repo at github", # an example
    install_requires =[ #tell setup tools what packages are required
        'click', # or what ever the packages your script needs
    [console_scripts] # here we say we have a console script
    awsarmy=awsarmy.awsarmy:cli # here it is called awsarmy, will look inside the directory called awsarmy,and next will look for the module called .awsrmy and then will look for a function called
  • Next do the following pipenv run python bdist_wheel this will create an output file in the dist folder that you can use to install with pip3 command

  • to install it pip3 install

You can use the url to point to the location of the wheel file to install it.