You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Copy file name to clipboardExpand all lines: .rules.md
+18-2Lines changed: 18 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,8 @@ uv run poe type-check # Run ty type checker
19
19
uv run poe unit-tests # Run unit tests
20
20
uv run poe check-docstrings # Verify async docstrings match sync
21
21
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
22
24
23
25
# Run a single test
24
26
uv run pytest tests/unit/test_file.py
@@ -71,7 +73,15 @@ Docstrings are written on sync clients and **automatically copied** to async cli
71
73
72
74
### Data Models
73
75
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)
75
85
76
86
## Code Conventions
77
87
@@ -80,7 +90,13 @@ Docstrings are written on sync clients and **automatically copied** to async cli
80
90
-**Type checking**: ty (Astral's type checker)
81
91
-**Docstrings**: Google style format, single backticks for inline code references (`` `ApifyClient` `` not ``` ``ApifyClient`` ```)
82
92
-**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
0 commit comments