Skip to content

JakobKlotz/python-template

Repository files navigation

Python Docker License: MIT

Template for Python Projects

Opinionated cookiecutter template for Python projects which uses uv to manage packages and Python installations. You can use the template to quickly get up and running for:

  • Python packaging
  • Machine Learning projects
  • Data analysis
  • Docker deployments
  • API development
  • Automation scripts
  • ...

GIF

Comes with...

  • uv to manage packages and Python installations
  • pytest for unit-testing
  • GitHub action to execute tests.
  • [Optional] pre-commit:
    • ruff hook to format and lint code
    • uv hook to keep uv.lock up-to date
    • gitleaks hook to prevent you from committing secrets (API keys, etc.)
  • [Optional] Docker template (with Python and uv)

Note

The cookiecutter template let's YOU set the Python version! A Python installation is not required. uv will install the appropriate Python version, if necessary.

1️⃣ Prerequisites

As a prerequisite, you need to have uv installed. Visit the installation guide (it's really simple to set-up).

With uv, install pre-commit and cookiecutter as tools.

uv tool install pre-commit cookiecutter

That's it!

2️⃣ Usage

To use the cookiecutter template:

cookiecutter https://github.com/JakobKlotz/python-template.git

... which walks you through the set-up of your project. After the project structure creation, the virtual environment and pre-commit hooks are automatically installed. 🚀

3️⃣ [Optional] Run First Script

To execute the pre-bundled script, simply use:

uv run main.py

The script just prints the current Python version.

Contributions

Any contributions are welcome! 👋🏽 Check out CONTRIBUTING.md

About

Opinionated cookiecutter template for Python projects.

Topics

Resources

License

Contributing

Stars

Watchers

Forks