43 lines
1001 B
Markdown
43 lines
1001 B
Markdown
# Python profile
|
|
|
|
Enable this profile for Python repositories.
|
|
|
|
## Suggested standard
|
|
|
|
Codex SHOULD prefer:
|
|
|
|
- `pytest` for tests;
|
|
- `ruff` for linting and formatting checks;
|
|
- type hints for public functions and non-trivial logic;
|
|
- `pathlib` for filesystem paths where practical;
|
|
- explicit error handling;
|
|
- small, focused functions;
|
|
- simple modules over unnecessary class hierarchies.
|
|
|
|
## Rules
|
|
|
|
Codex MUST:
|
|
|
|
- keep dependencies minimal;
|
|
- avoid broad `except` clauses unless justified;
|
|
- avoid hidden side effects at import time;
|
|
- separate business logic from CLI, web, or framework glue;
|
|
- avoid global mutable state unless justified;
|
|
- write tests for behavior, not implementation details;
|
|
- run tests inside Docker containers.
|
|
|
|
## Validation examples
|
|
|
|
Use project-specific Docker-based commands, for example:
|
|
|
|
```bash
|
|
docker compose run --rm app ruff check .
|
|
docker compose run --rm app pytest
|
|
```
|
|
|
|
If formatting is configured:
|
|
|
|
```bash
|
|
docker compose run --rm app ruff format --check .
|
|
```
|