From 8e869467e4f7d3e471480c5a1914433b0e134a2a Mon Sep 17 00:00:00 2001 From: Jan Buchar Date: Wed, 28 Aug 2024 14:51:32 +0200 Subject: [PATCH 1/2] Add v2.0 upgrading guide --- docs/04-upgrading/upgrading_to_v20.md | 36 +++++++++++++++++++++++++++ pyproject.toml | 1 + website/sidebars.js | 11 ++++++++ 3 files changed, 48 insertions(+) create mode 100644 docs/04-upgrading/upgrading_to_v20.md diff --git a/docs/04-upgrading/upgrading_to_v20.md b/docs/04-upgrading/upgrading_to_v20.md new file mode 100644 index 00000000..35f10ada --- /dev/null +++ b/docs/04-upgrading/upgrading_to_v20.md @@ -0,0 +1,36 @@ +--- +id: upgrading-to-v20 +title: Upgrading to v2.0 +--- + +This page summarizes most of the breaking changes between Apify Python SDK v1.x and v2.0. + +# Storages + +The SDK now uses [crawlee](https://github.com/apify/crawlee-python) for local storage emulation. This change should not affect intended usage (working with `Dataset`, `KeyValueStore` and `RequestQueue` classes from the `apify.storages` module or using the shortcuts exposed by the `Actor` class) in any way. + +Removing the `StorageClientManager` class is a significant change. If you need to change the storage client, use `crawlee.service_container` instead. + +# Configuration + +The `apify.Configuration` class now uses `pydantic_settings` to load configuration from environment variables. This eliminates the need for the helper functions which handled environment variables in `apify._utils`. + +Attributes suffixed with `_millis` were renamed to remove said suffix and have the `datetime.timedelta` type now. + +# Actor + +The `Actor.main` method has been removed as it brings no benefits compared to using `async with Actor`. + +# Scrapy integration + +The `apify.scrapy.utils.open_queue_with_custom_client` function is not necessary anymore and has been removed. + +# Subpackage visibility + +The following modules were made private: + +- `apify.proxy_configuration` (`ProxyConfiguration` is still exported from `apify`) +- `apify.config` (`Configuration` is still exported from `apify`) +- `apify.actor` (`Actor` is still exported from `apify`) +- `apify.event_manager` +- `apify.consts` diff --git a/pyproject.toml b/pyproject.toml index 7df2985a..5b4334be 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -81,6 +81,7 @@ twine = "^5.1.0" types-aiofiles = "^24.1.0.20240626" types-colorama = "^0.4.15.20240311" types-psutil = "^6.0.0.20240621" +griffe = "^1.2.0" [tool.poetry.extras] scrapy = ["scrapy"] diff --git a/website/sidebars.js b/website/sidebars.js index 11c2ab19..06c17b57 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -33,6 +33,17 @@ module.exports = { }, ], }, + { + type: 'category', + label: 'Upgrading', + collapsed: false, + items: [ + { + type: 'autogenerated', + dirName: '04-upgrading', + }, + ], + }, { type: 'doc', id: 'changelog', From 3b9f29469cca705faa0f1946e9eabe6504cf2d70 Mon Sep 17 00:00:00 2001 From: Jan Buchar Date: Wed, 28 Aug 2024 15:07:15 +0200 Subject: [PATCH 2/2] Use second-level headings --- docs/04-upgrading/upgrading_to_v20.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/04-upgrading/upgrading_to_v20.md b/docs/04-upgrading/upgrading_to_v20.md index 35f10ada..43c18b1a 100644 --- a/docs/04-upgrading/upgrading_to_v20.md +++ b/docs/04-upgrading/upgrading_to_v20.md @@ -5,27 +5,27 @@ title: Upgrading to v2.0 This page summarizes most of the breaking changes between Apify Python SDK v1.x and v2.0. -# Storages +## Storages The SDK now uses [crawlee](https://github.com/apify/crawlee-python) for local storage emulation. This change should not affect intended usage (working with `Dataset`, `KeyValueStore` and `RequestQueue` classes from the `apify.storages` module or using the shortcuts exposed by the `Actor` class) in any way. Removing the `StorageClientManager` class is a significant change. If you need to change the storage client, use `crawlee.service_container` instead. -# Configuration +## Configuration The `apify.Configuration` class now uses `pydantic_settings` to load configuration from environment variables. This eliminates the need for the helper functions which handled environment variables in `apify._utils`. Attributes suffixed with `_millis` were renamed to remove said suffix and have the `datetime.timedelta` type now. -# Actor +## Actor The `Actor.main` method has been removed as it brings no benefits compared to using `async with Actor`. -# Scrapy integration +## Scrapy integration The `apify.scrapy.utils.open_queue_with_custom_client` function is not necessary anymore and has been removed. -# Subpackage visibility +## Subpackage visibility The following modules were made private: