digitalhub-runtime-python 0.6.0b6__tar.gz → 0.6.0b7__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.
- {digitalhub_runtime_python-0.6.0b6 → digitalhub_runtime_python-0.6.0b7}/PKG-INFO +1 -1
- digitalhub_runtime_python-0.6.0b7/digitalhub_runtime_python/utils/nuclio_configuration.py +98 -0
- {digitalhub_runtime_python-0.6.0b6 → digitalhub_runtime_python-0.6.0b7}/digitalhub_runtime_python.egg-info/PKG-INFO +1 -1
- {digitalhub_runtime_python-0.6.0b6 → digitalhub_runtime_python-0.6.0b7}/digitalhub_runtime_python.egg-info/SOURCES.txt +1 -0
- {digitalhub_runtime_python-0.6.0b6 → digitalhub_runtime_python-0.6.0b7}/pyproject.toml +2 -2
- {digitalhub_runtime_python-0.6.0b6 → digitalhub_runtime_python-0.6.0b7}/LICENSE.txt +0 -0
- {digitalhub_runtime_python-0.6.0b6 → digitalhub_runtime_python-0.6.0b7}/README.md +0 -0
- {digitalhub_runtime_python-0.6.0b6 → digitalhub_runtime_python-0.6.0b7}/digitalhub_runtime_python/__init__.py +0 -0
- {digitalhub_runtime_python-0.6.0b6 → digitalhub_runtime_python-0.6.0b7}/digitalhub_runtime_python/entities/__init__.py +0 -0
- {digitalhub_runtime_python-0.6.0b6 → digitalhub_runtime_python-0.6.0b7}/digitalhub_runtime_python/entities/functions/__init__.py +0 -0
- {digitalhub_runtime_python-0.6.0b6 → digitalhub_runtime_python-0.6.0b7}/digitalhub_runtime_python/entities/functions/spec.py +0 -0
- {digitalhub_runtime_python-0.6.0b6 → digitalhub_runtime_python-0.6.0b7}/digitalhub_runtime_python/entities/functions/status.py +0 -0
- {digitalhub_runtime_python-0.6.0b6 → digitalhub_runtime_python-0.6.0b7}/digitalhub_runtime_python/entities/runs/__init__.py +0 -0
- {digitalhub_runtime_python-0.6.0b6 → digitalhub_runtime_python-0.6.0b7}/digitalhub_runtime_python/entities/runs/spec.py +0 -0
- {digitalhub_runtime_python-0.6.0b6 → digitalhub_runtime_python-0.6.0b7}/digitalhub_runtime_python/entities/runs/status.py +0 -0
- {digitalhub_runtime_python-0.6.0b6 → digitalhub_runtime_python-0.6.0b7}/digitalhub_runtime_python/entities/tasks/__init__.py +0 -0
- {digitalhub_runtime_python-0.6.0b6 → digitalhub_runtime_python-0.6.0b7}/digitalhub_runtime_python/entities/tasks/models.py +0 -0
- {digitalhub_runtime_python-0.6.0b6 → digitalhub_runtime_python-0.6.0b7}/digitalhub_runtime_python/entities/tasks/spec.py +0 -0
- {digitalhub_runtime_python-0.6.0b6 → digitalhub_runtime_python-0.6.0b7}/digitalhub_runtime_python/entities/tasks/status.py +0 -0
- {digitalhub_runtime_python-0.6.0b6 → digitalhub_runtime_python-0.6.0b7}/digitalhub_runtime_python/runtimes/__init__.py +0 -0
- {digitalhub_runtime_python-0.6.0b6 → digitalhub_runtime_python-0.6.0b7}/digitalhub_runtime_python/runtimes/kind_registry.py +0 -0
- {digitalhub_runtime_python-0.6.0b6 → digitalhub_runtime_python-0.6.0b7}/digitalhub_runtime_python/runtimes/runtime.py +0 -0
- {digitalhub_runtime_python-0.6.0b6 → digitalhub_runtime_python-0.6.0b7}/digitalhub_runtime_python/utils/configuration.py +0 -0
- {digitalhub_runtime_python-0.6.0b6 → digitalhub_runtime_python-0.6.0b7}/digitalhub_runtime_python/utils/env.py +0 -0
- {digitalhub_runtime_python-0.6.0b6 → digitalhub_runtime_python-0.6.0b7}/digitalhub_runtime_python/utils/inputs.py +0 -0
- {digitalhub_runtime_python-0.6.0b6 → digitalhub_runtime_python-0.6.0b7}/digitalhub_runtime_python/utils/outputs.py +0 -0
- {digitalhub_runtime_python-0.6.0b6 → digitalhub_runtime_python-0.6.0b7}/digitalhub_runtime_python/utils/utils.py +0 -0
- {digitalhub_runtime_python-0.6.0b6 → digitalhub_runtime_python-0.6.0b7}/digitalhub_runtime_python.egg-info/dependency_links.txt +0 -0
- {digitalhub_runtime_python-0.6.0b6 → digitalhub_runtime_python-0.6.0b7}/digitalhub_runtime_python.egg-info/requires.txt +0 -0
- {digitalhub_runtime_python-0.6.0b6 → digitalhub_runtime_python-0.6.0b7}/digitalhub_runtime_python.egg-info/top_level.txt +0 -0
- {digitalhub_runtime_python-0.6.0b6 → digitalhub_runtime_python-0.6.0b7}/setup.cfg +0 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Callable, Union
|
|
5
|
+
|
|
6
|
+
from digitalhub_core.utils.uri_utils import map_uri_scheme
|
|
7
|
+
from digitalhub_runtime_python.utils.configuration import import_function
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def parse_handler(handler: str) -> tuple[Path, str]:
|
|
11
|
+
"""
|
|
12
|
+
Parse handler.
|
|
13
|
+
|
|
14
|
+
Parameters
|
|
15
|
+
----------
|
|
16
|
+
handler : str
|
|
17
|
+
Function handler
|
|
18
|
+
|
|
19
|
+
Returns
|
|
20
|
+
-------
|
|
21
|
+
tuple[Path, str]
|
|
22
|
+
Function handler.
|
|
23
|
+
"""
|
|
24
|
+
parsed = handler.split(":")
|
|
25
|
+
if len(parsed) == 1:
|
|
26
|
+
return None, parsed[0]
|
|
27
|
+
return Path(*parsed[0].split(".")), parsed[1]
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def get_function_source(source_spec: dict) -> Path:
|
|
31
|
+
"""
|
|
32
|
+
Get function source.
|
|
33
|
+
|
|
34
|
+
Parameters
|
|
35
|
+
----------
|
|
36
|
+
source : dict
|
|
37
|
+
Function source.
|
|
38
|
+
|
|
39
|
+
Returns
|
|
40
|
+
-------
|
|
41
|
+
Path
|
|
42
|
+
Path to function source.
|
|
43
|
+
"""
|
|
44
|
+
path = Path("/shared")
|
|
45
|
+
|
|
46
|
+
# Get relevant information
|
|
47
|
+
base64 = source_spec.get("base64")
|
|
48
|
+
source = source_spec.get("source", "main.py")
|
|
49
|
+
handler = source_spec.get("handler")
|
|
50
|
+
|
|
51
|
+
handler_path, _ = parse_handler(handler)
|
|
52
|
+
|
|
53
|
+
# Get scheme in source
|
|
54
|
+
scheme = map_uri_scheme(source)
|
|
55
|
+
|
|
56
|
+
# Check base64. If it is set, it means
|
|
57
|
+
# that the source comes from a local file
|
|
58
|
+
if base64 is not None:
|
|
59
|
+
if scheme == "local":
|
|
60
|
+
if handler_path is not None:
|
|
61
|
+
return path / handler_path / Path(source)
|
|
62
|
+
return path / Path(source)
|
|
63
|
+
raise RuntimeError("Source is not a local file.")
|
|
64
|
+
|
|
65
|
+
if handler_path is not None:
|
|
66
|
+
return path / handler_path.with_suffix(".py")
|
|
67
|
+
raise RuntimeError("Must provide handler path in handler in form <root>.<dir>.<module>:<function_name>.")
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def import_function_and_init(source: dict) -> tuple[Callable, Union[Callable, None]]:
|
|
71
|
+
"""
|
|
72
|
+
Import function from source.
|
|
73
|
+
|
|
74
|
+
Parameters
|
|
75
|
+
----------
|
|
76
|
+
source : dict
|
|
77
|
+
Function source.
|
|
78
|
+
|
|
79
|
+
Returns
|
|
80
|
+
-------
|
|
81
|
+
tuple
|
|
82
|
+
Function and init function.
|
|
83
|
+
"""
|
|
84
|
+
|
|
85
|
+
# Get function source
|
|
86
|
+
function_path = get_function_source(source)
|
|
87
|
+
_, handler_name = parse_handler(source.get("handler"))
|
|
88
|
+
|
|
89
|
+
# Import function
|
|
90
|
+
fnc = import_function(function_path, handler_name)
|
|
91
|
+
|
|
92
|
+
# Get init function
|
|
93
|
+
init_handler = source.get("init_handler")
|
|
94
|
+
init_fnc = None
|
|
95
|
+
if init_handler is not None:
|
|
96
|
+
init_fnc = import_function(function_path, init_handler)
|
|
97
|
+
|
|
98
|
+
return fnc, init_fnc
|
|
@@ -24,5 +24,6 @@ digitalhub_runtime_python/runtimes/runtime.py
|
|
|
24
24
|
digitalhub_runtime_python/utils/configuration.py
|
|
25
25
|
digitalhub_runtime_python/utils/env.py
|
|
26
26
|
digitalhub_runtime_python/utils/inputs.py
|
|
27
|
+
digitalhub_runtime_python/utils/nuclio_configuration.py
|
|
27
28
|
digitalhub_runtime_python/utils/outputs.py
|
|
28
29
|
digitalhub_runtime_python/utils/utils.py
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "digitalhub-runtime-python"
|
|
7
|
-
version = "0.6.
|
|
7
|
+
version = "0.6.0b7"
|
|
8
8
|
description = "Python runtime for DHCore"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = [
|
|
@@ -39,7 +39,7 @@ line-length = 120
|
|
|
39
39
|
convention = "numpy"
|
|
40
40
|
|
|
41
41
|
[tool.bumpver]
|
|
42
|
-
current_version = "0.6.
|
|
42
|
+
current_version = "0.6.0b7"
|
|
43
43
|
version_pattern = "MAJOR.MINOR.PATCH[PYTAGNUM]"
|
|
44
44
|
commit_message = "Bump version {old_version} -> {new_version}"
|
|
45
45
|
commit = false
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|