Skip to content

Commit 943f9f8

Browse files
committed
Merge remote-tracking branch 'origin/master' into chore/alias-generator-models
# Conflicts: # uv.lock
2 parents 2747f69 + a25f0aa commit 943f9f8

21 files changed

Lines changed: 68150 additions & 66688 deletions

.github/workflows/_checks.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
runs-on: ubuntu-latest
2525
steps:
2626
- name: Checkout repository
27-
uses: actions/checkout@v6
27+
uses: actions/checkout@v7
2828
- name: Run actionlint
2929
uses: rhysd/actionlint@v1.7.12
3030

@@ -33,7 +33,7 @@ jobs:
3333
runs-on: ubuntu-latest
3434
steps:
3535
- name: Checkout repository
36-
uses: actions/checkout@v6
36+
uses: actions/checkout@v7
3737
- name: Check spelling with typos
3838
uses: crate-ci/typos@v1
3939

@@ -54,7 +54,7 @@ jobs:
5454
runs-on: ubuntu-latest
5555
steps:
5656
- name: Checkout repository
57-
uses: actions/checkout@v6
57+
uses: actions/checkout@v7
5858

5959
- name: Set up Python
6060
uses: actions/setup-python@v6
@@ -110,7 +110,7 @@ jobs:
110110

111111
steps:
112112
- name: Checkout repository
113-
uses: actions/checkout@v6
113+
uses: actions/checkout@v7
114114

115115
- name: Set up Python ${{ matrix.python-version }}
116116
uses: actions/setup-python@v6
@@ -149,7 +149,7 @@ jobs:
149149
runs-on: ubuntu-latest
150150
steps:
151151
- name: Checkout repository
152-
uses: actions/checkout@v6
152+
uses: actions/checkout@v7
153153

154154
- name: Set up uv package manager
155155
uses: astral-sh/setup-uv@v8.2.0

.github/workflows/manual_regenerate_models.yaml

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -59,26 +59,10 @@ jobs:
5959
fi
6060
6161
- name: Checkout apify-client-python
62-
uses: actions/checkout@v6
62+
uses: actions/checkout@v7
6363
with:
6464
token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
6565

66-
# If the branch already exists on the remote (e.g. from a previous run, possibly with reviewer
67-
# commits), check it out so regeneration builds on top of it. Otherwise stay on the default
68-
# branch and let the signed-commit step below create the remote branch — its create-branch
69-
# flow does `git fetch ... $BRANCH:refs/heads/$BRANCH` which fails if $BRANCH is already
70-
# checked out locally.
71-
- name: Set up branch
72-
id: branch-setup
73-
run: |
74-
if git ls-remote --exit-code --heads origin "$BRANCH" > /dev/null 2>&1; then
75-
git fetch origin "$BRANCH":"$BRANCH"
76-
git switch "$BRANCH"
77-
echo "create_branch=false" >> "$GITHUB_OUTPUT"
78-
else
79-
echo "create_branch=true" >> "$GITHUB_OUTPUT"
80-
fi
81-
8266
# Download the pre-built OpenAPI spec artifact from the apify-docs workflow run.
8367
# Skipped for manual runs — datamodel-codegen will fetch from the published spec URL instead.
8468
- name: Download OpenAPI spec artifact
@@ -109,15 +93,43 @@ jobs:
10993
uv run poe generate-models
11094
fi
11195
96+
# Proceed only when regeneration actually changes the models relative to the current master.
97+
# The job runs on a fresh master checkout, so anything already merged into master (e.g. a
98+
# manually merged client PR carrying the same spec change, or a docs PR that merged master in
99+
# and re-emits an already-applied change) produces no diff here and we skip — instead of
100+
# opening a PR that just duplicates what master already has.
101+
- name: Check for model changes
102+
id: changes
103+
run: |
104+
if git diff --quiet -- src/apify_client/_models.py src/apify_client/_typeddicts.py src/apify_client/_literals.py; then
105+
echo "No model changes relative to master — nothing to regenerate."
106+
echo "has_changes=false" >> "$GITHUB_OUTPUT"
107+
else
108+
echo "has_changes=true" >> "$GITHUB_OUTPUT"
109+
fi
110+
111+
# Point the auto-update branch at the current master so the signed-commit step below records
112+
# the regenerated models as a single commit on top of it. Resetting to master (instead of
113+
# building on a possibly stale existing branch) is what keeps the committed diff relative to
114+
# the current master: an already-merged change can never reappear. Any previous content on the
115+
# branch is intentionally replaced, so the PR always reflects "current master + freshly
116+
# regenerated models" — and it still updates whenever the source docs PR gets new commits.
117+
- name: Point branch at current master
118+
if: steps.changes.outputs.has_changes == 'true'
119+
run: |
120+
git checkout -B "$BRANCH"
121+
git push --force origin "HEAD:refs/heads/$BRANCH"
122+
112123
- name: Commit model changes
113124
id: commit
125+
if: steps.changes.outputs.has_changes == 'true'
114126
uses: apify/actions/signed-commit@v1.2.0
115127
with:
116128
message: ${{ env.TITLE }}
117129
add: 'src/apify_client/_models.py src/apify_client/_typeddicts.py src/apify_client/_literals.py'
118130
github-token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
119131
branch: ${{ env.BRANCH }}
120-
create-branch: ${{ steps.branch-setup.outputs.create_branch }}
132+
create-branch: 'false'
121133

122134
- name: Create or update PR
123135
if: steps.commit.outputs.committed == 'true'

.github/workflows/manual_release_docs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
check-regexp: '^Checks'
5050

5151
- name: Checkout repository
52-
uses: actions/checkout@v6
52+
uses: actions/checkout@v7
5353
with:
5454
ref: ${{ inputs.ref }}
5555
token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}

.github/workflows/manual_version_docs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
check-regexp: '^Checks'
5050

5151
- name: Checkout repository
52-
uses: actions/checkout@v6
52+
uses: actions/checkout@v7
5353
with:
5454
token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
5555

CHANGELOG.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22

33
All notable changes to this project will be documented in this file.
44

5-
<!-- git-cliff-unreleased-start -->
6-
## 3.0.3 - **not yet released**
5+
## [3.0.3](https://github.com/apify/apify-client-python/releases/tag/v3.0.3) (2026-06-18)
6+
7+
### 🐛 Bug Fixes
8+
9+
- Include all supported fields for ad-hoc webhooks ([#855](https://github.com/apify/apify-client-python/pull/855)) ([6eb267d](https://github.com/apify/apify-client-python/commit/6eb267dbe620cb9d864c2390a84dfeb851cecc7c)) by [@apify-service-account](https://github.com/apify-service-account)
10+
- Only log any error that happens during log redirection ([#866](https://github.com/apify/apify-client-python/pull/866)) ([a2cc987](https://github.com/apify/apify-client-python/commit/a2cc987b6d1ef1d06b37a179876b12ee4f739f5f)) by [@Pijukatel](https://github.com/Pijukatel), closes [#864](https://github.com/apify/apify-client-python/issues/864)
711

812

9-
<!-- git-cliff-unreleased-end -->
1013
## [3.0.2](https://github.com/apify/apify-client-python/releases/tag/v3.0.2) (2026-05-26)
1114

1215
### 🐛 Bug Fixes
@@ -253,14 +256,14 @@ All notable changes to this project will be documented in this file.
253256
- Add rate limit statistics ([#343](https://github.com/apify/apify-client-python/pull/343)) ([f35c68f](https://github.com/apify/apify-client-python/commit/f35c68ff824ce83bf9aca893589381782a1a48c7)) by [@Mantisus](https://github.com/Mantisus)
254257

255258

256-
## [1.8.1](https://github.com/apify/apify-client-python/releases/tags/v1.8.1) (2024-09-17)
259+
## [1.8.1](https://github.com/apify/apify-client-python/releases/tag/v1.8.1) (2024-09-17)
257260

258261
### 🐛 Bug Fixes
259262

260263
- Batch add requests can handle more than 25 requests ([#268](https://github.com/apify/apify-client-python/pull/268)) ([9110ee0](https://github.com/apify/apify-client-python/commit/9110ee08954762aed00ac09cd042e802c1d041f7)) by [@vdusek](https://github.com/vdusek), closes [#264](https://github.com/apify/apify-client-python/issues/264)
261264

262265

263-
## [1.8.0](https://github.com/apify/apify-client-python/releases/tags/v1.8.0) (2024-08-30)
266+
## [1.8.0](https://github.com/apify/apify-client-python/releases/tag/v1.8.0) (2024-08-30)
264267

265268
- drop support for Python 3.8
266269

@@ -369,7 +372,7 @@ All notable changes to this project will be documented in this file.
369372
- Start importing general constants and utilities from the `apify-shared` library
370373

371374

372-
## [1.3.0](https://github.com/apify/apify-client-python/releases/tag/v1.3.0) (2023-07-24)
375+
## [1.3.0](https://github.com/apify/apify-client-python/releases/tag/1.3.0) (2023-07-24)
373376

374377
### 🚀 Features
375378

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ classifiers = [
2525
keywords = ["apify", "api", "client", "automation", "crawling", "scraping"]
2626
dependencies = [
2727
"colorama>=0.4.0",
28-
"impit>=0.9.2",
28+
"impit~=0.12.0",
2929
"more_itertools>=10.0.0",
3030
"pydantic[email]>=2.11.0",
3131
]

renovate.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"lockFileMaintenance": {
99
"enabled": true,
1010
"automerge": true,
11-
"automergeType": "branch"
11+
"automergeType": "pr"
1212
},
1313
"packageRules": [
1414
{
@@ -18,11 +18,15 @@
1818
"groupName": "major/minor dev dependencies",
1919
"groupSlug": "dev-dependencies",
2020
"automerge": true,
21-
"automergeType": "branch"
21+
"automergeType": "pr"
2222
},
2323
{
2424
"matchPackageNames": ["@apify/*", "@crawlee/*", "apify", "apify-client", "apify-shared", "apify-fingerprint-datapoints", "crawlee", "got-scraping"],
2525
"minimumReleaseAge": "0 days"
26+
},
27+
{
28+
"matchUpdateTypes": ["lockFileMaintenance"],
29+
"minimumReleaseAgeBehaviour": "timestamp-optional"
2630
}
2731
],
2832
"minimumReleaseAge": "1 day",

scripts/postprocess_generated_models.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,17 @@ def _collapse_blank_lines(content: str) -> str:
6868
return re.sub(r'\n{3,}', '\n\n\n', content)
6969

7070

71+
def absolutize_doc_links(content: str) -> str:
72+
"""Rewrite root-relative Markdown links to absolute `docs.apify.com` URLs.
73+
74+
Descriptions come from the Apify API OpenAPI spec, where links to the Apify documentation are written
75+
root-relative (e.g. `](/platform/...)`). Rendered under the API reference `baseUrl`, those resolve to a
76+
non-existent `/api/client/python/platform/...` path, so prefix them with the docs domain. The negative
77+
lookahead leaves protocol-relative `](//host)` links untouched.
78+
"""
79+
return re.sub(r'\]\(/(?!/)', '](https://docs.apify.com/', content)
80+
81+
7182
def _ensure_typing_import(content: str, name: str) -> str:
7283
"""Append `name` to the `from typing import ...` line if not already imported.
7384
@@ -620,6 +631,7 @@ def postprocess_models(models_path: Path, literals_path: Path) -> list[Path]:
620631
"""
621632
original = models_path.read_text()
622633
fixed = fix_discriminators(original)
634+
fixed = absolutize_doc_links(fixed)
623635
fixed = convert_enums_to_literals(fixed)
624636
fixed = add_docs_group_decorators(fixed, 'Models')
625637
models_content, literals_content = split_literals_to_file(fixed)

src/apify_client/_models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ class ActorDefinition(BaseModel):
206206
storages: Storages | None = None
207207
default_memory_mbytes: str | int | None = None
208208
"""
209-
Specifies the default amount of memory in megabytes to be used when the Actor is started. Can be an integer or a [dynamic memory expression](/platform/actors/development/actor-definition/dynamic-actor-memory).
209+
Specifies the default amount of memory in megabytes to be used when the Actor is started. Can be an integer or a [dynamic memory expression](https://docs.apify.com/platform/actors/development/actor-definition/dynamic-actor-memory).
210210
"""
211211
min_memory_mbytes: Annotated[int | None, Field(ge=128)] = None
212212
"""
@@ -813,7 +813,7 @@ class Dataset(BaseModel):
813813
),
814814
] = None
815815
"""
816-
Defines the schema of items in your dataset, the full specification can be found in [Apify docs](/platform/actors/development/actor-definition/dataset-schema)
816+
Defines the schema of items in your dataset, the full specification can be found in [Apify docs](https://docs.apify.com/platform/actors/development/actor-definition/dataset-schema)
817817
"""
818818
console_url: Annotated[AnyUrl, Field(examples=['https://console.apify.com/storage/datasets/27TmTznX9YPeAYhkC'])]
819819
items_public_url: Annotated[

src/apify_client/_streamed_log.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -215,12 +215,16 @@ async def __aexit__(
215215
await self.stop()
216216

217217
async def _stream_log(self) -> None:
218-
async with self._log_client.stream(raw=True) as log_stream:
219-
if not log_stream:
220-
return
221-
try:
222-
async for data in log_stream.aiter_bytes():
223-
self._process_new_data(data)
224-
finally:
225-
# Flush the last buffered part even if the task is cancelled by `stop()`.
226-
self._log_buffer_content(include_last_part=True)
218+
try:
219+
async with self._log_client.stream(raw=True) as log_stream:
220+
if not log_stream:
221+
return
222+
try:
223+
async for data in log_stream.aiter_bytes():
224+
self._process_new_data(data)
225+
finally:
226+
# Flush the last buffered part even if the task is cancelled by `stop()`.
227+
self._log_buffer_content(include_last_part=True)
228+
except Exception:
229+
# Exception in log redirection should not propagate further.
230+
self._to_logger.exception('Log redirection stopped due to unexpected error:')

0 commit comments

Comments
 (0)