MacHu-GWU/sqlalchemy_upsert_kit-project / .claude/skills/pywf-oss-base
pywf-oss-base
FlaggedShared conventions, references, and scripts of the pywf-oss skills for pywf open-source Python libraries: setup, layout, code style, tests, user docs and the agent skills that hold API and maintenance knowledge, CI and hosting, release, dependencies, and secrets. Load it before ad-hoc work on modules, tests, or docs in such a repo, for a question about these conventions, or when unsure which pywf-oss skill fits a job.
references/06-ruff.md
View on GitHub---
description: "The format and lint tasks and their paths, the [tool.ruff] configuration, the small lint rule set, and # fmt: off / # fmt: on for hand-written layout. Read before finishing any change to Python code, or when ruff reports something."
---
# ruff
---
## 1. Tasks
```bash
mise run format # uvx ruff format <package_name> tests .mise/tasks .claude/skills/pywf-oss-base
mise run lint # uvx ruff check --select F401,F821,F841 on the same paths, plus the one-import-per-statement check
```
Run `format`, then `lint`, before you finish any change to Python code.
The tasks cover only this repo's own code. Other folders in `.claude/skills/`, such as installed community skills, are third-party: never format or lint them, so they stay identical to their pinned commit.
The one-import-per-statement check is the base script `check_one_import_per_line.py`, because ruff cannot enforce this rule without also re-sorting imports. To split violations automatically:
```bash
python ${CLAUDE_SKILL_DIR}/../pywf-oss-base/scripts/check_one_import_per_line.py --paths <package_name> tests --fix
```
---
## 2. Configuration
`[tool.ruff]` in `pyproject.toml`:
- **Excluded paths:**
- `<package_name>/vendor`, which holds copied third-party code;
- `.claude/skills/*/assets`, which holds templates with placeholders.
- **`__init__.py` and `api.py` may have unused imports:** they are the re-exports.
- **The lint set is deliberately small:** unused imports (F401), undefined names (F821), unused variables (F841). Layout is the formatter's job; line length is not linted.
---
## 3. Keeping hand-written layout
Wrap a block in `# fmt: off` / `# fmt: on` when its layout carries meaning the formatter would destroy: field definitions in declarative models (dataclass, pydantic, ORM), lookup tables, matrices, and column-aligned test cases. Keep the fence as small as possible, at the indentation of the code it fences.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |