ulgens/python-anything

Python project starter with a modern setup

★ 1Forks 0PythonGitHub ↗Compare
copierpythontemplate

README

python-anything

Copier

Git Hooks Tests

A Copier template for Python projects with opinionated tooling.

Warning This template is in a pretty early stage of development. Things can be unstable and changed without notice. Use at your own risk.

What's included

  • GitHub Actions: CI workflows for git hooks and tests
  • uv: Python dependency management
  • prek: Git hooks manager/wrapper
  • ruff: Linting and formatting
  • ty: Type checking (optional)
  • Renovate: Automated dependency updates
  • pytest + pytest-xdist + pytest-randomly: Python testing
  • Codecov: Test coverage reporting (optional)

Requirements

Installation

Make sure all the requirements are met. Copier and copier-related dependencies can be installed using

uv tool install "copier>=9" --with "copier-template-extensions==0.3.3"

Usage

Create a new project

copier copy --trust gh:ulgens/python-anything ./my-awesome-project

Template questions

Question Description Default Options For
project_name Project name my-awesome-project Free text input All
project_description One-line description Free text input All
author_name Author name Jane Doe Free text input All
author_email Author email [email protected] Free text input All
github_username GitHub username or organization janedoe Free text input All
project_type Project type Application Application, Library All
python_version Python version (X.Y.Z) Latest stable patch release Any valid Python version App
min_python_version Minimum supported Python version (inclusive) 3.12 3.11, 3.12, 3.13, 3.14, 3.15 Lib
max_python_version Maximum supported Python version (exclusive) 3.15 3.12, 3.13, 3.14, 3.15, 3.16 Lib
license License type MIT MIT, BSD-3-Clause, Apache-2.0, GPL-3.0, None All
frameworks Frameworks & libraries to include None Click, FastAPI, LangChain App
use_codecov Enable Codecov integration false true, false All
use_ty Enable ty type checker false true, false All

After generation

cd my-project
prek install
git remote add origin [email protected]:<username>/<project-name>.git
git commit -m "Initial commit"
git push -u origin main

Adapt an existing project

To adopt this template in a project that already exists:

  1. Make sure all changes are committed so you can review the template's changes as a diff:

    git status  # should be clean
  2. Run copier copy from the project root:

    copier copy --trust gh:ulgens/python-anything .
  3. Answer the template questions to match your existing project (name, author, Python version, etc.).

  4. Review the changes. Key files to check:

    • pyproject.toml: Merge your existing dependencies into the template's structure. The template uses dependency-groups for dev dependencies and pinned versions.
    • Source layout: The template expects code in src/ and tests in src/tests/. Move your code if it lives elsewhere.
    • .github/workflows/: Decide whether to keep your existing CI or adopt the template's.
    • Config files (ruff.toml, .pre-commit-config.yaml, etc.): Generally safe to accept the template's versions.
  5. If you made manual changes after the copy (e.g., merging dependencies, moving files), run the hooks again:

    prek run --all-files
  6. Review the full diff and commit:

    git diff --staged
    git commit -m "Adopt python-anything template"

After this, .copier-answers.yml enables copier update --trust for future template updates.

Update an existing project

copier update --trust

What gets generated

my-project/
├── .copier-answers.yml
├── .github/
│   └── workflows/
│       ├── git-hooks.yml
│       └── tests.yml
├── .gitignore
├── .pre-commit-config.yaml
├── LICENSE                      # (if license != None)
├── README.md
├── pyproject.toml
├── renovate.json5
├── ruff.toml
├── src/
│   └── tests/
│       ├── __init__.py
│       └── test_sample.py
├── uv.lock                      # (generated by post-copy task)
└── yamlfmt.yaml

Framework-specific features

Selecting frameworks affects:

  • pyproject.toml: Adds pinned dependencies for the selected frameworks
  • ruff.toml: Enables framework-specific lint rules:
    • FastAPI: FAST rules

Codecov setup

If you enabled Codecov integration (use_codecov: true), follow these steps after generation:

  1. Sign up at codecov.io and add your repository.
  2. Copy the upload token from Codecov's repository settings.
  3. Add the token as a GitHub Actions secret named CODECOV_TOKEN in your repository settings (Settings > Secrets and variables > Actions).

Once configured, coverage reports will be uploaded automatically on every push to main and on pull requests.

Related templates

License

MIT License - see LICENSE for details.

Contributors

ulgensrenovate[bot]

Issues