intuned-runtime 1.2.1__py3-none-any.whl → 1.2.2__py3-none-any.whl

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 (44) hide show
  1. intuned_cli/__init__.py +12 -2
  2. intuned_cli/commands/__init__.py +1 -0
  3. intuned_cli/commands/attempt_api_command.py +1 -1
  4. intuned_cli/commands/attempt_authsession_check_command.py +1 -1
  5. intuned_cli/commands/attempt_authsession_create_command.py +1 -1
  6. intuned_cli/commands/deploy_command.py +4 -4
  7. intuned_cli/commands/run_api_command.py +1 -1
  8. intuned_cli/commands/run_authsession_create_command.py +1 -1
  9. intuned_cli/commands/run_authsession_update_command.py +1 -1
  10. intuned_cli/commands/run_authsession_validate_command.py +1 -1
  11. intuned_cli/commands/save_command.py +47 -0
  12. intuned_cli/controller/__test__/test_api.py +0 -1
  13. intuned_cli/controller/api.py +0 -1
  14. intuned_cli/controller/authsession.py +0 -1
  15. intuned_cli/controller/deploy.py +8 -210
  16. intuned_cli/controller/save.py +260 -0
  17. intuned_cli/utils/backend.py +26 -0
  18. intuned_cli/utils/error.py +7 -3
  19. intuned_internal_cli/commands/project/auth_session/check.py +0 -1
  20. intuned_internal_cli/commands/project/run.py +0 -2
  21. intuned_runtime/__init__.py +2 -1
  22. {intuned_runtime-1.2.1.dist-info → intuned_runtime-1.2.2.dist-info}/METADATA +4 -2
  23. {intuned_runtime-1.2.1.dist-info → intuned_runtime-1.2.2.dist-info}/RECORD +43 -36
  24. {intuned_runtime-1.2.1.dist-info → intuned_runtime-1.2.2.dist-info}/WHEEL +1 -1
  25. runtime/backend_functions/_call_backend_function.py +18 -2
  26. runtime/browser/helpers.py +22 -0
  27. runtime/browser/launch_browser.py +43 -15
  28. runtime/browser/launch_chromium.py +26 -22
  29. runtime/constants.py +1 -0
  30. runtime/context/context.py +1 -0
  31. runtime/env.py +15 -1
  32. runtime/errors/run_api_errors.py +8 -0
  33. runtime/helpers/__init__.py +2 -1
  34. runtime/helpers/attempt_store.py +14 -0
  35. runtime/run/playwright_context.py +147 -0
  36. runtime/run/playwright_tracing.py +27 -0
  37. runtime/run/run_api.py +71 -91
  38. runtime/run/setup_context_hook.py +40 -0
  39. runtime/run/types.py +14 -0
  40. runtime/types/run_types.py +0 -1
  41. runtime_helpers/__init__.py +2 -1
  42. runtime/run/playwright_constructs.py +0 -20
  43. {intuned_runtime-1.2.1.dist-info → intuned_runtime-1.2.2.dist-info}/entry_points.txt +0 -0
  44. {intuned_runtime-1.2.1.dist-info → intuned_runtime-1.2.2.dist-info/licenses}/LICENSE +0 -0
@@ -0,0 +1,40 @@
1
+ from collections.abc import Callable
2
+ from typing import Any
3
+ from typing import Awaitable
4
+ from typing import cast
5
+ from typing import Protocol
6
+ from typing import TYPE_CHECKING
7
+ from typing import Union
8
+
9
+ from runtime.errors.run_api_errors import ApiNotFoundError
10
+
11
+ from .types import ImportFunction
12
+
13
+ if TYPE_CHECKING:
14
+ from playwright.async_api import BrowserContext
15
+ from playwright.async_api import Page
16
+
17
+
18
+ setup_context_hook_path = "hooks/setup_context"
19
+ setup_context_hook_function_name = "setup_context"
20
+
21
+ SetupContextHookReturn = Union[
22
+ "None",
23
+ "BrowserContext",
24
+ "tuple[BrowserContext, Page | None]",
25
+ "tuple[BrowserContext, Page | None, Callable[..., Awaitable[None]]]",
26
+ ]
27
+
28
+
29
+ class SetupContextHook(Protocol):
30
+ def __call__(self, *, cdp_url: str, api_name: str, api_parameters: Any) -> Awaitable[SetupContextHookReturn]: ...
31
+
32
+
33
+ def load_setup_context_hook(*, import_function: ImportFunction):
34
+ try:
35
+ setup_context_hook = cast(
36
+ SetupContextHook, import_function(setup_context_hook_path, setup_context_hook_function_name)
37
+ )
38
+ return setup_context_hook
39
+ except ApiNotFoundError:
40
+ return None
runtime/run/types.py ADDED
@@ -0,0 +1,14 @@
1
+ from collections.abc import Callable
2
+ from typing import Any
3
+ from typing import Awaitable
4
+ from typing import Optional
5
+ from typing import Protocol
6
+
7
+ from git import TYPE_CHECKING
8
+
9
+ if TYPE_CHECKING:
10
+ pass
11
+
12
+
13
+ class ImportFunction(Protocol):
14
+ def __call__(self, file_path: str, name: Optional[str] = None, /) -> Callable[..., Awaitable[Any]]: ...
@@ -126,7 +126,6 @@ class TracingDisabled(CamelBaseModel):
126
126
 
127
127
  class Auth(CamelBaseModel):
128
128
  session: RunApiSession
129
- run_check: bool = False
130
129
 
131
130
 
132
131
  class IntunedRunContext(CamelBaseModel):
@@ -1,5 +1,6 @@
1
1
  from runtime.helpers import extend_payload
2
2
  from runtime.helpers import extend_timeout
3
+ from runtime.helpers.attempt_store import attempt_store
3
4
  from runtime.helpers.get_auth_session_parameters import get_auth_session_parameters
4
5
 
5
- __all__ = ["extend_payload", "extend_timeout", "get_auth_session_parameters"]
6
+ __all__ = ["extend_payload", "extend_timeout", "get_auth_session_parameters", "attempt_store"]
@@ -1,20 +0,0 @@
1
- from contextlib import asynccontextmanager
2
- from typing import TYPE_CHECKING
3
-
4
- if TYPE_CHECKING:
5
- from playwright.async_api import ProxySettings
6
- from ..browser import launch_browser
7
-
8
-
9
- @asynccontextmanager
10
- async def get_production_playwright_constructs(
11
- proxy: "ProxySettings | None" = None,
12
- headless: bool = False,
13
- *,
14
- cdp_address: str | None = None,
15
- ):
16
- async with launch_browser(headless=headless, cdp_address=cdp_address, proxy=proxy) as (context, page):
17
- try:
18
- yield context, page
19
- finally:
20
- await context.close()