Skip to content

Commit 9cb5260

Browse files
authored
docs: expand .rules.md with model generation and commit type guidance (#732)
Expands `.rules.md` with two improvements: - **Model generation**: details the full regeneration flow — `datamodel-code-generator` config, the postprocess script, local poe commands, and how CI auto-triggers from `apify/apify-docs` PRs - **Commit types**: clarifies which Conventional Commit types (`feat`/`fix`/`perf`/`refactor`/`style`) trigger a release and must be used for source code only, and maps the remaining types (`test:`, `docs:`, `ci:`, `chore:`, `build:`) to their correct scope
1 parent 6eb9aee commit 9cb5260

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

.rules.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ uv run poe type-check # Run ty type checker
1919
uv run poe unit-tests # Run unit tests
2020
uv run poe check-docstrings # Verify async docstrings match sync
2121
uv run poe fix-docstrings # Auto-fix async docstrings
22+
uv run poe generate-models # Regenerate _models.py from live OpenAPI spec
23+
uv run poe generate-models-from-file <path> # Regenerate from a local OpenAPI spec file
2224

2325
# Run a single test
2426
uv run pytest tests/unit/test_file.py
@@ -71,7 +73,15 @@ Docstrings are written on sync clients and **automatically copied** to async cli
7173

7274
### Data Models
7375

74-
`_models.py` is **auto-generated** from the OpenAPI spec using `datamodel-code-generator`. Do not edit manually; regenerate with `uv run poe generate-models`. Contains Pydantic v2 `BaseModel` classes for all API responses.
76+
`src/apify_client/_models.py` is **auto-generated** — do not edit it manually.
77+
78+
- Generated by `datamodel-code-generator` from the OpenAPI spec at `https://docs.apify.com/api/openapi.json` (config in `pyproject.toml` under `[tool.datamodel-codegen]`, aliases in `datamodel_codegen_aliases.json`)
79+
- After generation, `scripts/postprocess_generated_models.py` is run to apply additional fixes
80+
- To regenerate locally:
81+
- From the live published spec: `uv run poe generate-models`
82+
- From a local spec file: `uv run poe generate-models-from-file path/to/openapi.json`
83+
- In CI, model regeneration is triggered automatically by the `apify/apify-docs` repo when its OpenAPI spec changes (workflow `manual_regenerate_models.yaml`). It downloads the pre-built `openapi-bundles` artifact from the apify-docs workflow run, opens a PR titled `[TODO]: update generated models from apify-docs PR #N`, assigns it to the docs PR author, and posts a cross-repo comment on the original apify-docs PR
84+
- Manual regeneration is also possible from the GitHub Actions UI (`Regenerate models` workflow)
7585

7686
## Code Conventions
7787

@@ -80,7 +90,13 @@ Docstrings are written on sync clients and **automatically copied** to async cli
8090
- **Type checking**: ty (Astral's type checker)
8191
- **Docstrings**: Google style format, single backticks for inline code references (`` `ApifyClient` `` not ``` ``ApifyClient`` ```)
8292
- **Imports**: `from __future__ import annotations` used throughout
83-
- **Commits**: [Conventional Commits](https://www.conventionalcommits.org/) format (feat, fix, refactor, etc.)
93+
- **Commits**: [Conventional Commits](https://www.conventionalcommits.org/) format. Choose the type based on *what* changed, not just *why*:
94+
- `feat:` / `fix:` / `perf:` / `refactor:` / `style:`**source code only**; these trigger a release and appear in the changelog
95+
- `test:` — test additions or changes (no release triggered)
96+
- `docs:` — documentation changes; also triggers a doc release on master
97+
- `ci:` — CI/workflow changes
98+
- `chore:` — dependency bumps, tooling, generated files (e.g. model regeneration PRs), and other housekeeping
99+
- `build:` — build system changes
84100

85101
## Testing
86102

0 commit comments

Comments
 (0)