datashare-python 0.4.0__tar.gz → 0.5.0__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.
Files changed (28) hide show
  1. {datashare_python-0.4.0 → datashare_python-0.5.0}/PKG-INFO +1 -1
  2. {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/cli/worker.py +1 -8
  3. {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/discovery.py +11 -31
  4. datashare_python-0.5.0/datashare_python/worker-template.tar.gz +0 -0
  5. {datashare_python-0.4.0 → datashare_python-0.5.0}/pyproject.toml +1 -1
  6. datashare_python-0.4.0/datashare_python/worker-template.tar.gz +0 -0
  7. {datashare_python-0.4.0 → datashare_python-0.5.0}/.gitignore +0 -0
  8. {datashare_python-0.4.0 → datashare_python-0.5.0}/README.md +0 -0
  9. {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/.gitignore +0 -0
  10. {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/__init__.py +0 -0
  11. {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/__main__.py +0 -0
  12. {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/cli/__init__.py +0 -0
  13. {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/cli/local.py +0 -0
  14. {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/cli/project.py +0 -0
  15. {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/cli/task.py +0 -0
  16. {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/cli/utils.py +0 -0
  17. {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/config.py +0 -0
  18. {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/conftest.py +0 -0
  19. {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/constants.py +0 -0
  20. {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/dependencies.py +0 -0
  21. {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/exceptions.py +0 -0
  22. {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/local_client.py +0 -0
  23. {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/objects.py +0 -0
  24. {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/task_client.py +0 -0
  25. {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/template.py +0 -0
  26. {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/types_.py +0 -0
  27. {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/utils.py +0 -0
  28. {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/worker.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: datashare-python
3
- Version: 0.4.0
3
+ Version: 0.5.0
4
4
  Summary: Manage Pythoœn tasks and local resources in Datashare
5
5
  Project-URL: Homepage, https://icij.github.io/datashare-python/
6
6
  Project-URL: Documentation, https://icij.github.io/datashare-python/
@@ -24,7 +24,6 @@ _LIST_ACTIVITY_NAMES_HELP = "activity names filters (supports regexes)"
24
24
  _START_WORKER_WORKFLOWS_HELP = "workflow names run by the worker (supports regexes)"
25
25
  _START_WORKER_ACTIVITIES_HELP = "activity names run by the worker (supports regexes)"
26
26
  _START_WORKER_DEPS_HELP = "worker lifetime dependencies name in the registry"
27
- _START_WORKER_CONFIG_HELP = "worker config class key the worker configs registry"
28
27
  _START_WORKER_WORKER_ID_PREFIX_HELP = "worker ID prefix"
29
28
  _START_WORKER_CONFIG_PATH_HELP = (
30
29
  "path to a worker config YAML file,"
@@ -86,9 +85,6 @@ async def start(
86
85
  dependencies: Annotated[
87
86
  str | None, typer.Option(help=_START_WORKER_DEPS_HELP)
88
87
  ] = None,
89
- worker_config_name: Annotated[
90
- str | None, typer.Option(help=_START_WORKER_CONFIG_HELP)
91
- ] = None,
92
88
  config_path: Annotated[
93
89
  Path | None,
94
90
  typer.Option(
@@ -107,10 +103,7 @@ async def start(
107
103
  ] = None,
108
104
  ) -> None:
109
105
  registered_wfs, registered_acts, registered_deps, worker_config_cls = discover(
110
- workflows,
111
- act_names=activities,
112
- deps_name=dependencies,
113
- worker_config_name=worker_config_name,
106
+ workflows, act_names=activities, deps_name=dependencies
114
107
  )
115
108
  if config_path is not None:
116
109
  with config_path.open() as f:
@@ -13,11 +13,11 @@ logger = logging.getLogger(__name__)
13
13
  Activity = ActivityWithProgress | Callable | type
14
14
 
15
15
  _DEPENDENCIES = "dependencies"
16
- _WORKER_CONFIGS = "worker_configs"
16
+ _WORKER_CONFIG_CLS = "worker_config_cls"
17
17
  _WORKFLOW_GROUP = "datashare.workflows"
18
18
  _ACTIVITIES_GROUP = "datashare.activities"
19
19
  _DEPENDENCIES_GROUP = "datashare.dependencies"
20
- _WORKER_CONFIGS_GROUP = "datashare.worker_configs"
20
+ _WORKER_CONFIG_CLS_GROUP = "datashare.worker_config_cls"
21
21
 
22
22
  _RegisteredWorkflow = tuple[str, type]
23
23
  _RegisteredActivity = tuple[str, Activity]
@@ -31,11 +31,7 @@ _Discovery = tuple[
31
31
 
32
32
 
33
33
  def discover(
34
- wf_names: list[str] | None,
35
- *,
36
- act_names: list[str] | None,
37
- deps_name: str | None,
38
- worker_config_name: str | None,
34
+ wf_names: list[str] | None, *, act_names: list[str] | None, deps_name: str | None
39
35
  ) -> _Discovery:
40
36
  discovered = ""
41
37
  wfs = None
@@ -82,11 +78,8 @@ def discover(
82
78
  f"- {n_deps} dependenc{'ies' if n_deps > 1 else 'y'}:"
83
79
  f" {', '.join(deps_names)}"
84
80
  )
85
- if worker_config_name is not None:
86
- worker_config_cls = discover_worker_configs(worker_config_name)
87
- discovered += f"- worker config class: {worker_config_cls}"
88
- else:
89
- worker_config_cls = WorkerConfig
81
+ worker_config_cls = discover_worker_config_cls()
82
+ discovered += f"- worker config class: {worker_config_cls}"
90
83
  logger.info("discovered:\n%s", discovered)
91
84
  return wfs, acts, deps, worker_config_cls
92
85
 
@@ -147,28 +140,15 @@ def discover_dependencies(name: str) -> _Dependencies:
147
140
  raise LookupError(msg) from e
148
141
 
149
142
 
150
- def discover_worker_configs(name: str) -> type[WorkerConfig]:
151
- impls = entry_points(name=_WORKER_CONFIGS, group=_WORKER_CONFIGS_GROUP)
143
+ def discover_worker_config_cls() -> type[WorkerConfig]:
144
+ impls = entry_points(name=_WORKER_CONFIG_CLS, group=_WORKER_CONFIG_CLS_GROUP)
152
145
  if not impls:
153
- available_impls = entry_points(group=_WORKER_CONFIGS_GROUP)
154
- msg = (
155
- f'failed to find worker config: "{name}", '
156
- f"available dependencies: {available_impls}"
157
- )
158
- raise LookupError(msg)
146
+ return WorkerConfig
159
147
  if len(impls) > 1:
160
- msg = f'found multiple worker configs for name "{name}": {impls}'
148
+ msg = f'found multiple registered worker configs classes": {impls}'
161
149
  raise ValueError(msg)
162
- deps_registry = impls[_WORKER_CONFIGS].load()
163
- try:
164
- return deps_registry[name]
165
- except KeyError as e:
166
- available = list(deps_registry)
167
- msg = (
168
- f'failed to find worker config for name "{name}", available worker '
169
- f"configs: {available}"
170
- )
171
- raise LookupError(msg) from e
150
+ deps_registry = impls[_WORKER_CONFIG_CLS].load()
151
+ return deps_registry
172
152
 
173
153
 
174
154
  def _parse_wf_name(wf_type: type) -> str:
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "datashare-python"
3
- version = "0.4.0"
3
+ version = "0.5.0"
4
4
  description = "Manage Pythoœn tasks and local resources in Datashare"
5
5
  authors = [
6
6
  { name = "Clément Doumouro", email = "cdoumouro@icij.org" },