Skip to content

Commit 5a7227a

Browse files
Naaremanclaude
andcommitted
Fix expert review issues: license format, PEP 735, nav, deprecation example
Critical: - license = { text = "MIT" } → license = "MIT" (PEP 639) - uv add --dev → uv add --group dev (PEP 735 dependency-groups) - [dependency-groups] in scaffold pyproject.toml replaces legacy dev-deps Important: - Removed deprecated target-version from ruff config - Added Python classifiers to scaffold pyproject.toml - Fixed mkdocs nav to only reference files scaffold creates - Fixed deprecation example (charset→encoding instead of confusing sep/delimiter) - setup-uv@v3 → @v4 - uv sync --all-extras --dev → uv sync --group dev in CI - Fixed importlib.metadata fallback to catch PackageNotFoundError specifically - Clarified hatchling wheel exclude is unnecessary with src layout - Added /pyckage check subcommand for anti-pattern audit - Added no-args assessment checklist (5 structural checks) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b0386b3 commit 5a7227a

File tree

7 files changed

+45
-20
lines changed

7 files changed

+45
-20
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ pyckage activates automatically when you're working on Python package tasks. You
4545
/pyckage docs # Set up mkdocs + docstrings
4646
/pyckage lifecycle # Manage deprecations and versioning
4747
/pyckage release # Walk through the PyPI release ritual
48+
/pyckage check # Audit your project for common mistakes
4849
/pyckage # Assess your project against all 5 principles
4950
```
5051

SKILL.md

Lines changed: 12 additions & 3 deletions
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] [package-name]"
9+
argument-hint: "[scaffold|api|test|docs|lifecycle|release|check] [package-name]"
1010
---
1111

1212
# pyckage
@@ -108,9 +108,18 @@ When invoked with `/pyckage <subcommand>`, route based on the first argument:
108108
| `/pyckage docs` | Read [references/04-docs.md](references/04-docs.md) and set up or improve documentation |
109109
| `/pyckage lifecycle` | Read [references/05-lifecycle.md](references/05-lifecycle.md) and manage deprecations |
110110
| `/pyckage release` | Read [references/06-release.md](references/06-release.md) and walk through the release ritual |
111-
| `/pyckage` (no args) | Assess the current project against all five principles and suggest improvements |
111+
| `/pyckage check` | Read [references/07-common-mistakes.md](references/07-common-mistakes.md) and audit current project for anti-patterns |
112+
| `/pyckage` (no args) | Assess the current project against all five principles (see checklist below) |
112113

113-
When invoked without a subcommand (auto-triggered or plain `/pyckage`), use the Quick Decision Guide below.
114+
When invoked without a subcommand (auto-triggered or plain `/pyckage`), run this assessment:
115+
116+
1. **Structure** — Is there a `src/` layout? Does `__init__.py` have `__all__`?
117+
2. **Communication** — Is there an `errors.py` with a base exception? A `_messages.py` with `rich`?
118+
3. **Naming** — Do public functions follow `verb_noun()`? Are families consistent?
119+
4. **Documentation** — Do all public functions have Google-style docstrings?
120+
5. **Lifecycle** — Is `__version__` from `importlib.metadata`? Is there a CHANGELOG?
121+
122+
Then use the Quick Decision Guide below for any specific improvements.
114123

115124
---
116125

references/01-scaffold.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ cd my-package
1818

1919
# 3. Add core dependencies
2020
uv add rich # user messages
21-
uv add --dev pytest pytest-cov ruff mypy mkdocs-material mkdocstrings[python]
21+
uv add --group dev pytest pytest-cov ruff mypy mkdocs-material mkdocstrings[python]
2222

2323
# 4. Initialize git
2424
git init
@@ -40,9 +40,16 @@ name = "my-package"
4040
version = "0.1.0"
4141
description = "One clear sentence describing what this does."
4242
readme = "README.md"
43-
license = { text = "MIT" }
43+
license = "MIT"
44+
license-files = ["LICENSE"]
4445
authors = [{ name = "Your Name", email = "you@example.com" }]
4546
requires-python = ">=3.10"
47+
classifiers = [
48+
"Programming Language :: Python :: 3.10",
49+
"Programming Language :: Python :: 3.11",
50+
"Programming Language :: Python :: 3.12",
51+
"Programming Language :: Python :: 3.13",
52+
]
4653
dependencies = [
4754
"rich>=13.0",
4855
]
@@ -52,6 +59,16 @@ Homepage = "https://github.com/you/my-package"
5259
Documentation = "https://you.github.io/my-package"
5360
Repository = "https://github.com/you/my-package"
5461

62+
[dependency-groups]
63+
dev = [
64+
"pytest>=8.0",
65+
"pytest-cov>=5.0",
66+
"ruff>=0.4",
67+
"mypy>=1.0",
68+
"mkdocs-material>=9.0",
69+
"mkdocstrings[python]>=0.25",
70+
]
71+
5572
[build-system]
5673
requires = ["hatchling"]
5774
build-backend = "hatchling.build"
@@ -61,7 +78,6 @@ packages = ["src/my_package"]
6178

6279
[tool.ruff]
6380
line-length = 88
64-
target-version = "py310"
6581

6682
[tool.ruff.lint]
6783
select = ["E", "F", "I", "UP"]

references/04-docs.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,7 @@ plugins:
8383

8484
nav:
8585
- Home: index.md
86-
- Getting Started: getting-started.md
8786
- API Reference: api.md
88-
- Changelog: changelog.md
8987
```
9088
9189
### `docs/api.md` — auto-generated from docstrings

references/05-lifecycle.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,12 @@ def read_data(path):
106106
When an argument is renamed or removed:
107107

108108
```python
109-
def read_csv(path, encoding="utf-8", *, sep=None, delimiter=None):
109+
def read_csv(path, *, charset=None, encoding="utf-8"):
110110
"""..."""
111-
if sep is not None:
112-
deprecated("sep", "delimiter", version="0.5.0")
113-
delimiter = sep
114-
# use delimiter going forward
111+
if charset is not None:
112+
deprecated("charset", "encoding", version="0.5.0")
113+
encoding = charset
114+
# use encoding going forward
115115
```
116116

117117
---

references/06-release.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,13 @@ jobs:
9090
- uses: actions/checkout@v4
9191

9292
- name: Install uv
93-
uses: astral-sh/setup-uv@v3
93+
uses: astral-sh/setup-uv@v4
9494

9595
- name: Set up Python ${{ matrix.python-version }}
9696
run: uv python install ${{ matrix.python-version }}
9797

9898
- name: Install dependencies
99-
run: uv sync --all-extras --dev
99+
run: uv sync --group dev
100100

101101
- name: Lint
102102
run: uv run ruff check src/
@@ -129,7 +129,7 @@ jobs:
129129
- uses: actions/checkout@v4
130130
131131
- name: Install uv
132-
uses: astral-sh/setup-uv@v3
132+
uses: astral-sh/setup-uv@v4
133133
134134
- name: Build
135135
run: uv build
@@ -162,7 +162,7 @@ jobs:
162162
- uses: actions/checkout@v4
163163
164164
- name: Install uv
165-
uses: astral-sh/setup-uv@v3
165+
uses: astral-sh/setup-uv@v4
166166
167167
- name: Install dependencies
168168
run: uv sync --dev

references/07-common-mistakes.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ locally but the installed package may be broken (missing files, wrong imports).
4141
### Including tests/ in the wheel
4242
**Mistake:** Build includes a top-level `tests/` in the wheel.
4343
**Why:** Writes to `site-packages/tests/`, colliding with other packages.
44-
**Fix:** With hatchling, use `[tool.hatch.build.targets.wheel] exclude = ["tests"]`.
44+
**Fix:** With src layout + `packages = ["src/my_package"]`, tests are excluded automatically.
45+
For flat layouts, explicitly exclude: `[tool.hatch.build.targets.wheel] exclude = ["tests"]`.
4546

4647
### Putting `__init__.py` in tests/
4748
**Why:** Confuses package discovery. Tests should never be importable.
@@ -143,9 +144,9 @@ __version__ = version("my-package")
143144
**Fix:**
144145
```python
145146
try:
146-
from importlib.metadata import version
147+
from importlib.metadata import version, PackageNotFoundError
147148
__version__ = version("my-package")
148-
except Exception:
149+
except PackageNotFoundError:
149150
__version__ = "0.0.0"
150151
```
151152

0 commit comments

Comments
 (0)