apify 3.4.2b20__tar.gz → 3.4.2b22__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. {apify-3.4.2b20 → apify-3.4.2b22}/CHANGELOG.md +1 -0
  2. {apify-3.4.2b20 → apify-3.4.2b22}/PKG-INFO +6 -4
  3. {apify-3.4.2b20 → apify-3.4.2b22}/README.md +5 -3
  4. {apify-3.4.2b20 → apify-3.4.2b22}/pyproject.toml +1 -1
  5. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/_actor.py +1 -1
  6. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/_configuration.py +22 -5
  7. {apify-3.4.2b20 → apify-3.4.2b22}/.gitignore +0 -0
  8. {apify-3.4.2b20 → apify-3.4.2b22}/CONTRIBUTING.md +0 -0
  9. {apify-3.4.2b20 → apify-3.4.2b22}/LICENSE +0 -0
  10. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/__init__.py +0 -0
  11. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/_charging.py +0 -0
  12. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/_consts.py +0 -0
  13. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/_crypto.py +0 -0
  14. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/_proxy_configuration.py +0 -0
  15. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/_utils.py +0 -0
  16. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/_webhook.py +0 -0
  17. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/events/__init__.py +0 -0
  18. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/events/_apify_event_manager.py +0 -0
  19. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/events/_types.py +0 -0
  20. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/events/py.typed +0 -0
  21. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/log.py +0 -0
  22. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/py.typed +0 -0
  23. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/request_loaders/__init__.py +0 -0
  24. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/request_loaders/_apify_request_list.py +0 -0
  25. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/request_loaders/py.typed +0 -0
  26. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/scrapy/__init__.py +0 -0
  27. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/scrapy/_actor_runner.py +0 -0
  28. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/scrapy/_async_thread.py +0 -0
  29. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/scrapy/_logging_config.py +0 -0
  30. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/scrapy/_serialization.py +0 -0
  31. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/scrapy/extensions/__init__.py +0 -0
  32. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/scrapy/extensions/_httpcache.py +0 -0
  33. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/scrapy/middlewares/__init__.py +0 -0
  34. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/scrapy/middlewares/apify_proxy.py +0 -0
  35. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/scrapy/middlewares/py.typed +0 -0
  36. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/scrapy/pipelines/__init__.py +0 -0
  37. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/scrapy/pipelines/actor_dataset_push.py +0 -0
  38. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/scrapy/pipelines/py.typed +0 -0
  39. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/scrapy/py.typed +0 -0
  40. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/scrapy/requests.py +0 -0
  41. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/scrapy/scheduler.py +0 -0
  42. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/scrapy/utils.py +0 -0
  43. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/storage_clients/__init__.py +0 -0
  44. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/storage_clients/_apify/__init__.py +0 -0
  45. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/storage_clients/_apify/_alias_resolving.py +0 -0
  46. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/storage_clients/_apify/_api_client_creation.py +0 -0
  47. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/storage_clients/_apify/_dataset_client.py +0 -0
  48. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/storage_clients/_apify/_key_value_store_client.py +0 -0
  49. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/storage_clients/_apify/_models.py +0 -0
  50. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/storage_clients/_apify/_request_queue_client.py +0 -0
  51. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/storage_clients/_apify/_request_queue_shared_client.py +0 -0
  52. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/storage_clients/_apify/_request_queue_single_client.py +0 -0
  53. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/storage_clients/_apify/_storage_client.py +0 -0
  54. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/storage_clients/_apify/_utils.py +0 -0
  55. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/storage_clients/_apify/py.typed +0 -0
  56. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/storage_clients/_file_system/__init__.py +0 -0
  57. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/storage_clients/_file_system/_dataset_client.py +0 -0
  58. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/storage_clients/_file_system/_key_value_store_client.py +0 -0
  59. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/storage_clients/_file_system/_storage_client.py +0 -0
  60. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/storage_clients/_ppe_dataset_mixin.py +0 -0
  61. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/storage_clients/_smart_apify/__init__.py +0 -0
  62. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/storage_clients/_smart_apify/_storage_client.py +0 -0
  63. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/storage_clients/py.typed +0 -0
  64. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/storages/__init__.py +0 -0
  65. {apify-3.4.2b20 → apify-3.4.2b22}/src/apify/storages/py.typed +0 -0
@@ -25,6 +25,7 @@ All notable changes to this project will be documented in this file.
25
25
  - Correct reclaim_request count adjustment for already-handled requests ([#973](https://github.com/apify/apify-sdk-python/pull/973)) ([86f4cd5](https://github.com/apify/apify-sdk-python/commit/86f4cd53d774e940954faa0b80b7ca5733d74fcf)) by [@vdusek](https://github.com/vdusek)
26
26
  - **scrapy:** Drop deprecated spider arg from Scrapy proxy middleware methods ([#977](https://github.com/apify/apify-sdk-python/pull/977)) ([49dd836](https://github.com/apify/apify-sdk-python/commit/49dd836c986b0e3bda4bb6485be8ad95d286cd82)) by [@vdusek](https://github.com/vdusek)
27
27
  - Redirect input key in all file-system key-value store operations ([#976](https://github.com/apify/apify-sdk-python/pull/976)) ([1fbdce2](https://github.com/apify/apify-sdk-python/commit/1fbdce27452f1cdc9580a53edd6de3ce9fe36a1d)) by [@vdusek](https://github.com/vdusek)
28
+ - Respect explicit zero custom_after_sleep in metamorph and reboot ([#971](https://github.com/apify/apify-sdk-python/pull/971)) ([e8cda0a](https://github.com/apify/apify-sdk-python/commit/e8cda0a80339a21ce94cc382bd042509052ce1bf)) by [@vdusek](https://github.com/vdusek)
28
29
 
29
30
  ### 🚜 Refactor
30
31
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apify
3
- Version: 3.4.2b20
3
+ Version: 3.4.2b22
4
4
  Summary: Apify SDK for Python
5
5
  Project-URL: Apify Homepage, https://apify.com
6
6
  Project-URL: Changelog, https://docs.apify.com/sdk/python/docs/changelog
@@ -335,9 +335,11 @@ To create, run, and deploy your first Actor step by step, see the [Quick start g
335
335
 
336
336
  ## What are Actors?
337
337
 
338
- Actors are serverless cloud programs that can do almost anything a human can do in a web browser. They range from small tasks, such as filling in forms or unsubscribing from online services, all the way up to scraping and processing vast numbers of web pages.
338
+ Actors are serverless programs that can do almost anything. From simple scripts and web scrapers to complex automation workflows, AI agents, or even always-on services that expose HTTP endpoints.
339
339
 
340
- They run either locally or on the [Apify platform](https://docs.apify.com/platform/), where you can run them at scale, monitor them, schedule them, or publish and monetize them. If you're new to Apify, learn [what Apify is](https://docs.apify.com/platform/about) in the platform documentation.
340
+ They can run either locally or on the Apify platform, where you can scale their execution, monitor runs, schedule tasks, integrate them with other services, or even publish and monetize them. If you're new to Apify, learn more about the platform in the [Apify documentation](https://docs.apify.com/platform/about).
341
+
342
+ For more context, read the [Actor whitepaper](https://whitepaper.actor/).
341
343
 
342
344
  ## Features
343
345
 
@@ -440,7 +442,7 @@ The full SDK documentation lives at **[docs.apify.com/sdk/python](https://docs.a
440
442
  | [Overview](https://docs.apify.com/sdk/python/docs/overview) | What the SDK is, what Actors are, and how the pieces fit together. |
441
443
  | [Quick start](https://docs.apify.com/sdk/python/docs/quick-start) | Create, run, and deploy your first Python Actor. |
442
444
  | [Concepts](https://docs.apify.com/sdk/python/docs/concepts/actor-lifecycle) | Actor lifecycle, input, storages, events, proxy management, interacting with other Actors, webhooks, accessing the Apify API, logging, configuration, and pay-per-event. |
443
- | [Guides](https://docs.apify.com/sdk/python/docs/guides/beautifulsoup-httpx) | Integrations with BeautifulSoup, Parsel, Playwright, Selenium, Crawlee, Scrapy, Crawl4AI, and Browser Use, plus running a web server and using uv. |
445
+ | [Guides](https://docs.apify.com/sdk/python/docs/guides/beautifulsoup-httpx) | Integrations with BeautifulSoup, Parsel, Playwright, Selenium, Crawlee, Scrapy, Scrapling, Crawl4AI, and Browser Use, plus running a web server and using uv. |
444
446
  | [Upgrading](https://docs.apify.com/sdk/python/docs/upgrading/upgrading-to-v4) | Migrating between major versions. |
445
447
  | [API reference](https://docs.apify.com/sdk/python/reference) | Generated reference for every class and method. |
446
448
  | [Changelog](https://docs.apify.com/sdk/python/docs/changelog) | Release history and breaking changes. |
@@ -92,9 +92,11 @@ To create, run, and deploy your first Actor step by step, see the [Quick start g
92
92
 
93
93
  ## What are Actors?
94
94
 
95
- Actors are serverless cloud programs that can do almost anything a human can do in a web browser. They range from small tasks, such as filling in forms or unsubscribing from online services, all the way up to scraping and processing vast numbers of web pages.
95
+ Actors are serverless programs that can do almost anything. From simple scripts and web scrapers to complex automation workflows, AI agents, or even always-on services that expose HTTP endpoints.
96
96
 
97
- They run either locally or on the [Apify platform](https://docs.apify.com/platform/), where you can run them at scale, monitor them, schedule them, or publish and monetize them. If you're new to Apify, learn [what Apify is](https://docs.apify.com/platform/about) in the platform documentation.
97
+ They can run either locally or on the Apify platform, where you can scale their execution, monitor runs, schedule tasks, integrate them with other services, or even publish and monetize them. If you're new to Apify, learn more about the platform in the [Apify documentation](https://docs.apify.com/platform/about).
98
+
99
+ For more context, read the [Actor whitepaper](https://whitepaper.actor/).
98
100
 
99
101
  ## Features
100
102
 
@@ -197,7 +199,7 @@ The full SDK documentation lives at **[docs.apify.com/sdk/python](https://docs.a
197
199
  | [Overview](https://docs.apify.com/sdk/python/docs/overview) | What the SDK is, what Actors are, and how the pieces fit together. |
198
200
  | [Quick start](https://docs.apify.com/sdk/python/docs/quick-start) | Create, run, and deploy your first Python Actor. |
199
201
  | [Concepts](https://docs.apify.com/sdk/python/docs/concepts/actor-lifecycle) | Actor lifecycle, input, storages, events, proxy management, interacting with other Actors, webhooks, accessing the Apify API, logging, configuration, and pay-per-event. |
200
- | [Guides](https://docs.apify.com/sdk/python/docs/guides/beautifulsoup-httpx) | Integrations with BeautifulSoup, Parsel, Playwright, Selenium, Crawlee, Scrapy, Crawl4AI, and Browser Use, plus running a web server and using uv. |
202
+ | [Guides](https://docs.apify.com/sdk/python/docs/guides/beautifulsoup-httpx) | Integrations with BeautifulSoup, Parsel, Playwright, Selenium, Crawlee, Scrapy, Scrapling, Crawl4AI, and Browser Use, plus running a web server and using uv. |
201
203
  | [Upgrading](https://docs.apify.com/sdk/python/docs/upgrading/upgrading-to-v4) | Migrating between major versions. |
202
204
  | [API reference](https://docs.apify.com/sdk/python/reference) | Generated reference for every class and method. |
203
205
  | [Changelog](https://docs.apify.com/sdk/python/docs/changelog) | Release history and breaking changes. |
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "apify"
7
- version = "3.4.2b20"
7
+ version = "3.4.2b22"
8
8
  description = "Apify SDK for Python"
9
9
  authors = [{ name = "Apify Technologies s.r.o.", email = "support@apify.com" }]
10
10
  license = { file = "LICENSE" }
@@ -1164,7 +1164,7 @@ class _ActorType:
1164
1164
  self.log.error('Actor.metamorph() is only supported when running on the Apify platform.')
1165
1165
  return
1166
1166
 
1167
- if not custom_after_sleep:
1167
+ if custom_after_sleep is None:
1168
1168
  custom_after_sleep = self.configuration.metamorph_after_sleep
1169
1169
 
1170
1170
  # If is_at_home() is True, configuration.actor_run_id is always set
@@ -5,7 +5,7 @@ from datetime import datetime, timedelta
5
5
  from decimal import Decimal
6
6
  from logging import getLogger
7
7
  from pathlib import Path
8
- from typing import Annotated, Any, Self
8
+ from typing import TYPE_CHECKING, Annotated, Any, Self
9
9
 
10
10
  from pydantic import AliasChoices, BeforeValidator, Field, model_validator
11
11
  from typing_extensions import TypedDict
@@ -23,6 +23,9 @@ from apify._charging import (
23
23
  )
24
24
  from apify._utils import docs_group
25
25
 
26
+ if TYPE_CHECKING:
27
+ from collections.abc import Callable
28
+
26
29
  logger = getLogger(__name__)
27
30
 
28
31
 
@@ -34,6 +37,20 @@ def _transform_to_list(value: Any) -> list[str] | None:
34
37
  return value if isinstance(value, list) else str(value).split(',')
35
38
 
36
39
 
40
+ def _default_if_empty(*, default: Any) -> Callable[[Any], Any]:
41
+ """Build a validator that substitutes `default` for an empty-string env var.
42
+
43
+ The Apify platform sometimes sets an env var to an empty string instead of leaving it unset. For fields whose
44
+ target type cannot parse `''` (datetimes, numbers, booleans, ...), passing the value straight through would crash
45
+ validation and, in turn, `Actor.init()`. Treat `''` as "not provided" and fall back to the field default instead.
46
+ """
47
+
48
+ def transform(value: Any) -> Any:
49
+ return default if value == '' else value
50
+
51
+ return transform
52
+
53
+
37
54
  class ActorStorages(TypedDict):
38
55
  """Mapping of storage aliases to their IDs, grouped by storage type.
39
56
 
@@ -294,7 +311,7 @@ class Configuration(CrawleeConfiguration):
294
311
  alias='actor_max_paid_dataset_items',
295
312
  description='For paid-per-result Actors, the user-set limit on returned results. Do not exceed this limit',
296
313
  ),
297
- BeforeValidator(lambda val: val if val != '' else None),
314
+ BeforeValidator(_default_if_empty(default=None)),
298
315
  ] = None
299
316
 
300
317
  max_total_charge_usd: Annotated[
@@ -303,7 +320,7 @@ class Configuration(CrawleeConfiguration):
303
320
  alias='actor_max_total_charge_usd',
304
321
  description='For pay-per-event Actors, the user-set limit on total charges. Do not exceed this limit',
305
322
  ),
306
- BeforeValidator(lambda val: val if val != '' else None),
323
+ BeforeValidator(_default_if_empty(default=None)),
307
324
  ] = None
308
325
 
309
326
  test_pay_per_event: Annotated[
@@ -382,7 +399,7 @@ class Configuration(CrawleeConfiguration):
382
399
  ),
383
400
  description='Date when the Actor will time out',
384
401
  ),
385
- BeforeValidator(lambda val: val if val != '' else None), # We should accept empty environment variables as well
402
+ BeforeValidator(_default_if_empty(default=None)),
386
403
  ] = None
387
404
 
388
405
  standby_url: Annotated[
@@ -416,7 +433,7 @@ class Configuration(CrawleeConfiguration):
416
433
  alias='apify_user_is_paying',
417
434
  description='True if the user calling the Actor is paying user',
418
435
  ),
419
- BeforeValidator(lambda val: False if val == '' else val),
436
+ BeforeValidator(_default_if_empty(default=False)),
420
437
  ] = False
421
438
 
422
439
  web_server_port: Annotated[
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes