Creating a Python Package

If you are wanting to create your own Python module for others to use and provide the best way to install it then https://pypi.org/ is the way to go.

I made my own Google Image Downloader – you can get it and use it by typing “pip install gimdl”

Here’s the detailed part :

# __init__.py

# Version of the gimdl package
__version__ = '0.0.2'
__author__ = 'DrPi'
__email__ = 'redandgreencode@email.com'
# setup.py

from setuptools import setup

with open("README.md", "r") as fh:
    long_description = fh.read()

setup(
    name='gimdl',
    version='0.0.12',
    description='Google Image Search Downloader - using API ',
    py_modules=["gimdl"],
    install_requires=['python-dotenv'],
    package_dir={'': 'src'},
    
    classifiers=[
        'Development Status :: 3 - Alpha',
        'License :: OSI Approved :: MIT License',
        'Programming Language :: Python :: 3.6',
        'Programming Language :: Python :: 3.7',
        'Programming Language :: Python :: 3.8',
        'Programming Language :: Python :: 3.9',
        'Operating System :: OS Independent',
    ],
    project_urls={  # Optional
        'GitHub': 'https://github.com/RGGH/gimdl',
    },

    keywords='googleimages, images, search', 
    long_description=long_description,
    long_description_content_type="text/markdown"
)


TL;DR

$ python3 bdist_wheel sdist
$ sudo pip install python3-twine
$ twine register dist/gimdl-0.0.1.tar.gz
$ twine upload dist/gimdl-0.0.1.tar.gz
$ pip install gimdl

To upgrade package after change to source code:
$ python3 bdist_wheel sdist
$ twine –skip-existing dist/*

see: https://twine.readthedocs.io/en/latest/

See also https://pythonhosted.org/an_example_pypi_project/setuptools.html
Python Code

Previous article

Google Image Search
JavaScript

Next article

Callback functions