Skip to content

Commit 0ca01dd

Browse files
Naaremanclaude
andcommitted
Add example package, structure checker, and 4 new references
New features: - examples/my-package: complete reference implementation (22/22 checks pass) - scripts/check-structure.py: audit project against pyckage conventions - .github/workflows/check-budget.yml: CI token budget check on PRs New references: - 08-pre-commit.md: pre-commit hooks with ruff, mypy, pre-commit-hooks - 09-cli-entry-points.md: CLI with argparse/click, entry points, testing - 10-monorepo.md: uv workspaces, namespace packages - 11-automated-release.md: bump-my-version, conventional commits, git-cliff Updated: - 03-testing.md: replaced pandas fixtures with generic dicts + tmp_path - SKILL.md: added new references to routing table, new subcommands - README.md: updated structure and usage sections Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 91bb198 commit 0ca01dd

25 files changed

+1464
-17
lines changed

.github/workflows/check-budget.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: Check Token Budget
2+
on: pull_request
3+
jobs:
4+
budget:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v4
8+
- uses: actions/setup-python@v5
9+
with:
10+
python-version: "3.12"
11+
- run: python scripts/count-tokens.py .

README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ pyckage activates automatically when you're working on Python package tasks. You
4646
/pyckage lifecycle # Manage deprecations and versioning
4747
/pyckage release # Walk through the PyPI release ritual
4848
/pyckage check # Audit your project for common mistakes
49+
/pyckage pre-commit # Set up pre-commit hooks
50+
/pyckage cli # Add a CLI to your package
4951
/pyckage # Assess your project against all 5 principles
5052
```
5153

@@ -93,16 +95,26 @@ Before diving into details, you should be able to see the whole thing working en
9395
pyckage/
9496
├── SKILL.md # Main skill definition (philosophy + routing)
9597
├── README.md # This file
98+
├── examples/
99+
│ └── my-package/ # Complete reference implementation (22/22 checks)
96100
├── references/
97101
│ ├── 01-scaffold.md # Package scaffolding (the "whole game")
98102
│ ├── 02-api-design.md # Naming, messages, errors
99103
│ ├── 03-testing.md # pytest conventions and patterns
100104
│ ├── 04-docs.md # Docstrings + mkdocs-material
101105
│ ├── 05-lifecycle.md # Deprecation ceremony + versioning
102106
│ ├── 06-release.md # PyPI publishing + GitHub Actions
103-
│ └── 07-common-mistakes.md # Python packaging anti-patterns
104-
└── scripts/
105-
└── count-tokens.py # Token budget checker
107+
│ ├── 07-common-mistakes.md # Python packaging anti-patterns
108+
│ ├── 08-pre-commit.md # Pre-commit hooks setup
109+
│ ├── 09-cli-entry-points.md # Adding a CLI to your package
110+
│ ├── 10-monorepo.md # Monorepo + namespace packages
111+
│ └── 11-automated-release.md # Automated version bumps + changelog
112+
├── scripts/
113+
│ ├── count-tokens.py # Token budget checker
114+
│ └── check-structure.py # Audit project against pyckage conventions
115+
└── .github/
116+
└── workflows/
117+
└── check-budget.yml # CI: token budget check on PRs
106118
```
107119

108120
## Token Budget

SKILL.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description: >
66
mkdocs-material. Activate when creating/structuring Python packages, designing APIs,
77
naming functions, adding user messages/errors, writing tests, setting up docs, managing
88
deprecations, or publishing to PyPI.
9-
argument-hint: "[scaffold|api|test|docs|lifecycle|release|check] [package-name]"
9+
argument-hint: "[scaffold|api|test|docs|lifecycle|release|check|pre-commit|cli] [package-name]"
1010
---
1111

1212
# pyckage
@@ -32,6 +32,10 @@ relevant reference file from `references/`:
3232
| Adding deprecations or managing versions | [references/05-lifecycle.md](references/05-lifecycle.md) |
3333
| Releasing to PyPI or setting up CI/CD | [references/06-release.md](references/06-release.md) |
3434
| Auditing for common anti-patterns | [references/07-common-mistakes.md](references/07-common-mistakes.md) |
35+
| Setting up pre-commit hooks | [references/08-pre-commit.md](references/08-pre-commit.md) |
36+
| Adding a CLI to your package | [references/09-cli-entry-points.md](references/09-cli-entry-points.md) |
37+
| Managing a monorepo / namespace packages | [references/10-monorepo.md](references/10-monorepo.md) |
38+
| Automating releases (bump, changelog, CI) | [references/11-automated-release.md](references/11-automated-release.md) |
3539

3640
Read only what's relevant to the current task. Don't load everything at once.
3741

@@ -110,6 +114,8 @@ When invoked with `/pyckage <subcommand>`, route based on the first argument:
110114
| `/pyckage lifecycle` | Read [references/05-lifecycle.md](references/05-lifecycle.md) and manage deprecations |
111115
| `/pyckage release` | Read [references/06-release.md](references/06-release.md) and walk through the release ritual |
112116
| `/pyckage check` | Read [references/07-common-mistakes.md](references/07-common-mistakes.md) and audit current project for anti-patterns |
117+
| `/pyckage pre-commit` | Read [references/08-pre-commit.md](references/08-pre-commit.md) and set up pre-commit hooks |
118+
| `/pyckage cli` | Read [references/09-cli-entry-points.md](references/09-cli-entry-points.md) and add a CLI to the package |
113119
| `/pyckage` (no args) | Assess the current project against all five principles (see checklist below) |
114120

115121
When invoked without a subcommand (auto-triggered or plain `/pyckage`), run this assessment:

examples/my-package/.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
__pycache__/
2+
*.py[cod]
3+
*.egg-info/
4+
dist/
5+
build/
6+
.mypy_cache/
7+
.pytest_cache/
8+
.ruff_cache/
9+
.coverage
10+
htmlcov/
11+
*.egg
12+
.venv/
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.12

examples/my-package/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Changelog
2+
3+
## [Unreleased]
4+
5+
### Added
6+
7+
- `read_csv()` -- read a CSV file into a list of dicts.
8+
- `validate_schema()` -- check that required columns exist.
9+
- Custom error hierarchy: `MyPackageError`, `ValidationError`, `FileFormatError`.

examples/my-package/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# my-package
2+
3+
A tiny CSV reader utility.
4+
5+
## Installation
6+
7+
```bash
8+
pip install my-package
9+
```
10+
11+
## Quick start
12+
13+
```python
14+
from my_package import read_csv, validate_schema
15+
16+
# Read a CSV file into a list of dicts
17+
rows = read_csv("people.csv")
18+
19+
# Ensure required columns exist
20+
validate_schema(rows, ["name", "age"])
21+
22+
print(rows[0]["name"]) # Alice
23+
```

examples/my-package/docs/api.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# API Reference
2+
3+
## Core
4+
5+
::: my_package.core
6+
options:
7+
show_source: false
8+
heading_level: 3
9+
10+
## Errors
11+
12+
::: my_package.errors
13+
options:
14+
show_source: false
15+
heading_level: 3

examples/my-package/docs/index.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# my-package
2+
3+
A tiny CSV reader utility.
4+
5+
## Installation
6+
7+
```bash
8+
pip install my-package
9+
```
10+
11+
## Quick start
12+
13+
```python
14+
from my_package import read_csv, validate_schema
15+
16+
rows = read_csv("data.csv")
17+
validate_schema(rows, ["name", "age"])
18+
```

examples/my-package/mkdocs.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
site_name: my-package
2+
site_description: A tiny CSV reader utility.
3+
4+
theme:
5+
name: material
6+
7+
plugins:
8+
- search
9+
- mkdocstrings:
10+
handlers:
11+
python:
12+
options:
13+
docstring_style: google
14+
15+
nav:
16+
- Home: index.md
17+
- API Reference: api.md

0 commit comments

Comments
 (0)