Python - Regular Package (Shipping | Packaging)

Card Puncher Data Processing


Code Versioning - Release and Code Shipping - Deployment in Python

How to release regular package adapted from (they are using the setuptools framework)


With python 3.




name = "hello_nico"

Building a distribution

Update the building tool

  • run this command from the package directory (where is located) ???
python -m pip install --user --upgrade setuptools wheel



cd ./project
python sdist bdist_wheel


This will create 3 sub directories:

  • build
  • dist
  • hello_nico.egg-info

Python Build Artifact Setup Py

The most important are in the dist subdirectory:



Note: the full output of the command is:

running sdist
running egg_info
writing hello_nico.egg-info\PKG-INFO
writing dependency_links to hello_nico.egg-info\dependency_links.txt
writing top-level names to hello_nico.egg-info\top_level.txt
reading manifest file 'hello_nico.egg-info\SOURCES.txt'
writing manifest file 'hello_nico.egg-info\SOURCES.txt'
running check
creating hello-nico-0.0.2
creating hello-nico-0.0.2\hello_nico.egg-info
creating hello-nico-0.0.2\hello_nico_pkg
copying files to hello-nico-0.0.2...
copying -> hello-nico-0.0.2
copying -> hello-nico-0.0.2
copying hello_nico.egg-info\PKG-INFO -> hello-nico-0.0.2\hello_nico.egg-info
copying hello_nico.egg-info\SOURCES.txt -> hello-nico-0.0.2\hello_nico.egg-info
copying hello_nico.egg-info\dependency_links.txt -> hello-nico-0.0.2\hello_nico.egg-info
copying hello_nico.egg-info\top_level.txt -> hello-nico-0.0.2\hello_nico.egg-info
copying hello_nico_pkg\ -> hello-nico-0.0.2\hello_nico_pkg
Writing hello-nico-0.0.2\setup.cfg
creating dist
Creating tar archive
removing 'hello-nico-0.0.2' (and everything under it)
running bdist_wheel
running build
running build_py
installing to build\bdist.win32\wheel
running install
running install_lib
creating build\bdist.win32\wheel
creating build\bdist.win32\wheel\hello_nico_pkg
copying build\lib\hello_nico_pkg\ -> build\bdist.win32\wheel\.\hello_nico_pkg
running install_egg_info
Copying hello_nico.egg-info to build\bdist.win32\wheel\.\hello_nico-0.0.2-py3.7.egg-info
running install_scripts
creating build\bdist.win32\wheel\hello_nico-0.0.2.dist-info\WHEEL
creating 'dist\hello_nico-0.0.2-py3-none-any.whl' and adding 'build\bdist.win32\wheel' to it
adding 'hello_nico_pkg/'
adding 'hello_nico-0.0.2.dist-info/METADATA'
adding 'hello_nico-0.0.2.dist-info/WHEEL'
adding 'hello_nico-0.0.2.dist-info/top_level.txt'
adding 'hello_nico-0.0.2.dist-info/RECORD'
removing build\bdist.win32\wheel


Create an account to the repo

Create an account on Test PyPI.

Update the deploy tool

  • twine upload the archive to Test PyPI
python -m pip install --user --upgrade twine
REM Optional Add the scripts location to the path
set PATH=C:\Users\gerard\AppData\Roaming\Python\Python37\Scripts;%PATH%


  • upload all of the archives under the dist sub-directory.
twine upload --repository-url dist/*
Enter your username: gerardnico
Enter your password:
Uploading distributions to
Uploading hello_nico-0.0.1-py3-none-any.whl
100%| 4.48k/4.48k [00:01<00:00, 2.88kB/s]
Uploading hello nico-0.0.1.tar.gz
100%| 4.23k/4.23k [00:01<00:00, 3.16kB/s]

It may take a minute or two for your project to appear on the site.

The package can be then see at:

Tintin ! In our case:

On the real index, you can see if your package has successfully uploaded by navigating to the URL

Python Test Pypi Hello Nico
Use it
  • Syntax
python -m pip install --index-url packageName
cd c:\tmp
mkdir venv
cd venv
Scripts\python -m pip install --index-url hello-nico
Looking in indexes:
Collecting hello-nico
Installing collected packages: hello-nico
Successfully installed hello-nico-0.0.1

  • The package was installed
ls Lib\site-packages\hello_nico-0.0.1.dist-info

Import to test
  • Start Python
  • Import the module and access the property defined in the file
import hello_nico_pkg

Documentation / Reference

Discover More
Card Puncher Data Processing
Python - (Shipping|Packaging)

in Python Shipping in Python is defined in the setuptools framework, that uses pip and to distribute code in the wheel format See
Card Puncher Data Processing
Python - Package

in Python Physically, package are the directories and modules are the files within this directories. Logically, a package is a module (parent module): which can contain: modules (submodules)...
Card Puncher Data Processing
Python - Regular Package

A regular package is a directory containing an init file. Package can be installed via distribution package. See distribution package installation. See Their location can be chosen during...
Card Puncher Data Processing
Python - Wheel Archive (whl - bdist_wheel)

Wheel is a compiled archive format with the .whl extension. A wheel is a built package that can be installed without needing to go through the “build” process. Installing wheels is substantially faster...
Card Puncher Data Processing
Python 3 - SetupTools

setuptools is an framework enhancement over distutils that allow to more easily build and distribute Python distributions. See ...
Card Puncher Data Processing
Python Package - init .py

A regular package is typically implemented as a directory containing an file. The file is tells Python that you can use the folder to import a module. (The default behavior is...

Share this page:
Follow us:
Task Runner