Skip to content
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
1 change: 0 additions & 1 deletion .claude/commands/ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Execute `just ci` which runs in this order:
3. `just lint` — ruff lint check
4. `just type` — basedpyright type check
5. `just test` — pytest
6. `just precommit` — pre-commit on all files

After running, summarize:
- Which steps passed and which failed
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,3 @@ This template repository and generated projects are expected to commit a `uv.loc
### Codecov in generated projects

The template can wire GitHub Actions to upload coverage. Configure a **repository secret** named `CODECOV_TOKEN` in GitHub (Codecov’s token); you do not need to paste that token into Copier answers.

51 changes: 46 additions & 5 deletions copier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,54 @@ github_actions_python_versions:
# -------------------------------------------------------------------------
# Post-generation tasks
# -------------------------------------------------------------------------
# Commands run after template rendering. Keep tasks idempotent and
# safe; failing tasks should not leave the repository in a broken state.
# Commands run after template rendering.
#
# Notes / rationale:
# - Generated projects are "uv-first" (lock-file-first workflow). These tasks should succeed even
# when the host Python lacks `ensurepip`/`pip` (common on minimal distro Pythons).
# - To avoid template generation failing on machines without `uv`, we bootstrap `uv` first.
# We try `pip` if available; otherwise we fall back to Astral's installer script.
# - Keep tasks idempotent. It's okay if `uv self update` fails (offline / restricted envs).
_tasks:
- ["git", "init"]
- command: python -m ensurepip --upgrade
- command: python -m pip install --upgrade pip
- command: python -m pip install --upgrade uv
- command: >-
sh -c '
# Bootstrap `uv` if missing.
#
# Copier executes tasks via /bin/sh, so this must be POSIX-sh compatible.
# We try (in order):
# - existing `uv` on PATH
# - `python -m pip install uv` (if pip is available)
# - Astral install script via curl/wget
if command -v uv >/dev/null 2>&1; then
exit 0
fi

if command -v python >/dev/null 2>&1 && python -m pip --version >/dev/null 2>&1; then
python -m pip install --upgrade uv && exit 0
fi

if command -v python3 >/dev/null 2>&1 && python3 -m pip --version >/dev/null 2>&1; then
python3 -m pip install --upgrade uv && exit 0
fi

if command -v curl >/dev/null 2>&1; then
curl -LsSf https://astral.sh/uv/install.sh | sh || exit 1
elif command -v wget >/dev/null 2>&1; then
wget -qO- https://astral.sh/uv/install.sh | sh || exit 1
else
echo "uv is required but was not found, and neither curl nor wget is available to install it." >&2
exit 1
fi

# Astral installer typically drops an env file that prepends ~/.local/bin to PATH.
if [ -f "$HOME/.local/bin/env" ]; then
. "$HOME/.local/bin/env"
fi

command -v uv >/dev/null 2>&1
'
- command: uv self update || true
- command: uv lock
- command: >-
{% if include_docs -%}
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,3 @@ ignore = ["E501"]
minversion = "8.0"
testpaths = ["tests"]
addopts = ["-q"]

1 change: 0 additions & 1 deletion template/.github/workflows/ci.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,3 @@ jobs:
exit 1
fi
echo "All checks passed!"

1 change: 0 additions & 1 deletion template/.github/workflows/docs.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,3 @@ jobs:
with:
name: site
path: site

1 change: 0 additions & 1 deletion template/.github/workflows/lint.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ jobs:

- name: Ruff lint
run: uv run ruff check .

3 changes: 1 addition & 2 deletions template/CLAUDE.md.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ just precommit-install
| Format | `just fmt` |
| Type check | `just type` |
| Full CI | `just ci` |
{% if include_docs %}| Serve docs | `just docs` |
{% endif %}
{% if include_docs %}| Serve docs | `just docs` |{% endif %}

## Package structure

Expand Down
1 change: 0 additions & 1 deletion template/README.md.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,3 @@ just ci
## License

{{ license }}

1 change: 0 additions & 1 deletion template/mkdocs.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@ plugins:
python:
options:
docstring_style: google

4 changes: 3 additions & 1 deletion tests/test_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ def test_generate_default_project(temp_project_dir: Path) -> None:
assert claude_md.is_file(), "Missing CLAUDE.md"
claude_content = claude_md.read_text(encoding="utf-8")
assert "Test Project" in claude_content, "CLAUDE.md should include rendered project name"
assert "uv sync --frozen --extra dev" in claude_content, "CLAUDE.md should document uv sync setup"
assert "uv sync --frozen --extra dev" in claude_content, (
"CLAUDE.md should document uv sync setup"
)


def test_ci_checks_default_project(temp_project_dir: Path) -> None:
Expand Down
Loading