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
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# https://editorconfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.py]
indent_size = 4

[*.md]
indent_size = 4
10 changes: 10 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copilot Instructions

This is `template_python` — a minimal skeleton for a Python repository: `invoke` tasks, a couple of
shared modules under `modules/`, `uv` for environment/dependency management, and CI (ruff, pylint,
pytest, yamllint, actionlint) via `.github/workflows/tests.yml`. It has no AI-agent tooling of its
own — see [`README.md`](../README.md) for the project layout and `invoke` task list.

For a version of this template with AI-agent tooling (Claude Code, Copilot instructions/prompts,
Cline) layered on top, see
[`template_ai_python`](https://github.com/LevonBecker/template_ai_python), which forks this repo.
122 changes: 122 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
---
name: Tests
run-name: "Tests (${{ github.head_ref || github.ref_name }})"

on:
pull_request:
branches:
- development # Trigger on PRs targeting development
- main # Trigger on PRs targeting main
push:
branches:
- main # Keep the status badge current after every merge

jobs:
# https://github.com/rhysd/actionlint
action_lint:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check Out Code
uses: actions/checkout@v7

- name: Setup uv
uses: astral-sh/setup-uv@v8.3.2
with:
python-version: "3.14"

- name: Install Dependencies
run: uv sync

- name: Action Lint
run: |
uv run --no-sync invoke debug.env
uv run --no-sync invoke tests.actionlint

pylint:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check Out Code
uses: actions/checkout@v7

- name: Setup uv
uses: astral-sh/setup-uv@v8.3.2
with:
python-version: "3.14"
enable-cache: true

- name: Install Dependencies
run: uv sync

- name: Pylint
run: |
uv run --no-sync invoke debug.env
uv run --no-sync invoke tests.pylint

pytest:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check Out Code
uses: actions/checkout@v7

- name: Setup uv
uses: astral-sh/setup-uv@v8.3.2
with:
python-version: "3.14"
enable-cache: true

- name: Install Dependencies
run: uv sync

- name: Pytest
run: |
uv run --no-sync invoke debug.env
uv run --no-sync invoke tests.pytest

ruff_lint:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check Out Code
uses: actions/checkout@v7

- name: Setup uv
uses: astral-sh/setup-uv@v8.3.2
with:
python-version: "3.14"
enable-cache: true

- name: Install Dependencies
run: uv sync

- name: Ruff Lint
run: |
uv run --no-sync invoke debug.env
uv run --no-sync invoke tests.rufflint

yaml_lint:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check Out Code
uses: actions/checkout@v7

- name: Setup uv
uses: astral-sh/setup-uv@v8.3.2
with:
python-version: "3.14"

- name: Install Dependencies
run: uv sync

- name: Yaml Lint
run: |
uv run --no-sync invoke debug.env
uv run --no-sync invoke tests.yamllint
72 changes: 72 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Basics
*#
*.un~
*~
.#*
.*.sw[a-z]
/.yardoc
/_yardoc/
/coverage/
/pkg/
/spec/reports/
\#*#
pkg/
**/tmp/**
**/wip/**
**/vendor/**
**/.bin/**
**/.vendor/**
**/.bundle/**

# Machine-specific config — generated by `inv setup.properties` (see modules/setup/properties.py)
/properties.yml

# Python
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
**/__pycache__/**
**/*.pyc
**/.ruff_cache/**
**/.pytest_cache/**

# Virtual environments
**/.venv/**
.venv/
venv/
ENV/
env/

# uv
uv.lock.bak

# Linters / tooling caches
.ruff_cache/
.pylint.d/
.mypy_cache/

# Linux
**/.directory
**/.Trash-*

# macOS
**/.DS_Store
**/.localized

# VSCode
.vscode/*
!.vscode/extensions.json
!.vscode/settings.json
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.14
28 changes: 28 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"recommendations": [
"charliermarsh.ruff",
"codezombiech.gitignore",
"editorconfig.editorconfig",
"esbenp.prettier-vscode",
"github.remotehub",
"github.vscode-github-actions",
"github.vscode-pull-request-github",
"juggernautjp.less-toml",
"ms-python.python",
"ms-vscode.live-server",
"ms-vscode.remote-explorer",
"ms-vscode.remote-repositories",
"redhat.vscode-xml",
"redhat.vscode-yaml",
"repreng.csv",
"ryu1kn.partial-diff",
"streetsidesoftware.code-spell-checker",
"tamasfe.even-better-toml",
"tomoki1207.pdf",
"yzane.markdown-pdf"
],
"unwantedRecommendations": [
"mechatroner.rainbow-csv",
"eamodio.gitlens"
]
}
11 changes: 11 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.ruff": "explicit",
"source.organizeImports.ruff": "explicit"
}
},
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python"
}
42 changes: 42 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
# https://yamllint.readthedocs.io/en/stable/rules.html

extends: default

ignore: |
**/tmp
**/.venv
**/*.mako.yml

yaml-files:
- '*.yaml'
- '*.yml'
- '.yamllint'

rules:
anchors: enable
braces: enable
brackets: enable
colons: enable
commas: enable
comments:
level: warning
comments-indentation:
level: warning
document-end: disable
document-start:
level: warning
empty-lines: disable
empty-values: disable
float-values: disable
hyphens: enable
indentation: enable
key-duplicates: enable
key-ordering: disable
line-length: disable
new-line-at-end-of-file: enable
new-lines: enable
octal-values: disable
quoted-strings: disable
trailing-spaces: enable
truthy: disable
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Levon Becker

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
61 changes: 61 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Template Python
[![Tests](https://github.com/LevonBecker/template_python/actions/workflows/tests.yml/badge.svg)](https://github.com/LevonBecker/template_python/actions/workflows/tests.yml)

Minimal skeleton for a Python repository: invoke tasks, a couple of shared modules, uv for
environment/dependency management, and CI (ruff, pylint, pytest, yamllint, actionlint). No AI-agent
tooling — see [`template_ai_python`](https://github.com/LevonBecker/template_ai_python), which forks
this repo and adds that layer on top.

## Setup
```bash
./setup.sh # macOS/Linux
.\setup.ps1 # Windows (PowerShell)
```

Creates a `.venv` with `uv` and installs dependencies. Update `properties.yml` with the local repo
path before running tasks.

## Project Structure
```
pyproject.toml # Dependencies (Python >=3.14), ruff/pylint/pytest config
invoke.yml # Invoke config (auto_dash_names: false)
setup.sh # Shell-based setup script (uv venv + uv sync)
properties.yml # Project configuration (repo path/remote, template path/remote)
modules/
common/ # cli.py, properties.py, utils.py — shared helpers
setup/ # properties.py — creates properties.yml (no-op if it exists), called by setup.sh/setup.ps1; templates/properties/*.yml — tier fragments
tasks/
__init__.py # Wires the invoke Collection (debug, ruff, setup, tests) plus top-level aliases (fix, test)
combos.py # Top-level aliases: fix, test
debug.py # debug.env — print cwd + sorted env vars
ruff.py # ruff.fix, ruff.format
setup.py # setup.properties — creates/stamps properties.yml
tests.py # tests.actionlint, tests.pylint, tests.pytest, tests.rufflint, tests.yamllint
.github/
copilot-instructions.md # What this repo is, for GitHub Copilot
workflows/
tests.yml # CI: ruff + pylint + pytest + yamllint + actionlint, on PRs to development/main
.vscode/
extensions.json # Recommended VS Code extensions
settings.json # Ruff formatter + Python interpreter settings
```

## Invoke Tasks
```sh
uv run --no-sync invoke # List all available tasks
uv run --no-sync invoke test # Ruff + Pylint + pytest + yamllint + actionlint
uv run --no-sync invoke fix # Ruff autocorrect + format
uv run --no-sync invoke setup.properties # Create/stamp properties.yml
```

## Modules
| Module | Purpose |
|--------|---------|
| [`modules/common/`](modules/common/README.md) | CLI helpers, `properties.yml` config reader, output/utility helpers |
| [`modules/setup/`](modules/setup/README.md) | Creates `properties.yml` (no-op if it exists) from tier fragments, called by `setup.sh`/`setup.ps1` |

See [modules/README.md](modules/README.md) for full details.

## CI
GitHub Actions runs Ruff, Pylint, pytest, yamllint, and actionlint on every pull request targeting
`development` or `main` via `.github/workflows/tests.yml`.
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0.0
Loading