Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ryankanno/cookiecutter-py

Repository files navigation

cookiecutter-py

🐍 Modern Python project Cookiecutter template

Python 3.10-3.12 GitHub Issues GitHub Pull Requests License


Each time you start a new Python project, you shouldn't start from scratch. Ideally, you'd start with a standard project structure and set of tools and integrations to help facilitate writing quality Python code.

This modern Python Cookiecutter template is the tool that will help you do just that.


✨ Features

πŸš€ Getting Started

Prerequisites

Install Cookiecutter

uv add cookiecutter
# pip install cookiecutter
# pipenv install cookiecutter

Optional: Install Cruft

uv add cruft
# pip install cruft
# pipenv install cruft

πŸ› οΈ Usage

Cookiecutter

cookiecutter gh:ryankanno/cookiecutter-py

Note: If you want to use the auto approve / merge Dependabot workflow, make sure to create tags major, minor, patch so that Dependabot can tag its PRs. The workflow won't merge anything with a major tag.

Cruft (Optional)

cruft create https://github.com/ryankanno/cookiecutter-py/

πŸ” Details

Justfile Commands

The template includes a comprehensive Justfile with the following commands:

Development:

  • just install - Install dependencies using uv
  • just clean - Remove all build, test, and documentation artifacts

Testing & Quality:

  • just tests - Run all tests (fast, no coverage)
  • just tests -- path/to/test.py - Run specific tests
  • just tests -- --durations=10 - Show slow test durations
  • just coverage - Run tests with comprehensive coverage analysis
  • just lint - Run all linting checks via tox
  • just lint --fix - Auto-fix linting issues where possible
  • just pre-commit - Run pre-commit hooks

Documentation & Distribution:

  • just docs - Build Sphinx documentation
  • just dist - Build distribution packages

Utilities:

  • just tox -- <args> - Run tox with custom arguments
  • just watch <recipe> - Watch files and re-run commands on changes (with desktop notifications)

All commands use uv as the package manager and integrate with tox environments for consistency.

Docker

To build the container:

DOCKER_BUILDKIT=1 docker build .

To run the container (if you've installed the defaults):

docker run <image_id or tag> python -m surf.surf

Versioning

If you enable the PyPi workflow, versioning will happen via dunamai within the Github pipeline.

If instead, you prefer to version your package, please do it via uv version $(dunamai from any) as recommended in their documentation.

🚧 Roadmap

See the open issues for a list of proposed features (and known issues).

β˜‘οΈ TODO

  • add mutmut example to template
  • add hypothesis example to template
  • add licenses
  • add typeguard
  • version releases
  • update docs
    • include cookiecutter var descriptions
  • add publish docs workflow
  • update default/initial template doc structure
  • investigate uv
  • migrate to uv
  • finalize v1.0.0

🀝 Contributing

Contributions are very much appreciated.

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/new-cookiecutter-feature)
  3. Commit your changes (git commit -m 'Added a new feature')
  4. Push to the feature branch (git push origin feature/new-cookiecutter-feature)
  5. Open a PR! πŸŽ†

πŸ“ License

Distributed under the MIT License. See LICENSE for more information.

πŸ“« Contact

Ryan Kanno - @ryankanno

Project Link: https://github.com/ryankanno/cookiecutter-py