cmem-client 0.5.0__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.
- cmem_client/__init__.py +13 -0
- cmem_client/auth_provider/__init__.py +14 -0
- cmem_client/auth_provider/abc.py +124 -0
- cmem_client/auth_provider/client_credentials.py +207 -0
- cmem_client/auth_provider/password.py +252 -0
- cmem_client/auth_provider/prefetched_token.py +153 -0
- cmem_client/client.py +485 -0
- cmem_client/components/__init__.py +10 -0
- cmem_client/components/graph_store.py +316 -0
- cmem_client/components/marketplace.py +179 -0
- cmem_client/components/sparql_wrapper.py +53 -0
- cmem_client/components/workspace.py +194 -0
- cmem_client/config.py +364 -0
- cmem_client/exceptions.py +82 -0
- cmem_client/logging_utils.py +49 -0
- cmem_client/models/__init__.py +16 -0
- cmem_client/models/access_condition.py +147 -0
- cmem_client/models/base.py +30 -0
- cmem_client/models/dataset.py +32 -0
- cmem_client/models/error.py +67 -0
- cmem_client/models/graph.py +26 -0
- cmem_client/models/item.py +143 -0
- cmem_client/models/logging_config.py +51 -0
- cmem_client/models/package.py +35 -0
- cmem_client/models/project.py +46 -0
- cmem_client/models/python_package.py +26 -0
- cmem_client/models/token.py +40 -0
- cmem_client/models/url.py +34 -0
- cmem_client/models/workflow.py +80 -0
- cmem_client/repositories/__init__.py +15 -0
- cmem_client/repositories/access_conditions.py +62 -0
- cmem_client/repositories/base/__init__.py +12 -0
- cmem_client/repositories/base/abc.py +138 -0
- cmem_client/repositories/base/paged_list.py +63 -0
- cmem_client/repositories/base/plain_list.py +39 -0
- cmem_client/repositories/base/task_search.py +70 -0
- cmem_client/repositories/datasets.py +36 -0
- cmem_client/repositories/graph_imports.py +93 -0
- cmem_client/repositories/graphs.py +458 -0
- cmem_client/repositories/marketplace_packages.py +486 -0
- cmem_client/repositories/projects.py +214 -0
- cmem_client/repositories/protocols/__init__.py +15 -0
- cmem_client/repositories/protocols/create_item.py +125 -0
- cmem_client/repositories/protocols/delete_item.py +95 -0
- cmem_client/repositories/protocols/export_item.py +114 -0
- cmem_client/repositories/protocols/import_item.py +141 -0
- cmem_client/repositories/python_packages.py +58 -0
- cmem_client/repositories/workflows.py +143 -0
- cmem_client-0.5.0.dist-info/METADATA +64 -0
- cmem_client-0.5.0.dist-info/RECORD +52 -0
- cmem_client-0.5.0.dist-info/WHEEL +4 -0
- cmem_client-0.5.0.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"""Protocol interface for repository item import operations.
|
|
2
|
+
|
|
3
|
+
This module defines the ImportItemProtocol that repositories can implement
|
|
4
|
+
to support importing items from files. This is commonly used for importing
|
|
5
|
+
exported projects, graphs, or other resources into Corporate Memory.
|
|
6
|
+
|
|
7
|
+
The protocol supports both replacement of existing items and creation of new
|
|
8
|
+
items, with validation to ensure the import operation completes successfully
|
|
9
|
+
and the item is available in the repository after import.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
import logging
|
|
15
|
+
from abc import ABC, abstractmethod
|
|
16
|
+
from typing import TYPE_CHECKING, ClassVar, Protocol, TypeVar, runtime_checkable
|
|
17
|
+
|
|
18
|
+
from httpx import HTTPError
|
|
19
|
+
|
|
20
|
+
from cmem_client.exceptions import RepositoryModificationError
|
|
21
|
+
from cmem_client.logging_utils import log_method
|
|
22
|
+
from cmem_client.models.base import Model
|
|
23
|
+
from cmem_client.models.item import FileImportItem, ImportItem, ZipImportItem, create_import_item
|
|
24
|
+
from cmem_client.repositories.base.abc import ItemType
|
|
25
|
+
|
|
26
|
+
if TYPE_CHECKING:
|
|
27
|
+
from collections.abc import Sequence
|
|
28
|
+
from pathlib import Path
|
|
29
|
+
|
|
30
|
+
from cmem_client.client import Client
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class ImportConfig(Model, ABC):
|
|
34
|
+
"""Abstract base class for Import Item Configuration Objects
|
|
35
|
+
|
|
36
|
+
Attributes:
|
|
37
|
+
use_archive_handler: When True, automatically uses ArchiveHandler to handle
|
|
38
|
+
zip files, directories, and single files transparently. Defaults to True.
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
use_archive_handler: bool = True
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
ImportItemConfig_contra = TypeVar("ImportItemConfig_contra", bound=ImportConfig, contravariant=True)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
@runtime_checkable
|
|
48
|
+
class ImportItemProtocol(Protocol[ItemType, ImportItemConfig_contra]):
|
|
49
|
+
"""Protocol which allows for importing of items from a file path.
|
|
50
|
+
|
|
51
|
+
Repositories can optionally declare which ImportItem types they accept by setting:
|
|
52
|
+
_allowed_import_items: ClassVar[Sequence[type[ImportItem]] | None]
|
|
53
|
+
|
|
54
|
+
Example:
|
|
55
|
+
_allowed_import_items: ClassVar[Sequence[type[ImportItem]]] = [FileImportItem, ZipImportItem]
|
|
56
|
+
|
|
57
|
+
If not defined, defaults to [FileImportItem, ZipImportItem] (excludes DirectoryImportItem).
|
|
58
|
+
|
|
59
|
+
Repositories can optionally declare default import configuration by setting:
|
|
60
|
+
_default_import_config: ImportConfig | None = None
|
|
61
|
+
|
|
62
|
+
Example:
|
|
63
|
+
_default_import_config: ImportConfig | None = ProjectsImportConfig()
|
|
64
|
+
|
|
65
|
+
This is needed for example if the use_archive_handler needs to be turned off.
|
|
66
|
+
If not defined, defaults to None.
|
|
67
|
+
"""
|
|
68
|
+
|
|
69
|
+
_client: Client
|
|
70
|
+
_dict: dict[str, ItemType]
|
|
71
|
+
_allowed_import_items: ClassVar[Sequence[type[ImportItem]]]
|
|
72
|
+
_default_import_config: ImportConfig | None = None
|
|
73
|
+
_logger: logging.Logger
|
|
74
|
+
|
|
75
|
+
@property
|
|
76
|
+
def logger(self) -> logging.Logger:
|
|
77
|
+
"""Gets the client logger"""
|
|
78
|
+
if not hasattr(self, "_logger"):
|
|
79
|
+
self._logger = logging.getLogger(f"{self._client.logger.name}.{self.__class__.__name__}")
|
|
80
|
+
return self._logger
|
|
81
|
+
|
|
82
|
+
@log_method
|
|
83
|
+
def import_item(
|
|
84
|
+
self,
|
|
85
|
+
path: Path | None = None,
|
|
86
|
+
replace: bool = False,
|
|
87
|
+
key: str | None = None,
|
|
88
|
+
configuration: ImportItemConfig_contra | None = None,
|
|
89
|
+
skip_if_existing: bool = False,
|
|
90
|
+
) -> str:
|
|
91
|
+
"""Import an exported file to the repository
|
|
92
|
+
|
|
93
|
+
By default, automatically handles zip files, directories, and single files
|
|
94
|
+
using ImportItem model. Can be disabled by setting use_archive_handler=False
|
|
95
|
+
in the configuration.
|
|
96
|
+
"""
|
|
97
|
+
if key and key in self._dict and not replace:
|
|
98
|
+
if not skip_if_existing:
|
|
99
|
+
raise RepositoryModificationError(f"Repository item '{key}' already exists.")
|
|
100
|
+
self.logger.info("Item '%s' already exists. Not importing new item.", key)
|
|
101
|
+
return key
|
|
102
|
+
try:
|
|
103
|
+
if configuration is None:
|
|
104
|
+
configuration = getattr(self, "_default_import_config", None)
|
|
105
|
+
use_handler = configuration.use_archive_handler if configuration else True
|
|
106
|
+
if use_handler and path:
|
|
107
|
+
import_item = create_import_item(path)
|
|
108
|
+
allowed_items = getattr(self, "_allowed_import_items", [FileImportItem, ZipImportItem])
|
|
109
|
+
if allowed_items is not None and not isinstance(import_item, tuple(allowed_items)):
|
|
110
|
+
raise RepositoryModificationError(f"Import type '{type(import_item).__name__}' is not allowed.")
|
|
111
|
+
with import_item as prepared_path:
|
|
112
|
+
new_key = self._import_item(
|
|
113
|
+
path=prepared_path, key=key, replace=replace, configuration=configuration
|
|
114
|
+
)
|
|
115
|
+
else:
|
|
116
|
+
new_key = self._import_item(path=path, key=key, replace=replace, configuration=configuration)
|
|
117
|
+
except HTTPError as error:
|
|
118
|
+
raise RepositoryModificationError(f"Error on importing path '{path}'.") from error
|
|
119
|
+
if key and key != new_key:
|
|
120
|
+
raise RepositoryModificationError(
|
|
121
|
+
f"Repository import returned different item key than requested: '{key}' != `{new_key}`"
|
|
122
|
+
)
|
|
123
|
+
if key and key not in self._dict:
|
|
124
|
+
raise RepositoryModificationError(f"Repository item '{key}' not there after import.")
|
|
125
|
+
if key:
|
|
126
|
+
return key
|
|
127
|
+
return new_key
|
|
128
|
+
|
|
129
|
+
@abstractmethod
|
|
130
|
+
def _import_item(
|
|
131
|
+
self,
|
|
132
|
+
path: Path | None = None,
|
|
133
|
+
replace: bool = False,
|
|
134
|
+
key: str | None = None,
|
|
135
|
+
configuration: ImportItemConfig_contra | None = None,
|
|
136
|
+
) -> str:
|
|
137
|
+
"""Import an item to the repository (concrete implementation)
|
|
138
|
+
|
|
139
|
+
This method is responsible for importing the item to the server.
|
|
140
|
+
It needs to return the key of the imported item.
|
|
141
|
+
"""
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"""Repository for managing Python packages"""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import TYPE_CHECKING
|
|
6
|
+
|
|
7
|
+
from pydantic import TypeAdapter
|
|
8
|
+
|
|
9
|
+
from cmem_client.models.python_package import PythonPackage
|
|
10
|
+
from cmem_client.repositories.base.abc import RepositoryConfig
|
|
11
|
+
from cmem_client.repositories.base.plain_list import PlainListRepository
|
|
12
|
+
from cmem_client.repositories.protocols.create_item import CreateConfig, CreateItemProtocol
|
|
13
|
+
from cmem_client.repositories.protocols.delete_item import DeleteConfig, DeleteItemProtocol
|
|
14
|
+
|
|
15
|
+
if TYPE_CHECKING:
|
|
16
|
+
from httpx import Response
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class PythonPackagesCreateConfig(CreateConfig):
|
|
20
|
+
"""Python packages create config"""
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class PythonPackagesDeleteConfig(DeleteConfig):
|
|
24
|
+
"""Python packages deletion configuration."""
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class PythonPackagesRepository(PlainListRepository, DeleteItemProtocol, CreateItemProtocol):
|
|
28
|
+
"""Repository for python packages"""
|
|
29
|
+
|
|
30
|
+
_dict: dict[str, PythonPackage]
|
|
31
|
+
_config = RepositoryConfig(
|
|
32
|
+
component="build",
|
|
33
|
+
fetch_data_path="/api/python/listPackages",
|
|
34
|
+
fetch_data_adapter=TypeAdapter(list[PythonPackage]),
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
def _create_item(self, item: PythonPackage, configuration: PythonPackagesCreateConfig | None = None) -> Response:
|
|
38
|
+
"""Install a Python package."""
|
|
39
|
+
_ = configuration
|
|
40
|
+
url = self._url("/api/python/installPackageByName")
|
|
41
|
+
return self._client.http.post(url, params={"name": item.name})
|
|
42
|
+
|
|
43
|
+
def _delete_item(self, key: str, configuration: PythonPackagesDeleteConfig | None = None) -> None:
|
|
44
|
+
"""Delete item from repository."""
|
|
45
|
+
_ = configuration
|
|
46
|
+
url = self._url("/api/python/uninstallPackage")
|
|
47
|
+
response = self._client.http.post(url, params={"name": key})
|
|
48
|
+
response.raise_for_status()
|
|
49
|
+
|
|
50
|
+
def delete_all(self) -> None:
|
|
51
|
+
"""Delete all items from the repository
|
|
52
|
+
|
|
53
|
+
This overwrites the default protocol method and utilizes an internal behaviour of the server
|
|
54
|
+
to wipe the whole python environment.
|
|
55
|
+
"""
|
|
56
|
+
self._delete_item("--all")
|
|
57
|
+
if hasattr(self, "fetch_data"):
|
|
58
|
+
self.fetch_data()
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"""Workflow repository"""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import time
|
|
6
|
+
from typing import TYPE_CHECKING
|
|
7
|
+
|
|
8
|
+
from httpx import HTTPError
|
|
9
|
+
from pydantic import TypeAdapter
|
|
10
|
+
|
|
11
|
+
from cmem_client.exceptions import WorkflowExecutionError, WorkflowReadError
|
|
12
|
+
|
|
13
|
+
if TYPE_CHECKING:
|
|
14
|
+
from cmem_client.client import Client
|
|
15
|
+
|
|
16
|
+
from cmem_client.models.workflow import ACTIVITY_NAME, Workflow, WorkflowStatus
|
|
17
|
+
from cmem_client.repositories.base.abc import RepositoryConfig
|
|
18
|
+
from cmem_client.repositories.base.plain_list import PlainListRepository
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class WorkflowsRepository(PlainListRepository):
|
|
22
|
+
"""Repository for managing workflows.
|
|
23
|
+
|
|
24
|
+
This repository manages workflows in Corporate Memory.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
_dict: dict[str, Workflow]
|
|
28
|
+
_client: Client
|
|
29
|
+
_config = RepositoryConfig(
|
|
30
|
+
component="build",
|
|
31
|
+
fetch_data_path="api/workflow/info",
|
|
32
|
+
fetch_data_adapter=TypeAdapter(list[Workflow]),
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
def __getitem__(self, key: str) -> Workflow:
|
|
36
|
+
"""Get workflow by ID and inject client"""
|
|
37
|
+
workflow: Workflow = super().__getitem__(key)
|
|
38
|
+
workflow.set_client(self._client)
|
|
39
|
+
return workflow
|
|
40
|
+
|
|
41
|
+
def execute(self, workflow_id: str, activity_name: ACTIVITY_NAME = "ExecuteDefaultWorkflow") -> None:
|
|
42
|
+
"""Execute the workflow
|
|
43
|
+
|
|
44
|
+
Executing the workflow with this command does not wait for the workflow to be finished.
|
|
45
|
+
|
|
46
|
+
Args:
|
|
47
|
+
workflow_id: The workflow to execute (in the form of 'project_id:workflow_id')
|
|
48
|
+
activity_name: Name of the activity
|
|
49
|
+
|
|
50
|
+
Raises:
|
|
51
|
+
BaseError: Raised if the workflow execution failed.
|
|
52
|
+
WorkflowExecutionError: Raised if the workflow execution failed.
|
|
53
|
+
"""
|
|
54
|
+
project_id, workflow_name = workflow_id.split(":")
|
|
55
|
+
url = (
|
|
56
|
+
self._client.config.url_build_api
|
|
57
|
+
/ "workspace/projects"
|
|
58
|
+
/ project_id
|
|
59
|
+
/ "tasks"
|
|
60
|
+
/ workflow_name
|
|
61
|
+
/ "activities"
|
|
62
|
+
/ activity_name
|
|
63
|
+
/ "start"
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
try:
|
|
67
|
+
response = self._client.http.post(url)
|
|
68
|
+
response.raise_for_status()
|
|
69
|
+
except HTTPError as e:
|
|
70
|
+
raise WorkflowExecutionError(f"Workflow '{workflow_id}' could not be executed.") from e
|
|
71
|
+
|
|
72
|
+
def execute_wait_for_completion(
|
|
73
|
+
self, workflow_id: str, activity_name: ACTIVITY_NAME = "ExecuteDefaultWorkflow", sleep_time: int = 1
|
|
74
|
+
) -> None:
|
|
75
|
+
"""Execute the workflow waiting for completion
|
|
76
|
+
|
|
77
|
+
Executing the workflow with this command does wait for the workflow to be finished.
|
|
78
|
+
|
|
79
|
+
Args:
|
|
80
|
+
workflow_id: The workflow to execute (in the form of 'project_id:workflow_id')
|
|
81
|
+
activity_name: Activity name. Defaults to "ExecuteDefaultWorkflow".
|
|
82
|
+
sleep_time: Sleep time in seconds for fetching status of the running workflow. Defaults to 1.
|
|
83
|
+
|
|
84
|
+
Raises:
|
|
85
|
+
BaseError: If the client is not set.
|
|
86
|
+
WorkflowExecutionError: If workflow execution failed.
|
|
87
|
+
"""
|
|
88
|
+
project_id, workflow_name = workflow_id.split(":")
|
|
89
|
+
url = (
|
|
90
|
+
self._client.config.url_build_api
|
|
91
|
+
/ "workspace/projects"
|
|
92
|
+
/ project_id
|
|
93
|
+
/ "tasks"
|
|
94
|
+
/ workflow_name
|
|
95
|
+
/ "activities"
|
|
96
|
+
/ activity_name
|
|
97
|
+
/ "start"
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
try:
|
|
101
|
+
self._client.http.post(url)
|
|
102
|
+
except HTTPError as e:
|
|
103
|
+
raise WorkflowExecutionError(f"Workflow '{workflow_id}' could not be executed.") from e
|
|
104
|
+
|
|
105
|
+
while True:
|
|
106
|
+
status = self.get_status(workflow_id)
|
|
107
|
+
if not status.is_running:
|
|
108
|
+
break
|
|
109
|
+
time.sleep(sleep_time)
|
|
110
|
+
|
|
111
|
+
def get_status(self, workflow_id: str, activity_name: ACTIVITY_NAME = "ExecuteDefaultWorkflow") -> WorkflowStatus:
|
|
112
|
+
"""Get the status of the workflow execution.
|
|
113
|
+
|
|
114
|
+
Args:
|
|
115
|
+
workflow_id: The workflow to get the status from (in the form of 'project_id:workflow_id')
|
|
116
|
+
activity_name: Name of the activity to check status for. Defaults to "ExecuteDefaultWorkflow".
|
|
117
|
+
|
|
118
|
+
Returns:
|
|
119
|
+
WorkflowStatus: The current status of the workflow execution.
|
|
120
|
+
|
|
121
|
+
Raises:
|
|
122
|
+
BaseError: If client is not set.
|
|
123
|
+
WorkflowReadError: If the status fetch request fails.
|
|
124
|
+
"""
|
|
125
|
+
project_id, workflow_name = workflow_id.split(":")
|
|
126
|
+
url = (
|
|
127
|
+
self._client.config.url_build_api
|
|
128
|
+
/ "workspace/projects"
|
|
129
|
+
/ project_id
|
|
130
|
+
/ "tasks"
|
|
131
|
+
/ workflow_name
|
|
132
|
+
/ "activities"
|
|
133
|
+
/ activity_name
|
|
134
|
+
/ "status"
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
try:
|
|
138
|
+
response = self._client.http.get(url=url)
|
|
139
|
+
response.raise_for_status()
|
|
140
|
+
except HTTPError as e:
|
|
141
|
+
raise WorkflowReadError(f"Workflow status of '{workflow_id}' could not be read.") from e
|
|
142
|
+
|
|
143
|
+
return WorkflowStatus(**response.json())
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cmem-client
|
|
3
|
+
Version: 0.5.0
|
|
4
|
+
Summary: Next generation eccenca Corporate Memory client library.
|
|
5
|
+
License: Apache-2.0
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Keywords: eccenca Corporate Memory,client
|
|
8
|
+
Author: eccenca GmbH
|
|
9
|
+
Author-email: cmempy-developer@eccenca.com
|
|
10
|
+
Requires-Python: >=3.13,<4
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
17
|
+
Requires-Dist: eccenca-marketplace-client (>=0.5.0,<0.6.0)
|
|
18
|
+
Requires-Dist: httpx (>=0.27.0,<0.28.0)
|
|
19
|
+
Requires-Dist: pydantic (>=2.8.2,<3.0.0)
|
|
20
|
+
Requires-Dist: pyjwt (>=2.8.0,<3.0.0)
|
|
21
|
+
Requires-Dist: rdflib (>=7.2.1,<8.0.0)
|
|
22
|
+
Requires-Dist: xdg-base-dirs (>=6.0.2,<7.0.0)
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
<!-- markdownlint-disable MD012 MD013 MD024 MD033 -->
|
|
26
|
+
# cmem-client
|
|
27
|
+
|
|
28
|
+
Next generation eccenca Corporate Memory client library.
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
[![poetry][poetry-shield]][poetry-link] [![ruff][ruff-shield]][ruff-link] [![mypy][mypy-shield]][mypy-link] [![copier][copier-shield]][copier]
|
|
32
|
+
|
|
33
|
+
## Development
|
|
34
|
+
|
|
35
|
+
- Run [task](https://taskfile.dev/) to see all major development tasks.
|
|
36
|
+
- Use [pre-commit](https://pre-commit.com/) to avoid errors before commit.
|
|
37
|
+
- This repository was created with [this copier template](https://github.com/eccenca/cmem-plugin-template).
|
|
38
|
+
|
|
39
|
+
## Goals
|
|
40
|
+
|
|
41
|
+
Compared to [cmem-cmempy](https://pypi.org/project/cmem-cmempy/), this package was started to have the following advantages:
|
|
42
|
+
|
|
43
|
+
- Better logging:
|
|
44
|
+
- ?
|
|
45
|
+
- Validation of incoming data:
|
|
46
|
+
- This is done using [pydantic](https://github.com/pydantic/pydantic).
|
|
47
|
+
- See the `models` subdirectory for details.
|
|
48
|
+
- Availability of data objects and proper typing:
|
|
49
|
+
- In addition to pydantic models, we use [mypy](https://www.mypy-lang.org/) to complain about untyped code.
|
|
50
|
+
- Async capabilities:
|
|
51
|
+
- Switching from requests to [httpx](https://www.python-httpx.org/) allows for using asynchronous calls as well as HTTP/2 sessions, if needed.
|
|
52
|
+
- Documentation:
|
|
53
|
+
- [MkDocs](https://www.mkdocs.org/) together with [mkdocstrings](https://mkdocstrings.github.io/) build the foundation for nice developer documentation.
|
|
54
|
+
|
|
55
|
+
[poetry-link]: https://python-poetry.org/
|
|
56
|
+
[poetry-shield]: https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json
|
|
57
|
+
[ruff-link]: https://docs.astral.sh/ruff/
|
|
58
|
+
[ruff-shield]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json&label=Code%20Style
|
|
59
|
+
[mypy-link]: https://mypy-lang.org/
|
|
60
|
+
[mypy-shield]: https://www.mypy-lang.org/static/mypy_badge.svg
|
|
61
|
+
[copier]: https://copier.readthedocs.io/
|
|
62
|
+
[copier-shield]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/copier-org/copier/master/img/badge/badge-grayscale-inverted-border-purple.json
|
|
63
|
+
|
|
64
|
+
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
cmem_client/__init__.py,sha256=59Z6nENiwC8fMB9EjiVHdtJ1fmSRRucIyYSu93xSCTk,490
|
|
2
|
+
cmem_client/auth_provider/__init__.py,sha256=rlm2azT3uVunG_hCyjbl8X-bpm0BSCIMQGugZWFlFBY,693
|
|
3
|
+
cmem_client/auth_provider/abc.py,sha256=ILt0G4ggscPU6m1ZtXdHeoK8t7zNyglaJ4Z9hAOPzQI,5232
|
|
4
|
+
cmem_client/auth_provider/client_credentials.py,sha256=iYzlRBJGWyLrX4k-Jj84zvY95p1pHFVxI_cb3CQG37k,9329
|
|
5
|
+
cmem_client/auth_provider/password.py,sha256=FzIt1RAvm33oDRyOdzXi3QGMfgtduE0QgerYsQI4LBI,11745
|
|
6
|
+
cmem_client/auth_provider/prefetched_token.py,sha256=pwT_gPtUaebMqpYnv1sKodHhAusGotXy4cGmVGWZvp0,6666
|
|
7
|
+
cmem_client/client.py,sha256=0_FCT1suGKUIRpkDfxnBuSb5Rv8_zWQyIUPLBgq-v1E,18783
|
|
8
|
+
cmem_client/components/__init__.py,sha256=DjuLm0R-UNidKROXBZFRa2SkTElqcFpFTkodLrGsJqk,448
|
|
9
|
+
cmem_client/components/graph_store.py,sha256=N3cJXNbebt6ov8UVs368gg8DfOE_62cJtoQw4nLLNBU,13905
|
|
10
|
+
cmem_client/components/marketplace.py,sha256=aPswFFdyV9yibDDqQ5cOCsOhzrG9kEgM5Q6Hu0DbOac,6658
|
|
11
|
+
cmem_client/components/sparql_wrapper.py,sha256=75fo52S3S_XQ8z8ShSwHaFoHtKCLJxE-H-xNLFJnWLo,1630
|
|
12
|
+
cmem_client/components/workspace.py,sha256=L5DtVU-tf4EL56Uu3UCWBJBHODfu4ptDrZ6ZobPS_Z0,8866
|
|
13
|
+
cmem_client/config.py,sha256=YgciVNv4eP7jlGXT4wGM5FPkx9oIfPuf7jvh56PQEJ0,14108
|
|
14
|
+
cmem_client/exceptions.py,sha256=uJ8KTqJQ91isq-ysaaS8GSPvz1q_S1RBa6MSqbpJXlc,2559
|
|
15
|
+
cmem_client/logging_utils.py,sha256=aFsvsx6bao3-4rUoh3xows7OmN2bGBnN2obz4VenbSc,1756
|
|
16
|
+
cmem_client/models/__init__.py,sha256=__1KnflCo_HP7G-73oaZ091ENkJK30sxfm3l1nSOR_8,701
|
|
17
|
+
cmem_client/models/access_condition.py,sha256=1_BOUlhl8YiPRlFUTm25Q3dz2QVJoVd8JMHiDelVjVc,5625
|
|
18
|
+
cmem_client/models/base.py,sha256=3Io6w6iQt_g9iKok4QMIpAMqYB6I8d4bVsiw6akGh_w,897
|
|
19
|
+
cmem_client/models/dataset.py,sha256=RTrUg-KWUIgfN0l81uNAnMpac5MOlJVTCzwC4ISvAEY,972
|
|
20
|
+
cmem_client/models/error.py,sha256=id-xyQGSlGqI9ePgVdUdB7SJmwBDORdCbeYugSa7RkI,1830
|
|
21
|
+
cmem_client/models/graph.py,sha256=5IzQWuCd45U2j81kyl935cQLSjeBTZRVM9QcUCUAhL8,785
|
|
22
|
+
cmem_client/models/item.py,sha256=gXp1Yh_hsgZKy-sbkGt78tTvV_2ODXT_PfbMS1OWh34,4108
|
|
23
|
+
cmem_client/models/logging_config.py,sha256=_pzI545AjyPf2LGaq_bqa9XbkFQa27R4bFjjdPQqRgs,1283
|
|
24
|
+
cmem_client/models/package.py,sha256=I8cL4pSNtVw1sZM2x7s5h6GfR-IpGXHc75MytrDe_ww,954
|
|
25
|
+
cmem_client/models/project.py,sha256=jfOZzw5ESqkgyn2InpiVDKdyzh-G5YQpc_zI6PJJ3gA,1457
|
|
26
|
+
cmem_client/models/python_package.py,sha256=4grVO5y57X0xwHhyRp51KYDzzjpX-IIn1fj20PEPlDw,689
|
|
27
|
+
cmem_client/models/token.py,sha256=L7lc3xATw0A_-FSoEyqOam8e9rbPwGMm1wm0xP9-Ixc,1314
|
|
28
|
+
cmem_client/models/url.py,sha256=9Ao1afKdoJP8aQ4QNhhi7p6P0RJPNvJOtFAarmDfThM,1180
|
|
29
|
+
cmem_client/models/workflow.py,sha256=9ZzlwoU5ZTmZW1w8KBb8NRFw0xb0d3wqgrIUp9S3U8w,3749
|
|
30
|
+
cmem_client/repositories/__init__.py,sha256=nxtk18ZtF3g5DcXDe1-k13bIl7NU_DLiZtHAi2Oe6Ic,777
|
|
31
|
+
cmem_client/repositories/access_conditions.py,sha256=yyxStTI0_9lfwldUUeUtG99Kd1we6UpBpkpVoJxzxJ0,2425
|
|
32
|
+
cmem_client/repositories/base/__init__.py,sha256=68ZuDEWFL1hMyqE7MMvdER1PtWDpioGXpYbwcv8PiG4,534
|
|
33
|
+
cmem_client/repositories/base/abc.py,sha256=LqVAQjVwKzvox-HwTyytvy63_u1pB1wAe36_wvdpoWI,4634
|
|
34
|
+
cmem_client/repositories/base/paged_list.py,sha256=MwypWtYSCkNsaR-U3KvEnOh3yff9ls-eNb_OhQih2G0,2071
|
|
35
|
+
cmem_client/repositories/base/plain_list.py,sha256=qF-HhiEIHsMXIW1dKdTlk9Tq4bRxuV-xrFYXpMXYy5U,1433
|
|
36
|
+
cmem_client/repositories/base/task_search.py,sha256=zeDFQLTn8Sbsvjjo0ntge8tUfbGjKtxklWYypboq61M,2305
|
|
37
|
+
cmem_client/repositories/datasets.py,sha256=y5dq665rqA_Sm4Zpgu90ojZjy-KkqCG1vBlmegEMT9A,1351
|
|
38
|
+
cmem_client/repositories/graph_imports.py,sha256=NTVR6lAgUpGkKJsxbOWswG9AS2FwzkIJUX73C-vAJb8,3070
|
|
39
|
+
cmem_client/repositories/graphs.py,sha256=Y7jz0DCUj1y55lO2egSc9Ys607le1vg4TmVLdINju40,17847
|
|
40
|
+
cmem_client/repositories/marketplace_packages.py,sha256=rrvIcnusy9VuHA5-JCFLvXA9t3biw-ha1O5x2nIKTzw,21589
|
|
41
|
+
cmem_client/repositories/projects.py,sha256=aY35uw1wp_ocV-WKh3ouFBClkBB5MTsQaKC1cZ95RY8,8642
|
|
42
|
+
cmem_client/repositories/protocols/__init__.py,sha256=qXSmMthpY6Tp9FpLZP32GM4cERDflTZoWpSCrEQHNcc,656
|
|
43
|
+
cmem_client/repositories/protocols/create_item.py,sha256=9ZFOcfFc9yqtNnclk7LpqMBiE7iGKASxpx49YYLCzbw,4771
|
|
44
|
+
cmem_client/repositories/protocols/delete_item.py,sha256=LAFwtkq6pYdQbwXsIcrj3yo5ohibZBIyp7Y0X3IJlm4,3428
|
|
45
|
+
cmem_client/repositories/protocols/export_item.py,sha256=wI0UDF8zpeEeUl5T-DzNGExlAf9csh_gqstKQI9TWN0,4193
|
|
46
|
+
cmem_client/repositories/protocols/import_item.py,sha256=k4Z0XjDEC2KEIcCSN9-fBqarxAAoEFltoJnQXo2Rylk,5708
|
|
47
|
+
cmem_client/repositories/python_packages.py,sha256=_XlMzvXhzt-33QTuiJnxWSVSeBUYOxufFaGAq0UoLm4,2120
|
|
48
|
+
cmem_client/repositories/workflows.py,sha256=ZTlKIwQXGgad96UKa6Ic1wh3Xhpy6KIOR2LolGW519U,4893
|
|
49
|
+
cmem_client-0.5.0.dist-info/METADATA,sha256=xlMwGN9N9BsKtSO_bUhap1sax0XEzC2X8rC30010cOQ,2916
|
|
50
|
+
cmem_client-0.5.0.dist-info/WHEEL,sha256=3ny-bZhpXrU6vSQ1UPG34FoxZBp3lVcvK0LkgUz6VLk,88
|
|
51
|
+
cmem_client-0.5.0.dist-info/licenses/LICENSE,sha256=5t6lcWcFU3TBO5wwq9PYNbgzfVfFUuL-80v5BTGuuMQ,11334
|
|
52
|
+
cmem_client-0.5.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2021 CMEM
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|