Skip to main content

PyPi Template

Template-based common/best practices for managing a Python package on PyPi

Latest Version on PyPI Supported Implementations Build Status Documentation Status Coverage Status Built with PyPi Template

First Minutes with PyPi Template

PyPi Template aims to reduce the boilerplate overhead associated with setting up and maintaining a Python code base published on PyPI. It provides a set of templates to establish the essential and recommended best practice files.

In addition to setup and publishing support, it also offers automation through a Makefile for common development tasks, such as running and testing.

Below is a screenshot of your typical first minutes with PyPi Template, where you start from scratch and end up with a tested and published Python package.

$ mkdir my-pypi-module
$ cd my-pypi-module

$ pyenv virtualenv pypi-template
$ pyenv local pypi-template
$ pip install pypi-template

$ pypi-template init
A description for the package: My PyPI Module
Select classifiers: Programming Language :: Python :: 3
Select classifiers: 
Select console scripts: 
First year of publication: 2025
Github account: christophevg
Github repo name: my-pypi-module
Keywords describing the package: best module ever
License: MIT
Package module name: my_pypi_module
Package name: my-pypi-module
Package tagline: showing off my best module
Package title: My PyPi Module
Project env: pypi-template
Readme: .github/README.md
Select requires: baseweb
Select requires: 
Select scripts: 
Select test requires: 
Your author name: Christophe VG
Your email address: contact@christophe.vg
Your full name: Christophe VG
Your name: Christophe VG
👷‍♂️ creating virtual environment my-pypi-module-run
👷‍♂️ creating virtual environment my-pypi-module-docs
👷‍♂️ creating virtual test environment my-pypi-module-test-3.9.18
👷‍♂️ creating virtual test environment my-pypi-module-test-3.10.13
👷‍♂️ creating virtual test environment my-pypi-module-test-3.11.12
👷‍♂️ creating virtual test environment my-pypi-module-test-3.12.10
👷‍♂️ activating project environment
👷‍♂️ installing requirements in my-pypi-module

$ ls -a
.                     .pypi-template        Makefile              requirements.test.txt
..                    .python-version       Makefile.backup       requirements.txt
.env                  .readthedocs.yaml     docs                  setup.py
.github               LICENSE.txt           my_pypi_module        tests
.gitignore            MANIFEST.in           requirements.docs.txt tox.ini

$ make run
👷‍♂️ activating run environment
👷‍♂️ running LOG_LEVEL=INFO python -m my_pypi_module 
hello Stranger

$ make coverage
👷‍♂️ activating test environments
All checks passed!
👷‍♂️ performing tests
========================================== test session starts ===========================================
platform darwin -- Python 3.11.12, pytest-8.4.0, pluggy-1.6.0
cachedir: .tox/py311/.pytest_cache
rootdir: /Users/xtof/Workspace/pypi-template/my-pypi-module
configfile: tox.ini
testpaths: tests
collected 1 item                                                                                         

tests/test_example.py .                                                                            [100%]

=========================================== 1 passed in 0.01s ============================================
py311: OK ✔ in 2.62 seconds
========================================== test session starts ===========================================
platform darwin -- Python 3.12.10, pytest-8.4.0, pluggy-1.6.0
cachedir: .tox/py312/.pytest_cache
rootdir: /Users/xtof/Workspace/pypi-template/my-pypi-module
configfile: tox.ini
testpaths: tests
collected 1 item                                                                                         

tests/test_example.py .                                                                            [100%]

=========================================== 1 passed in 0.01s ============================================
py312: OK ✔ in 1.57 seconds
========================================== test session starts ===========================================
platform darwin -- Python 3.10.13, pytest-8.4.0, pluggy-1.6.0
cachedir: .tox/py310/.pytest_cache
rootdir: /Users/xtof/Workspace/pypi-template/my-pypi-module
configfile: tox.ini
testpaths: tests
collected 1 item                                                                                         

tests/test_example.py .                                                                            [100%]

=========================================== 1 passed in 0.01s ============================================
py310: OK ✔ in 1.47 seconds
========================================== test session starts ===========================================
platform darwin -- Python 3.9.18, pytest-8.4.0, pluggy-1.6.0
cachedir: .tox/py39/.pytest_cache
rootdir: /Users/xtof/Workspace/pypi-template/my-pypi-module
configfile: tox.ini
testpaths: tests
collected 1 item                                                                                         

tests/test_example.py .                                                                            [100%]

=========================================== 1 passed in 0.01s ============================================
  py311: OK (2.62 seconds)
  py312: OK (1.57 seconds)
  py310: OK (1.47 seconds)
  py39: OK (1.45 seconds)
  congratulations :) (7.14 seconds)
👷‍♂️ creating coverage reports
Name                         Stmts   Miss  Cover
------------------------------------------------
my_pypi_module/__init__.py       1      0   100%
my_pypi_module/module.py        10      1    90%
tests/__init__.py                0      0   100%
tests/test_example.py            4      0   100%
------------------------------------------------
TOTAL                           15      1    93%
Wrote HTML report to htmlcov/index.html
Wrote LCOV report to coverage.lcov
👷‍♂️ activating project environment


$ make publish-test
👷‍♂️ activating project environment
👷‍♂️ building distribution
👷‍♂️ publishing to PyPI test
Uploading distributions to https://test.pypi.org/legacy/
Uploading my_pypi_module-0.0.1-py3-none-any.whl
100$ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 9.2/9.2 kB • 00:00 • ?
Uploading my_pypi_module-0.0.1.tar.gz
100$ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.5/8.5 kB • 00:00 • ?

View at:
https://test.pypi.org/project/my-pypi-module/0.0.1/

Metadata

Release files for pypi-template 1.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pypi-template 1.5.1
File Size Uploaded
pypi_template-1.5.1.tar.gz 30.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pypi-template 1.5.1
File Interpreter ABI Platform
pypi_template-1.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 65.5 kB

Release files / pypi_template-1.5.1.tar.gz

Download URL pypi_template-1.5.1.tar.gz
Size 30.1 kB
Tags Source
SHA-256 checksum
How to use checksums
487850ce6e6972347080754650f8fae8251d22cbbef09097c8313466873002b0
BLAKE2b-256 checksum
How to use checksums
6cc9a400baf68af476f7ed3142fe81f6c4a8768071302b8d1a59b0bdd1dad927
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.12

Release files / pypi_template-1.5.1-py3-none-any.whl

Download URL pypi_template-1.5.1-py3-none-any.whl
Size 35.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3c3bd2026e20fa24a43c539410809e648bd727dcecc384a4f58ba8cf4d6dd12d
BLAKE2b-256 checksum
How to use checksums
cc49ae0ae4009e9aa3472202d9187cebc75864eb414d94b2731f5a5e5d388b4b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.12

Release history Release notifications | RSS feed

This release

1.5.1 This release

2 release files

1.5.0

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.2

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page