Skip to content
Merged
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
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ filename =
./scripts/*.py,
./src/*.py,
./tests/*.py
# Todo: remove "src/apify/consts.py: F401" once consts from apify-shared are not being reexported
per-file-ignores =
docs/*: D
scripts/*: D
tests/*: D
src/apify/consts.py: F401

# Google docstring convention + D204 & D401
docstring-convention = all
Expand Down
2 changes: 1 addition & 1 deletion .isort.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ line_length = 150
use_parentheses = True
multi_line_output = 3
sections = FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
known_first_party = apify,apify_client, apify_shared
known_first_party = apify,apify_client,apify_shared
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Changelog
=========

[1.1.2](../../releases/tag/v1.1.2) - 2023-08-01
-----------------------------------------------

### Internal changes

- Import general constants and utilities from [apify-shared](https://github.com/apify/apify-shared-python/) library

[1.1.1](../../releases/tag/v1.1.1) - 2023-05-23
-----------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "apify"
version = "1.1.1"
version = "1.1.2"
description = "Apify SDK for Python"
readme = "README.md"
license = {text = "Apache Software License"}
Expand Down
39 changes: 39 additions & 0 deletions src/apify/consts.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,44 @@
import re
import warnings
from enum import Enum
from typing import Any

from apify_shared.consts import BOOL_ENV_VARS as _BOOL_ENV_VARS
from apify_shared.consts import DATETIME_ENV_VARS as _DATETIME_ENV_VARS
from apify_shared.consts import FLOAT_ENV_VARS as _FLOAT_ENV_VARS
from apify_shared.consts import INTEGER_ENV_VARS as _INTEGER_ENV_VARS
from apify_shared.consts import STRING_ENV_VARS as _STRING_ENV_VARS
from apify_shared.consts import ActorEventTypes as _ActorEventTypes
from apify_shared.consts import ActorExitCodes as _ActorExitCodes
from apify_shared.consts import ApifyEnvVars as _ApifyEnvVars

DEPRECATED_NAMES = [
'BOOL_ENV_VARS',
'DATETIME_ENV_VARS',
'FLOAT_ENV_VARS',
'INTEGER_ENV_VARS',
'STRING_ENV_VARS',
'ActorEventTypes',
'ActorExitCodes',
'ApifyEnvVars',
]


# The following piece of code is highly inspired by the example in https://peps.python.org/pep-0562.
# The else branch is missing intentionally! Check the following discussion for details:
# https://github.com/apify/apify-client-python/pull/132#discussion_r1277294315.
def __getattr__(name: str) -> Any:
if name in DEPRECATED_NAMES:
warnings.warn(
(
f'Importing "{name}" from "apify_client.consts" is deprecated and will be removed in the future. '
'Please use "apify_shared" library instead.'
),
category=DeprecationWarning,
stacklevel=2,
)
return globals()[f'_{name}']
raise AttributeError(f'module {__name__!r} has no attribute {name!r}')


class _StorageTypes(str, Enum):
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_actor_api_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ class TestActorAbort:
async def test_actor_abort(self, make_actor: ActorFactory) -> None:
async def main_inner() -> None:
async with Actor:
await asyncio.sleep(60)
await asyncio.sleep(120)
# This should not be set, the actor should be aborted by now
await Actor.set_value('OUTPUT', 'dummy')

Expand Down