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
ci: add markdown, website, and image lint checks (#882)
Adds Markdown, website, and image lint checks to CI, mirroring the setup
in `apify-docs` and `apify-core`. The docs and website now go through
the same kind of automated checks as the Python code.
The website tooling moves from eslint + prettier (which weren't wired
into CI) to [oxlint](https://oxc.rs/) and [oxfmt](https://oxc.rs/), and
[markdownlint](https://github.com/DavidAnson/markdownlint) now covers
the Markdown files.
Three jobs run in the existing Checks workflow:
- **Markdown lint** — `markdownlint` over `README.md`,
`CONTRIBUTING.md`, and the `docs/` folder.
- **Website lint and format** — `oxlint` plus an `oxfmt --check`
formatting gate for the Docusaurus site.
- **Image lint** — fails when a PR adds unoptimized raster images, which
should be converted with `pnpm opt:images` first.
Notes:
- The website JS keeps single quotes, set via `.editorconfig`
(`quote_type`) and `.oxfmtrc.json` (`singleQuote`).
- The markdownlint config matches `apify-docs`: line length is disabled
and inline HTML is allowed.
- Minor doc and code fixes were applied where needed to pass the new
checks.
Closes#594
@@ -80,8 +80,8 @@ Each input-side TypedDict ships in two casings: snake_case (`RequestDict`) and c
80
80
- 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`)
81
81
- After generation, `scripts/postprocess_generated_models.py` is run to apply additional fixes
82
82
- To regenerate locally:
83
-
- From the live published spec: `uv run poe generate-models`
84
-
- From a local spec file: `uv run poe generate-models-from-file path/to/openapi.json`
83
+
- From the live published spec: `uv run poe generate-models`
84
+
- From a local spec file: `uv run poe generate-models-from-file path/to/openapi.json`
85
85
- 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
86
86
- Manual regeneration is also possible from the GitHub Actions UI (`Regenerate models` workflow)
87
87
@@ -93,12 +93,12 @@ Each input-side TypedDict ships in two casings: snake_case (`RequestDict`) and c
93
93
-**Docstrings**: Google style format, single backticks for inline code references (`` `ApifyClient` `` not ``` ``ApifyClient`` ```)
94
94
-**Imports**: `from __future__ import annotations` used throughout
95
95
-**Commits**: [Conventional Commits](https://www.conventionalcommits.org/) format. Choose the type based on *what* changed, not just *why*:
96
-
-`feat:` / `fix:` / `perf:` / `refactor:` / `style:` — **source code only**; these trigger a release and appear in the changelog
97
-
-`test:` — test additions or changes (no release triggered)
98
-
-`docs:` — documentation changes; also triggers a doc release on master
99
-
-`ci:` — CI/workflow changes
100
-
-`chore:` — dependency bumps, tooling, generated files (e.g. model regeneration PRs), and other housekeeping
101
-
-`build:` — build system changes
96
+
-`feat:` / `fix:` / `perf:` / `refactor:` / `style:` — **source code only**; these trigger a release and appear in the changelog
97
+
-`test:` — test additions or changes (no release triggered)
98
+
-`docs:` — documentation changes; also triggers a doc release on master
99
+
-`ci:` — CI/workflow changes
100
+
-`chore:` — dependency bumps, tooling, generated files (e.g. model regeneration PRs), and other housekeeping
101
+
-`build:` — build system changes
102
102
103
103
## Testing
104
104
@@ -108,6 +108,7 @@ Each input-side TypedDict ships in two casings: snake_case (`RequestDict`) and c
108
108
-**Parallelism**: Tests run in parallel via `pytest-xdist`.
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+28-15Lines changed: 28 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -121,6 +121,22 @@ To run the documentation locally (requires Node.js):
121
121
uv run poe run-docs
122
122
```
123
123
124
+
### Linting the docs and website
125
+
126
+
Markdown content (this guide, `README.md`, and the `docs/` folder) is checked with
127
+
[markdownlint](https://github.com/DavidAnson/markdownlint). The Docusaurus website code is linted
128
+
with [oxlint](https://oxc.rs/) and formatted with [oxfmt](https://oxc.rs/). All of them run in CI.
129
+
To run them locally (requires Node.js 22.12 or newer and pnpm), from the `website/` directory:
130
+
131
+
```sh
132
+
pnpm lint # lint Markdown and website code
133
+
pnpm lint:fix # auto-fix both
134
+
pnpm format # format the website code
135
+
```
136
+
137
+
Doc images are committed as optimized `.webp`. To convert a new image, run
138
+
`pnpm opt:images <path-to-image>` from the `website/` directory.
139
+
124
140
## Commits
125
141
126
142
We use [Conventional Commits](https://www.conventionalcommits.org/) format for commit messages. This convention is used to automatically determine version bumps during the release process.
@@ -152,25 +168,22 @@ Publishing new versions to [PyPI](https://pypi.org/project/apify_client) is auto
152
168
153
169
1.**Do not do this unless absolutely necessary.** In all conceivable scenarios, you should use the `release` workflow instead.
154
170
2.**Make sure you know what you're doing.**
171
+
3. Update the version number by modifying the `version` field under `project` in `pyproject.toml`:
155
172
156
-
3. Update the version number:
157
-
158
-
- Modify the `version` field under `project` in `pyproject.toml`.
Copy file name to clipboardExpand all lines: docs/02_concepts/04_error_handling.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ When you use the Apify client, it automatically extracts all relevant data from
19
19
The Apify client provides dedicated error subclasses based on the HTTP status code of the failed response, so you can branch on error kind without inspecting `status_code` or `type`:
0 commit comments