Skip to content

refactor: Introduce new Apify storage client #470

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/03_concepts/code/03_dataset_exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ async def main() -> None:
await dataset.export_to(
content_type='csv',
key='data.csv',
to_key_value_store_name='my-cool-key-value-store',
to_kvs_name='my-cool-key-value-store',
)

# Export the data as JSON
await dataset.export_to(
content_type='json',
key='data.json',
to_key_value_store_name='my-cool-key-value-store',
to_kvs_name='my-cool-key-value-store',
)

# Print the exported records
Expand Down
3 changes: 1 addition & 2 deletions docs/03_concepts/code/conditional_actor_charge.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ async def main() -> None:
# Check the dataset because there might already be items
# if the run migrated or was restarted
default_dataset = await Actor.open_dataset()
dataset_info = await default_dataset.get_info()
charged_items = dataset_info.item_count if dataset_info else 0
charged_items = default_dataset.metadata.item_count

# highlight-start
if Actor.get_charging_manager().get_pricing_info().is_pay_per_event:
Expand Down
9 changes: 7 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ keywords = [
dependencies = [
"apify-client>=1.9.2",
"apify-shared>=1.3.0",
"crawlee~=0.6.0",
"cachetools>=5.5.0",
"crawlee@git+https://github.com/apify/crawlee-python.git@new-storage-clients",
"cryptography>=42.0.0",
"httpx>=0.27.0",
# TODO: ensure compatibility with the latest version of lazy-object-proxy
Expand Down Expand Up @@ -72,12 +73,16 @@ dev = [
"pytest~=8.4.0",
"respx~=0.22.0",
"ruff~=0.11.0",
"setuptools", # setuptools are used by pytest but not explicitly required
"setuptools", # setuptools are used by pytest but not explicitly required
"types-cachetools>=6.0.0.20250525",
]

[tool.hatch.build.targets.wheel]
packages = ["src/apify"]

[tool.hatch.metadata]
allow-direct-references = true

[tool.ruff]
line-length = 120
include = ["src/**/*.py", "tests/**/*.py", "docs/**/*.py", "website/**/*.py"]
Expand Down
2 changes: 1 addition & 1 deletion src/apify/_actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def __init__(

# Create an instance of the cloud storage client, the local storage client is obtained
# from the service locator.
self._cloud_storage_client = ApifyStorageClient.from_config(config=self._configuration)
self._cloud_storage_client = ApifyStorageClient()

# Set the event manager based on whether the Actor is running on the platform or locally.
self._event_manager = (
Expand Down
12 changes: 10 additions & 2 deletions src/apify/apify_storage_client/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
from apify.apify_storage_client._apify_storage_client import ApifyStorageClient
from ._dataset_client import ApifyDatasetClient
from ._key_value_store_client import ApifyKeyValueStoreClient
from ._request_queue_client import ApifyRequestQueueClient
from ._storage_client import ApifyStorageClient

__all__ = ['ApifyStorageClient']
__all__ = [
'ApifyDatasetClient',
'ApifyKeyValueStoreClient',
'ApifyRequestQueueClient',
'ApifyStorageClient',
]
72 changes: 0 additions & 72 deletions src/apify/apify_storage_client/_apify_storage_client.py

This file was deleted.

Loading
Loading