Skip to content
Open
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
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Keep LF line endings on every OS (see template/.gitattributes).
* text=auto eol=lf
26 changes: 6 additions & 20 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,19 @@
# docs: https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for more information:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://containers.dev/guide/dependabot
# Keeps GitHub Actions pinned in this repo and in the template up to date.
# Python dependencies are updated inside each generated project (see
# template/.github/dependabot.yml).

# All ecosystems use a 7-day cooldown so a compromised upstream release is
# likely caught before Dependabot proposes it here (zizmor: dependabot-cooldown).
version: 2
updates:
- package-ecosystem: "uv"
directory: "/"
schedule:
interval: "weekly"
commit-message:
prefix: "chore(deps)"
cooldown:
default-days: 7
- package-ecosystem: "github-actions"
directory: "/"
directories:
- "/"
- "/template"
schedule:
interval: "weekly"
commit-message:
prefix: "chore(actions)"
cooldown:
default-days: 7
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly
cooldown:
default-days: 7
58 changes: 58 additions & 0 deletions .github/workflows/template-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Template CI

# Render the template into a fresh project, then run that project's own checks.
# This catches template mistakes (bad Jinja, broken files) before users see them.

on:
pull_request:
branches:
- main

permissions:
contents: read

jobs:
render-and-check:
runs-on: ubuntu-latest
strategy:
matrix:
python_version: ['3.12', '3.13']
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
fetch-depth: 0 # copier reads git history and tags
- name: Install uv
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
- name: Set git identity for test commits
run: |
git config --global user.name "template-ci"
git config --global user.email "template-ci@users.noreply.github.com"
- name: Render template
env:
PYTHON_VERSION: ${{ matrix.python_version }}
# Use an absolute template path: copier saves it in .copier-answers.yml,
# and a relative "." would make the update step look inside the project.
run: |
uvx copier copy --defaults --vcs-ref HEAD \
-d project_name="Test Project" -d python_version="$PYTHON_VERSION" \
"$GITHUB_WORKSPACE" "$RUNNER_TEMP/out"
- name: Check no template syntax leaked into the output
working-directory: ${{ runner.temp }}/out
run: |
! grep -rn --exclude=Justfile --exclude-dir=.github '{{\|{%' . || { echo "Unrendered Jinja found"; exit 1; }
! find . -name '*.jinja' | grep . || { echo ".jinja file left in output"; exit 1; }
test -d src/test_project
- name: Run the generated project's checks
working-directory: ${{ runner.temp }}/out
run: |
git init -q && git add -A && git commit -qm "Initial commit"
uv sync
uv run pre-commit run --all-files
uv run pytest
- name: Run a template update on the generated project
working-directory: ${{ runner.temp }}/out
run: |
git add -A && git commit -qm "Add lock file"
uvx copier update --defaults --vcs-ref HEAD
test -z "$(git status --porcelain)"
166 changes: 2 additions & 164 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,166 +1,4 @@
# Byte-compiled / optimized / DLL files
.venv/
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.ruff_cache/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# Quarto
/docs/_site/
/docs/.quarto/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
42 changes: 4 additions & 38 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,49 +1,15 @@
# Checks for the template repository itself. The generated project's checks
# (ruff, panache, codespell, ...) run in CI on a rendered copy of the template,
# because those tools cannot read the .jinja files in template/.
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-yaml
stages: [pre-commit]
- id: check-json
stages: [pre-commit]
exclude: ^\.devcontainer/devcontainer\.json$
- id: check-toml
stages: [pre-commit]
exclude: ^template/
- id: check-merge-conflict
stages: [pre-commit]

- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.27
hooks:
- id: validate-pyproject

- repo: https://github.com/codespell-project/codespell
rev: v2.4.3
hooks:
- id: codespell

- repo: https://github.com/jolars/panache-pre-commit
rev: v3.20.0
hooks:
- id: panache-format
- id: panache-lint

- repo: https://github.com/zizmorcore/zizmor-pre-commit
rev: v1.33.1
hooks:
- id: zizmor

- repo: https://github.com/fastai/nbdev
rev: 3.3.38
hooks:
- id: nbdev-clean

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.17.6
hooks:
- id: ruff-check
args: [--fix, --exit-non-zero-on-fix]
types_or: [python, pyi, jupyter]
require_serial: true
- id: ruff-format
types_or: [python, pyi, jupyter]
1 change: 0 additions & 1 deletion .python-version

This file was deleted.

Loading
Loading