Skip to content

Commit ac471aa

Browse files
committed
Update AGENTS.md with context about docs
1 parent 782d566 commit ac471aa

1 file changed

Lines changed: 23 additions & 16 deletions

File tree

AGENTS.md

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,54 @@
1-
## Quick orientation for AI coding agents
1+
# Quick orientation for AI coding agents
22

3-
This repository is a hands-on, runnable "Ultimate Python" study guide composed of many small, standalone example modules under `ultimatepython/` grouped by topic (syntax, data_structures, classes, advanced). The goal for any change is to keep examples readable and runnable by humans and by the provided runner.
4-
5-
Key facts an agent must know (short):
3+
## Key facts an agent must know (short):
64

75
- The runner: `runner.py` dynamically imports every module under `ultimatepython` and runs any callable named `main` with zero parameters. Keep `main()` functions parameterless, idempotent, and side-effect safe for CI.
86
- Single-file runs are supported: modules are runnable with `python ultimatepython/<category>/<module>.py`. Most modules already include `if __name__ == "__main__": main()`.
97
- Examples use plain Python stdlib only. Avoid adding new third-party dependencies without updating `requirements.txt` and `pyproject.toml`.
108
- Assertions are used as the primary verification mechanism inside examples (not pytest tests). Preserve their intent and messages when editing.
119

12-
Patterns and conventions to follow
10+
## Patterns and conventions to follow
1311

1412
- main() contract: must be a function, accept zero parameters, and not raise exceptions when run. The runner asserts the function is callable and has zero parameters. Example: `ultimatepython/syntax/function.py` and `ultimatepython/classes/basic_class.py`.
1513
- Module structure: brief module docstring, helper functions/classes, then `main()` demonstrating usage via asserts, and final `if __name__ == "__main__": main()`.
1614
- Avoid long-running or destructive operations in examples. If a module interacts with the filesystem (e.g., `advanced/file_handling.py`), keep operations local to ephemeral files (module uses `_TARGET_FILE = "sample.txt"`), and clean up after running.
1715
- Typing: some modules include simple type hints; prefer to keep existing style and minimal typing additions only.
1816
- Formatting & linting: the repo uses `ruff` and `isort` settings in `pyproject.toml`. Try to keep line-length <= 160 and maintain import ordering consistent with isort defaults.
1917

20-
Developer workflows and useful commands
18+
## When creating or modifying modules
19+
20+
- Preserve the didactic nature: keep explanatory comments and short, clear examples.
21+
- If you add new modules, include them under the appropriate folder and follow the same pattern (module docstring, helpers, `main()`, `if __name__...`). The runner will pick them up automatically.
22+
- If a change requires a new dependency, add it to `requirements.txt` and update `pyproject.toml` before proposing a PR.
23+
24+
## Top-level README files
25+
26+
- The top-level `README.md` is the primary project landing page: it explains the repo goals, running instructions, and links to example modules (it also shows badges for CI and coverage). When changing top-level documentation, keep the runner guidance intact (it points to `runner.py`) and preserve any badges and links.
27+
- Translated files like `README.ko.md`, `README.zh_tw.md`, `README.es.md`, `README.de.md`, `README.fr.md`, and `README.hi.md` are language variants of the same content. If you update the English `README.md`, consider updating translations or add a brief note in the PR explaining why translations were not updated.
28+
29+
## Developer workflows and useful commands
2130

2231
- Run all examples locally (fast smoke):
2332

24-
python runner.py
33+
```bash
34+
python runner.py
35+
```
2536

2637
- Run a single example (recommended when editing):
2738

28-
python ultimatepython/syntax/function.py
39+
```bash
40+
python ultimatepython/syntax/function.py
41+
```
2942

3043
- Check formatting/linting (ruff/isort configured in `pyproject.toml`): run your local ruff/isort commands or CI.
3144
- Coverage config exists in `pyproject.toml` (coverage fail_under=80). The examples use assertions; running `runner.py` is a good quick coverage smoke.
3245

33-
Integration points & CI notes
46+
## Integration points & CI notes
3447

3548
- CI expects that running `runner.py` and executing each `main()` will succeed. Avoid adding code that requires network access, long sleeps, or interactive input.
3649
- Do not introduce external services or config files; this repo intentionally uses only the Python standard library.
3750

38-
When creating or modifying modules
39-
40-
- Preserve the didactic nature: keep explanatory comments and short, clear examples.
41-
- If you add new modules, include them under the appropriate folder and follow the same pattern (module docstring, helpers, `main()`, `if __name__...`). The runner will pick them up automatically.
42-
- If a change requires a new dependency, add it to `requirements.txt` and update `pyproject.toml` before proposing a PR.
43-
44-
Files and locations of interest (examples to inspect)
51+
## Files and locations of interest (examples to inspect)
4552

4653
- `runner.py` — how modules are discovered and executed (pkgutil.walk_packages + `main` lookups).
4754
- `ultimatepython/syntax/*.py` — simple, illustrative examples of the `main()` pattern.

0 commit comments

Comments
 (0)