Skip to content
/ python-template Public template

Template/boilerplate/reference project for a Python application (branches for different add-ons, e.g. like FastAPI)

License

Notifications You must be signed in to change notification settings

dratasich/python-template

Repository files navigation

python-template

Template/boilerplate/reference project for a Python application (branches for different add-ons, e.g. like FastAPI)

  1. Clone & copy (cookiecutter, copier) or use this repo via GitHub directly, see create a repository from a template.
  2. Run uv run pre-commit install.
  3. Delete CHANGELOG.md and reset version in pyproject.toml for your app.

Branches

The base branch main includes only the most necessary parts of a python project:

  • git config (gitignore for Python, gitattributes to ensure proper line endings in the repo)
  • uv setup (currently the fastest Python package manager (?))
  • ruff for code formatting and linting
  • mypy for static type checking
  • commitizen for structured commits (= conventional commits) enabling automatic versioning and changelog update
    # bump version (in `pyproject.toml` and update `CHANGELOG.md`)
    # ideally this is performed by your pipeline (e.g., on PR merge)
    cz bump  --yes --annotated-tag --check-consistency
  • pytest - yes, even for python notebooks ;)
  • simple and optional json logging with loguru
  • pre-commit config (enforcing all of the above)

You can include branches depending on your needs:

  • fastapi - Webservice with FastAPI

Local Development

Run

LOG_LEVEL=TRACE uv run python python_template/main.py

You can have the env variables in .env.shared or customize it on the command line.

References

Other Templates:

About

Template/boilerplate/reference project for a Python application (branches for different add-ons, e.g. like FastAPI)

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages