Skip to content

About

This is our cookiecutter template for generating various types of python projects and packages

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Package Template

This repository is a Cookiecutter template for generating new Python packages within the ETHZ/EAPS/GEG Group.

It provides a standard structure, modern tooling (via uv), linting, type-checking, and pre-configured Git hooks to ensure consistency across our projects.

Prerequisites

Before generating a new project from this template, you need to have Python and uv installed.

  1. Install Python: You need Python >= 3.11 installed on your system.
    • macOS: brew install python@3.11 (or latest available)
    • Linux (Ubuntu/Debian): sudo apt update && sudo apt install python3 python3-pip python3-venv
    • Windows: Download the official installer from python.org or install via the Microsoft Store.
  2. Install uv: Follow the official uv installation guide.
    • For macOS/Linux, you can run: curl -LsSf https://astral.sh/uv/install.sh | sh
    • For Windows, you can run: powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

Generating a New Project

To generate a new project from this template, run cookiecutter using uvx (which temporarily downloads and runs the tool without installing it permanently in your global environment):

uvx --from cookiecutter cookiecutter git@github.com:GEG-ETHZ/python-template.git

Generated projects are set up for GitHub and ship a GitHub Actions CI workflow (.github/workflows/ci.yml).

The Interactive Prompt

When you run the command, Cookiecutter will ask you a series of questions to configure your new project:

  • Project Name (e.g. My Awesome Package): The human-readable name of your project.
  • Project Slug (i.e. directory name -- lowercase, no spaces): The directory and package name (e.g., my-awesome-package). It defaults to a slugified version of your project name.
  • A short, awesome description for my project: A brief description of what your package does.
  • Author or Organization Name: Your name or organization (defaults to ETHZ/EAPS/GEG Group).
  • version: The initial version of your package (defaults to 0.1.0).
  • repo_type: The repository structure type. Choose one:
    • standard — standard package with library code in src/ and data analysis folders.
    • data_project — same structure as standard but includes a placeholder dependency linking to a GEG data pipeline package.

What Happens Next?

Once you complete the prompts, Cookiecutter will automatically:

  1. Create a new directory named after your project_slug.
  2. Generate all the necessary files (pyproject.toml, README.md, CONTRIBUTING.md, etc.) with your customized variables filled in.
  3. Automatically initialize a new git repository.
  4. Install the prek git hooks.
  5. Stage the initial project files and create an initial commit.

Developers

See CONTRIBUTING.md for the repository structure and contribution guidelines.

Setting up git hooks (prek)

After cloning this repository, install the git hooks so that linting and type-checking run automatically before each commit/push:

just setup
# or, without just:
uv sync
uv run prek install --hook-type pre-commit --hook-type pre-push --hook-type post-checkout --overwrite
  • pre-commit stage: ruff lint and format checks
  • pre-push stage: mypy strict type-checking, then pytest (generates a project for every repo_type and runs its checks)

Hooks run with fail_fast: true, so the first failure (e.g. pushing from a protected branch) stops the run before the slow test suite starts.

CI runs on GitHub Actions via .github/workflows/ci.yml (lint and branch auto-tagging only; mypy and pytest are left to the pre-push hook).

License

Copyright 2026 ETH Zurich, Geothermal Energy and Geofluids (GEG) Group.

Licensed under the Apache License, Version 2.0. This covers the template itself; projects generated from it are not automatically licensed and should choose their own license.

About

This is our cookiecutter template for generating various types of python projects and packages

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages