Skip to content
This repository was archived by the owner on Jan 22, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .gemini/commands/templatize.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
description = "Templatize a new Python repo"
prompt = """
I want you to "templatize" a new Python repository (cloned from a GitHub repo template) by following these steps:

1. Run the `templatize` script:
```bash
./templatize
```
This updates placeholders like `{{REPO_NAME}}`, so everything is configured with my username, repo name, email, etc.
2. Install the package, dev dependencies, and pre-commit hooks (see README).
3. Use `pip list` or `uv pip list` to very which package versions were installed, and pin them in `pyproject.toml` for consistency. Do not add any new packages to `pyproject.toml` -- just pin the ones that are already listed.
4. Delete:
- the "usage" section of the README on templatization
- the `./templatize` script
- the `Templatize` step in `.github/workflows/test.yaml`
- the "templatize" slash-command file at `.gemini/commands/templatize.toml`
5. Update the README to give a brief description of the project. If you are unable to infer the description based on the repo, please ask me for more details.
6. Commit and push the changes.
```bash
# you'll need to re-activate the virtual environment here
source .venv/bin/activate
git add .
git commit -m "Templatize"
git push
```
Type checking, linting, and formatting will run automatically on commit. You may fix any issues and recommit as needed.

Do not add any new files. Only modify or delete existing files.
"""
5 changes: 0 additions & 5 deletions .github/FUNDING.yml

This file was deleted.

43 changes: 0 additions & 43 deletions .github/disabled-workflows/test-slow.yaml

This file was deleted.

5 changes: 3 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

strategy:
matrix:
python: ["3.10", "3.11", "3.12"]
python: ["3.11", "3.12"]

steps:
- name: Checkout
Expand All @@ -39,6 +39,7 @@ jobs:

- name: Test
run: |
uv run ruff format --check .
uv run ruff check .
uv run ty check .
uv run pytest --cov --cov-report term-missing --cov-fail-under 80 tests/
uv run mypy
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.vscode
uv.lock

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The uv.lock file should not be ignored. Lock files are intended to be checked into version control to ensure reproducible builds for all developers and in CI environments. According to the uv documentation, uv.lock should be committed.

worktrees/

# Byte-compiled / optimized / DLL files
Expand Down
15 changes: 11 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
repos:
- repo: local
hooks:
- id: black
name: black
- id: ruff-format
name: ruff format
stages: [pre-commit]
language: system
entry: black
entry: ruff format
types: [python]

- id: ruff
- id: ruff-check
name: ruff check
stages: [pre-commit]
language: system
entry: ruff check
types: [python]

- id: ty-check
name: ty check
stages: [pre-commit]
language: system
entry: ty check
types: [python]
30 changes: 11 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,28 @@
# {{REPO_NAME}}

A simple template for Python projects, with CI/CD configured through GitHub Actions. Compatible with any virtual environment manager (e.g. `uv`, `venv`, `pyenv`, `poetry`, `conda`).
A simple template for Python projects, with CI/CD configured through GitHub Actions.


## Usage

1. Create a new repository, using this one as a template.
2. Run the `templatize` script:
2. Install and open [Gemini CLI](https://github.com/google-gemini/gemini-cli), then run the `/templatize` command:
```bash
./templatize
gemini run /templatize
```

This updates placeholders like `{{REPO_NAME}}`, so everything is configured with your username, repo name, email, etc.
3. Commit and push the changes.
```bash
git add .
git commit -m "Templatize"
git push
```
4. (Probably) delete this section of the README.

## Install

```bash
pip install "{{REPO_NAME}} @ git+ssh://git@github.com/{{REPO_OWNER}}/{{REPO_NAME}}.git"
> **Note:** For simplicity, I assume you are using [uv](https://docs.astral.sh/uv/getting-started/installation/), but this project is compatible with any virtual environment or package manager (`pip`, `venv`, `poetry`, `pipenv`, `conda`).

# Install all dev dependencies (tests etc.)
pip install "{{REPO_NAME}}[test] @ git+ssh://git@github.com/{{REPO_OWNER}}/{{REPO_NAME}}.git"
```bash
# Create and activate a new virtual environment
uv venv --python 3.12

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The installation instructions hardcode Python 3.12, while pyproject.toml specifies requires-python = ">=3.11". To maintain consistency with the project's stated requirements and avoid potential confusion for users of the template, it would be better to use Python 3.11 in this example.

Suggested change
uv venv --python 3.12
uv venv --python 3.11

source .venv/bin/activate

# Setup pre-commit hooks
# Install development dependencies and pre-commit hoooks
uv sync --all-extras
pre-commit install
```

Expand All @@ -37,11 +31,9 @@ pre-commit install

| Tool | Description | Runs on |
| --- | --- | --- |
| [black](https://github.com/psf/black) | Code formatter | - `git commit` (through `pre-commit`) <br> - `git push` <br> - pull requests |
| [ruff](https://github.com/astral-sh/ruff) | Code linter | - `git commit` (through `pre-commit`) <br> - `git push` <br> - pull requests |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The description for ruff is listed only as a "Code linter". Since this PR also configures ruff to handle code formatting (replacing black), it would be more accurate to update its description to "Code formatter and linter".

Suggested change
| [ruff](https://github.com/astral-sh/ruff) | Code linter | - `git commit` (through `pre-commit`) <br> - `git push` <br> - pull requests |
| [ruff](https://github.com/astral-sh/ruff) | Code formatter and linter | - `git commit` (through `pre-commit`) <br> - `git push` <br> - pull requests |

| [ty](https://docs.astral.sh/ty/) | Static type checker | - `git commit` <br> - pull requests |
| [pytest](https://github.com/pytest-dev/pytest) | Unit testing framework | - `git push` <br> - pull requests |
| [mypy](https://github.com/python/mypy) | Static type checker | - `git push` <br> - pull requests |
| [pre-commit](https://github.com/pre-commit/pre-commit) | Pre-commit hooks | - `git commit` |
| [twine](https://github.com/pypa/twine) $\dagger$ | PyPI package uploader | - New release (`git tag`) |

> $\dagger$ Requires enabling the `publish.yaml` workflow. To activate, move the file from `.github/disabled-workflows/publish.yaml.disabled` to `.github/workflows/publish.yaml`, and set a valid PyPI token as `PYPI_API_TOKEN` in the repo secrets.
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ description = "{{REPO_NAME}}"
license = {text = "MIT"}
dynamic = ["version", "readme"] # NOTE: Must be in sync with [tool.setuptools.dynamic] below
dependencies = []
requires-python = ">=3.8"
requires-python = ">=3.11"
classifiers = ["Programming Language :: Python :: 3"]

[tool.setuptools.dynamic]
Expand All @@ -24,12 +24,12 @@ exclude = ["tests"]
# extra packages (e.g. pip install .[test])
[project.optional-dependencies]
test = [
"black",
"mypy",
"pre-commit",
"pytest",
"pytest-cov",
"ruff",
"ty",
]
Comment on lines 26 to 33

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The mypy package is still listed as a test dependency, which contradicts the PR's goal of replacing mypy with ty. To complete the transition, mypy should be removed from the dependencies. Additionally, the [tool.mypy] configuration section should also be removed from this file for consistency.

test = [
    "pre-commit",
    "pytest",
    "pytest-cov",
    "ruff",
    "ty",
]



Expand Down
21 changes: 0 additions & 21 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,21 +0,0 @@
import pytest


def pytest_addoption(parser):
parser.addoption("--slow", action="store_true")


def pytest_configure(config):
config.addinivalue_line("markers", "slow: slow to run")


def pytest_collection_modifyitems(config, items):
run_slow = config.getoption("--slow")
skip_fast = pytest.mark.skip(reason="remove --slow option to run")
skip_slow = pytest.mark.skip(reason="need --slow option to run")

for item in items:
if ("slow" in item.keywords) and (not run_slow):
item.add_marker(skip_slow)
if ("slow" not in item.keywords) and (run_slow):
item.add_marker(skip_fast)
Loading