Skip to content

Commit 8b06c55

Browse files
authored
docs: update the contributing guide and agent rules (#2415)
Small cleanup of `CONTRIBUTING.md` and `.rules.md`: - Add a YAML quoting rule: leave values unquoted unless quotes are needed, then use double quotes. The SDK and client guides get the same rule. - Note in `.rules.md` how models are configured: `validate_by_name=True, validate_by_alias=True` plus an explicit `Field(alias=...)` for each camelCase field. - Unwrap the two hard-wrapped paragraphs in "Linting the docs and website" so they match the rest of the file. *✍️ Drafted by Claude Code*
1 parent 50af56a commit 8b06c55

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

‎.rules.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Read [CONTRIBUTING.md](CONTRIBUTING.md) first. It covers setup, tasks, tests, co
1212

1313
Don't introduce a shared Pydantic base model to centralize `model_config`. Each model inherits `pydantic.BaseModel` and declares `model_config = ConfigDict(...)` inline, which also keeps ruff's flake8-type-checking and `RUF012` checks working, since they only recognize a literal `pydantic.BaseModel` base.
1414

15+
Models set `validate_by_name=True, validate_by_alias=True` in their `ConfigDict` and give each camelCase wire name an explicit `Field(alias=...)`.
16+
1517
## Architecture
1618

1719
### Crawler hierarchy

‎CONTRIBUTING.md‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ uv run poe e2e-templates-tests
8181
- On Windows with Python 3.12 or older, `datetime.now()` ticks in 1-15 ms steps, so two timestamps taken a few milliseconds apart can be equal. A test that asserts one timestamp is later than another injects a `Mock` clock instead of sleeping.
8282
- For a TCP endpoint that must refuse connections, bind a socket to `('127.0.0.1', 0)` and hold it open without calling `listen()`. A hard-coded port can be taken by a server in a parallel xdist worker. Test servers use `127.0.0.1`, since on Windows `localhost` resolves to both IPv4 and IPv6.
8383

84+
### YAML
85+
86+
Leave YAML values unquoted unless quotes are needed: a plain value that would change type (`"3.14"`, `"true"`, `""`), start with an indicator character (`"*"`, `"@apify/*"`), contain a colon followed by a space or a `#` preceded by one (`"a: b"`, `"a #b"`), or need an escape sequence (`"\n"`). Use double quotes then. Keep single quotes when the value itself contains double quotes, and for string literals inside GitHub Actions expressions (`${{ ... }}`, `if:` conditions), where double quotes are invalid.
87+
8488
## Documentation
8589

8690
We follow the [Google docstring format](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html) for code documentation. All user-facing classes and functions must be documented. Documentation standards are enforced using [Ruff](https://docs.astral.sh/ruff/).
@@ -97,20 +101,15 @@ uv run poe run-docs
97101

98102
### Linting the docs and website
99103

100-
Markdown content (this guide, `README.md`, and the `docs/` folder) is checked with
101-
[markdownlint](https://github.com/DavidAnson/markdownlint). The Docusaurus website code is linted
102-
with [oxlint](https://oxc.rs/) in type-aware mode (types come from `website/tsconfig.json`) and
103-
formatted with [oxfmt](https://oxc.rs/). All of them run in CI.
104-
To run them locally (requires Node.js 22.12 or newer and pnpm), from the `website/` directory:
104+
Markdown content (this guide, `README.md`, and the `docs/` folder) is checked with [markdownlint](https://github.com/DavidAnson/markdownlint). The Docusaurus website code is linted with [oxlint](https://oxc.rs/) in type-aware mode (types come from `website/tsconfig.json`) and formatted with [oxfmt](https://oxc.rs/). All of them run in CI. To run them locally (requires Node.js 22.12 or newer and pnpm), from the `website/` directory:
105105

106106
```sh
107107
pnpm lint # lint Markdown and website code
108108
pnpm lint:fix # auto-fix both
109109
pnpm format # format the website code
110110
```
111111

112-
Doc images are committed as optimized `.webp`. To convert a new image, run
113-
`pnpm opt:images <path-to-image>` from the `website/` directory.
112+
Doc images are committed as optimized `.webp`. To convert a new image, run `pnpm opt:images <path-to-image>` from the `website/` directory.
114113

115114
## Commits
116115

0 commit comments

Comments
 (0)