2
3
Fork
You've already forked python-project-template
2
Directory structure and relevant files for a simple installable python project.
  • Python 100%
2025年05月25日 20:22:45 +02:00
src/package_name
tests
.gitignore
LICENSE
MANIFEST.in
pyproject.toml
README.md
requirements.txt

Code style: black

General Information

This repository holds the basic directory layout for new python projects. Additional to a reasonable minimum of features (setup.py, requirements.txt, directory structure, ...) it contains the following extras:

  • basic unittest
  • script.py and associated entrypoint in pyproject.toml (allows to call some functionality of the package directly from command line (try package_name cmd1))

Usage

  • Rename directory src/package_name
  • Edit pyproject.toml: replace dummy data with real data.
  • Add your source. a) Either to core.py or b) to your own separate file(s).
    • a) simplifies importing your module
    • b) is more flexible but you have to take care of importability yourself.

For local development it is recommended to install this (better: your) package in editable mode: pip install -e . (run from where pyproject.toml lives).

Publishing on pypi

To publish your package on Python Package Index (pypi) the following commands should work:

  • Install necessary tooling: pip install build setuptools_scm twine
  • create the uploadable pack: rm -rf dist/*; python3 -m build
  • Register a username on https://pypi.org/
  • upload package: twine upload -r pypi dist/*
    • use this for testing twine upload -r testpypi dist/*