vantage6 5.0.0a26__tar.gz → 5.0.0a33__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.

Potentially problematic release.


This version of vantage6 might be problematic. Click here for more details.

Files changed (94) hide show
  1. vantage6-5.0.0a33/.gitignore +33 -0
  2. vantage6-5.0.0a33/Makefile +22 -0
  3. vantage6-5.0.0a33/PKG-INFO +54 -0
  4. vantage6-5.0.0a33/README.md +26 -0
  5. vantage6-5.0.0a33/pyproject.toml +65 -0
  6. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/tests_cli/test_server_cli.py +7 -6
  7. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/tests_cli/test_wizard.py +7 -7
  8. vantage6-5.0.0a33/vantage6/cli/__init__.py +7 -0
  9. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/algorithm/generate_algorithm_json.py +28 -34
  10. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/algostore/list.py +2 -1
  11. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/algostore/start.py +6 -6
  12. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/algostore/stop.py +3 -2
  13. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/common/decorator.py +3 -1
  14. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/common/start.py +2 -4
  15. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/common/utils.py +7 -13
  16. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/configuration_manager.py +5 -3
  17. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/configuration_wizard.py +6 -10
  18. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/context/__init__.py +2 -1
  19. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/context/algorithm_store.py +10 -7
  20. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/context/node.py +7 -7
  21. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/context/server.py +10 -5
  22. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/dev/create.py +11 -13
  23. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/dev/remove.py +2 -2
  24. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/globals.py +5 -5
  25. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/node/common/__init__.py +6 -5
  26. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/node/start.py +18 -24
  27. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/server/files.py +4 -2
  28. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/server/import_.py +7 -7
  29. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/server/list.py +2 -1
  30. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/server/shell.py +5 -4
  31. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/server/start.py +2 -1
  32. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/server/stop.py +3 -2
  33. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/server/version.py +5 -4
  34. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/template/node_config.j2 +2 -0
  35. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/test/algo_test_scripts/algo_test_script.py +6 -5
  36. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/test/feature_tester.py +5 -2
  37. vantage6-5.0.0a26/PKG-INFO +0 -214
  38. vantage6-5.0.0a26/setup.cfg +0 -4
  39. vantage6-5.0.0a26/setup.py +0 -80
  40. vantage6-5.0.0a26/vantage6/cli/__build__ +0 -1
  41. vantage6-5.0.0a26/vantage6/cli/__init__.py +0 -3
  42. vantage6-5.0.0a26/vantage6/cli/_version.py +0 -23
  43. vantage6-5.0.0a26/vantage6.egg-info/PKG-INFO +0 -214
  44. vantage6-5.0.0a26/vantage6.egg-info/SOURCES.txt +0 -86
  45. vantage6-5.0.0a26/vantage6.egg-info/dependency_links.txt +0 -1
  46. vantage6-5.0.0a26/vantage6.egg-info/entry_points.txt +0 -5
  47. vantage6-5.0.0a26/vantage6.egg-info/requires.txt +0 -19
  48. vantage6-5.0.0a26/vantage6.egg-info/top_level.txt +0 -2
  49. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/tests_cli/__init__.py +0 -0
  50. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/tests_cli/test_client_script.py +0 -0
  51. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/tests_cli/test_example.py +0 -0
  52. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/tests_cli/test_node_cli.py +0 -0
  53. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/algorithm/create.py +0 -0
  54. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/algorithm/update.py +0 -0
  55. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/algostore/attach.py +0 -0
  56. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/algostore/files.py +0 -0
  57. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/algostore/new.py +0 -0
  58. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/algostore/remove.py +0 -0
  59. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/cli.py +0 -0
  60. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/common/stop.py +0 -0
  61. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/config.py +0 -0
  62. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/context/base_server.py +0 -0
  63. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/dev/data/km_dataset.csv +0 -0
  64. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/node/attach.py +0 -0
  65. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/node/clean.py +0 -0
  66. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/node/create_private_key.py +0 -0
  67. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/node/files.py +0 -0
  68. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/node/list.py +0 -0
  69. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/node/new.py +0 -0
  70. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/node/remove.py +0 -0
  71. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/node/restart.py +0 -0
  72. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/node/set_api_key.py +0 -0
  73. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/node/stop.py +0 -0
  74. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/node/version.py +0 -0
  75. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/prometheus/monitoring_manager.py +0 -0
  76. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/prometheus/prometheus.yml +0 -0
  77. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/rabbitmq/__init__.py +0 -0
  78. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/rabbitmq/definitions.py +0 -0
  79. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/rabbitmq/queue_manager.py +0 -0
  80. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/rabbitmq/rabbitmq.config +0 -0
  81. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/server/attach.py +0 -0
  82. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/server/common/__init__.py +0 -0
  83. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/server/new.py +0 -0
  84. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/server/remove.py +0 -0
  85. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/template/algo_store_config.j2 +0 -0
  86. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/template/server_config.j2 +0 -0
  87. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/template/server_import_config.j2 +0 -0
  88. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/test/algo_test_scripts/algo_test_arguments.py +0 -0
  89. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/test/client_script.py +0 -0
  90. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/test/common/diagnostic_runner.py +0 -0
  91. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/test/integration_test.py +0 -0
  92. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/use/context.py +0 -0
  93. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/use/namespace.py +0 -0
  94. {vantage6-5.0.0a26 → vantage6-5.0.0a33}/vantage6/cli/utils.py +0 -0
@@ -0,0 +1,33 @@
1
+
2
+ # documentation
3
+ docs/_build
4
+ docs/api-docs/_autosummary
5
+
6
+ # Python
7
+ .ipynb_checkpoints
8
+ **/__pycache__
9
+ **/.coverage
10
+
11
+ # IDE's
12
+ .idea/
13
+ *.sublime-project
14
+ *.sublime-workspace
15
+ .vscode/
16
+
17
+ # build files
18
+ **/build/
19
+ **/dist/
20
+ *.egg-info
21
+ *.code-workspace
22
+
23
+ # UI build files
24
+ **/node_modules/
25
+
26
+ # Ignore DevSpace cache and log folder
27
+ .devspace/
28
+ dev/.data/
29
+ dev/.tasks/
30
+ dev/.db/
31
+
32
+ # Helm
33
+ charts/**/*.tgz
@@ -0,0 +1,22 @@
1
+ # `make` is expected to be called from the directory that contains
2
+ # this Makefile
3
+
4
+ TAG ?= latest
5
+
6
+ rebuild: clean build-dist
7
+
8
+ build-dist:
9
+ # Build the PyPI package
10
+ uv build
11
+
12
+ publish:
13
+ # Uploading to pypi.org
14
+ twine upload --repository pypi dist/*
15
+
16
+ test:
17
+ coverage run --source=vantage6 --omit="utest.py" ./utest.py
18
+
19
+ clean:
20
+ # Cleaning ...
21
+ -rm -r build
22
+ -rm dist/*
@@ -0,0 +1,54 @@
1
+ Metadata-Version: 2.4
2
+ Name: vantage6
3
+ Version: 5.0.0a33
4
+ Summary: vantage6 command line interface
5
+ Author: Vantage6 Team
6
+ Maintainer-email: Frank Martin <f.martin@iknl.nl>, Bart van Beusekom <b.vanbeusekom@iknl.nl>
7
+ License: MIT
8
+ Requires-Python: >=3.13
9
+ Requires-Dist: click==8.1.3
10
+ Requires-Dist: colorama==0.4.6
11
+ Requires-Dist: copier==9.2.0
12
+ Requires-Dist: docker==7.1.0
13
+ Requires-Dist: ipython==8.10.0
14
+ Requires-Dist: jinja2==3.1.6
15
+ Requires-Dist: kubernetes==28.1.0
16
+ Requires-Dist: pandas>=2.2.3
17
+ Requires-Dist: questionary==1.10.0
18
+ Requires-Dist: rich==13.5.2
19
+ Requires-Dist: schema==0.7.5
20
+ Requires-Dist: sqlalchemy==2.0.37
21
+ Requires-Dist: vantage6-client==5.0.0a33
22
+ Requires-Dist: vantage6-common==5.0.0a33
23
+ Provides-Extra: dev
24
+ Requires-Dist: black; extra == 'dev'
25
+ Requires-Dist: coverage==7.10.2; extra == 'dev'
26
+ Requires-Dist: pre-commit; extra == 'dev'
27
+ Description-Content-Type: text/markdown
28
+
29
+ <h1 align="center">
30
+ <br>
31
+ <a href="https://vantage6.ai"><img src="https://github.com/IKNL/guidelines/blob/master/resources/logos/vantage6.png?raw=true" alt="vantage6" width="350"></a>
32
+ </h1>
33
+
34
+ <h3 align=center> A Privacy Enhancing Technology (PET) Operations platform</h3>
35
+
36
+ ---
37
+
38
+ # Vantage6 CLI
39
+
40
+ This package provides the command-line interface (CLI) for managing vantage6
41
+ infrastructure instances, such as servers and nodes.
42
+
43
+ ## Documentation
44
+
45
+ For complete documentation, installation instructions, and usage examples, please see
46
+ the **[main Vantage6 README](https://github.com/vantage6/vantage6/blob/main/README.md)**
47
+ .
48
+
49
+ ## About Vantage6
50
+
51
+ Vantage6 is a Privacy Enhancing Technology (PET) Operations platform that enables
52
+ federated learning and multi-party computation. For more information, visit
53
+ [vantage6.ai](https://vantage6.ai) or join our
54
+ [Discord community](https://discord.gg/yAyFf6Y).
@@ -0,0 +1,26 @@
1
+ <h1 align="center">
2
+ <br>
3
+ <a href="https://vantage6.ai"><img src="https://github.com/IKNL/guidelines/blob/master/resources/logos/vantage6.png?raw=true" alt="vantage6" width="350"></a>
4
+ </h1>
5
+
6
+ <h3 align=center> A Privacy Enhancing Technology (PET) Operations platform</h3>
7
+
8
+ ---
9
+
10
+ # Vantage6 CLI
11
+
12
+ This package provides the command-line interface (CLI) for managing vantage6
13
+ infrastructure instances, such as servers and nodes.
14
+
15
+ ## Documentation
16
+
17
+ For complete documentation, installation instructions, and usage examples, please see
18
+ the **[main Vantage6 README](https://github.com/vantage6/vantage6/blob/main/README.md)**
19
+ .
20
+
21
+ ## About Vantage6
22
+
23
+ Vantage6 is a Privacy Enhancing Technology (PET) Operations platform that enables
24
+ federated learning and multi-party computation. For more information, visit
25
+ [vantage6.ai](https://vantage6.ai) or join our
26
+ [Discord community](https://discord.gg/yAyFf6Y).
@@ -0,0 +1,65 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "vantage6"
7
+ version = "5.0.0a33"
8
+ description = "vantage6 command line interface"
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ authors = [
12
+ {name = "Vantage6 Team"}
13
+ ]
14
+ maintainers = [
15
+ {name = "Frank Martin", email = "f.martin@iknl.nl"},
16
+ {name = "Bart van Beusekom", email = "b.vanbeusekom@iknl.nl"}
17
+ ]
18
+ requires-python = ">=3.13"
19
+ dependencies = [
20
+ "click==8.1.3",
21
+ "colorama==0.4.6",
22
+ "copier==9.2.0",
23
+ "docker==7.1.0",
24
+ "ipython==8.10.0",
25
+ "jinja2==3.1.6",
26
+ "kubernetes==28.1.0",
27
+ "pandas>=2.2.3",
28
+ "questionary==1.10.0",
29
+ "rich==13.5.2",
30
+ "schema==0.7.5",
31
+ "sqlalchemy==2.0.37",
32
+ "vantage6-common==5.0.0a33",
33
+ "vantage6-client==5.0.0a33",
34
+ ]
35
+
36
+ [project.optional-dependencies]
37
+ dev = [
38
+ "coverage==7.10.2",
39
+ "black",
40
+ "pre-commit",
41
+ ]
42
+
43
+ [project.scripts]
44
+ v6 = "vantage6.cli.cli:cli_complete"
45
+
46
+ [tool.hatch.build.targets.wheel]
47
+ packages = ["vantage6"]
48
+
49
+ [tool.hatch.build.targets.wheel.sources]
50
+ "vantage6" = "vantage6"
51
+
52
+ [tool.setuptools.packages.find]
53
+ where = ["vantage6/cli"]
54
+
55
+ [tool.setuptools.package-data]
56
+ "vantage6/cli/" = [
57
+ "rabbimq/rabbitmq.config",
58
+ "template/node_config.j2",
59
+ "template/server_config.j2",
60
+ "template/server_import_config.j2",
61
+ "template/algo_store_config.j2",
62
+ "dev/data/olympic_athletes_2016.csv",
63
+ "dev/data/km_dataset.csv",
64
+ "prometheus/prometheus.yml",
65
+ ]
@@ -1,18 +1,19 @@
1
1
  import unittest
2
-
3
- from unittest.mock import MagicMock, patch
4
2
  from pathlib import Path
3
+ from unittest.mock import MagicMock, patch
4
+
5
5
  from click.testing import CliRunner
6
6
 
7
7
  from vantage6.common.globals import APPNAME, InstanceType
8
+
8
9
  from vantage6.cli.common.utils import attach_logs
9
- from vantage6.cli.server.start import cli_server_start
10
- from vantage6.cli.server.list import cli_server_configuration_list
10
+ from vantage6.cli.server.attach import cli_server_attach
11
11
  from vantage6.cli.server.files import cli_server_files
12
12
  from vantage6.cli.server.import_ import cli_server_import
13
+ from vantage6.cli.server.list import cli_server_configuration_list
13
14
  from vantage6.cli.server.new import cli_server_new
15
+ from vantage6.cli.server.start import cli_server_start
14
16
  from vantage6.cli.server.stop import cli_server_stop
15
- from vantage6.cli.server.attach import cli_server_attach
16
17
 
17
18
 
18
19
  class ServerCLITest(unittest.TestCase):
@@ -133,7 +134,7 @@ class ServerCLITest(unittest.TestCase):
133
134
  """Stop server without errors."""
134
135
 
135
136
  container1 = MagicMock()
136
- container1.name = f"{APPNAME}-iknl-system-{InstanceType.SERVER.value}"
137
+ container1.name = f"{APPNAME}-iknl-system-{InstanceType.SERVER}"
137
138
  containers.containers.list.return_value = [container1]
138
139
 
139
140
  runner = CliRunner()
@@ -1,15 +1,15 @@
1
1
  import unittest
2
-
3
2
  from pathlib import Path
4
- from unittest.mock import patch, MagicMock
3
+ from unittest.mock import MagicMock, patch
4
+
5
+ from vantage6.common.globals import InstanceType, NodePolicy
5
6
 
6
7
  from vantage6.cli.configuration_wizard import (
7
- node_configuration_questionaire,
8
- server_configuration_questionaire,
9
8
  configuration_wizard,
9
+ node_configuration_questionaire,
10
10
  select_configuration_questionaire,
11
+ server_configuration_questionaire,
11
12
  )
12
- from vantage6.common.globals import InstanceType, NodePolicy
13
13
 
14
14
  module_path = "vantage6.cli.configuration_wizard"
15
15
 
@@ -70,8 +70,8 @@ class WizardTest(unittest.TestCase):
70
70
  for key in keys:
71
71
  self.assertIn(key, config)
72
72
  nested_keys = [
73
- ["policies", NodePolicy.ALLOWED_ALGORITHMS],
74
- ["policies", NodePolicy.ALLOWED_ALGORITHM_STORES],
73
+ ["policies", NodePolicy.ALLOWED_ALGORITHMS.value],
74
+ ["policies", NodePolicy.ALLOWED_ALGORITHM_STORES.value],
75
75
  ]
76
76
  for nesting in nested_keys:
77
77
  current_config = config
@@ -0,0 +1,7 @@
1
+ """Command line interface for the vantage6 infrastructure."""
2
+
3
+ import importlib.metadata
4
+
5
+ # note that here we cannot use __package__ because __package__ resolves to vantage6.cli
6
+ # whereas the PyPi package is called vantage6
7
+ __version__ = importlib.metadata.version("vantage6")
@@ -1,27 +1,25 @@
1
- import os
2
- import sys
3
1
  import importlib
4
2
  import inspect
5
3
  import json
6
-
7
- from enum import Enum
4
+ import os
5
+ import sys
8
6
  from inspect import getmembers, isfunction, ismodule, signature
9
7
  from pathlib import Path
10
8
  from types import ModuleType, UnionType
11
9
  from typing import Any, OrderedDict
12
10
 
13
11
  import click
14
- import questionary as q
15
12
  import pandas as pd
13
+ import questionary as q
16
14
 
17
- from vantage6.algorithm.client import AlgorithmClient
18
- from vantage6.algorithm.tools import DecoratorStepType
19
15
  from vantage6.common import error, info, warning
20
- from vantage6.common.enum import AlgorithmArgumentType, AlgorithmStepType
21
16
  from vantage6.common.algorithm_function import (
22
17
  get_vantage6_decorator_type,
23
18
  is_vantage6_algorithm_func,
24
19
  )
20
+ from vantage6.common.enum import AlgorithmArgumentType, AlgorithmStepType, StrEnumBase
21
+
22
+ from vantage6.algorithm.client import AlgorithmClient
25
23
  from vantage6.algorithm.preprocessing.algorithm_json_data import (
26
24
  PREPROCESSING_FUNCTIONS_JSON_DATA,
27
25
  )
@@ -54,7 +52,7 @@ class MergePreference:
54
52
  cls._prefer_existing = None
55
53
 
56
54
 
57
- class FunctionArgumentType(Enum):
55
+ class FunctionArgumentType(StrEnumBase):
58
56
  """Type of the function argument"""
59
57
 
60
58
  PARAMETER = "parameter"
@@ -80,7 +78,7 @@ class Function:
80
78
  "display_name": self._pretty_print_name(self.name),
81
79
  "standalone": True,
82
80
  "description": self._extract_headline_of_docstring(),
83
- "step_type": self.step_type,
81
+ "step_type": self.step_type.value if self.step_type else None,
84
82
  "ui_visualizations": [],
85
83
  "arguments": [],
86
84
  "databases": [],
@@ -91,7 +89,7 @@ class Function:
91
89
  # if the function is a data extraction function, the first argument is a dict
92
90
  # with database connection details. This argument should not be added to the
93
91
  # function json. Instead, a database should be added to the function json.
94
- if self.step_type == AlgorithmStepType.DATA_EXTRACTION.value:
92
+ if self.step_type == AlgorithmStepType.DATA_EXTRACTION:
95
93
  function_json["databases"].append(
96
94
  {
97
95
  "name": "Database",
@@ -120,7 +118,7 @@ class Function:
120
118
  # infrastructure-defined function
121
119
  if (
122
120
  not self.func.__module__.startswith("vantage6.algorithm.")
123
- or not self.json["name"] in PREPROCESSING_FUNCTIONS_JSON_DATA
121
+ or self.json["name"] not in PREPROCESSING_FUNCTIONS_JSON_DATA
124
122
  ):
125
123
  return
126
124
 
@@ -211,11 +209,12 @@ class Function:
211
209
  }, FunctionArgumentType.DATAFRAME
212
210
  else:
213
211
  # This is a regular function parameter
212
+ type_ = self._get_argument_type(param, name)
214
213
  arg_json = {
215
214
  "name": name,
216
215
  "display_name": self._pretty_print_name(name),
217
216
  "description": self._extract_parameter_description(name),
218
- "type": self.get_argument_type(param, name),
217
+ "type": type_.value if type_ else None,
219
218
  "required": param.default == inspect.Parameter.empty,
220
219
  "has_default_value": param.default != inspect.Parameter.empty,
221
220
  "is_frontend_only": False,
@@ -247,7 +246,9 @@ class Function:
247
246
  "will not be added."
248
247
  )
249
248
 
250
- def get_argument_type(self, param: inspect.Parameter, name: str) -> str:
249
+ def _get_argument_type(
250
+ self, param: inspect.Parameter, name: str
251
+ ) -> AlgorithmArgumentType | None:
251
252
  """Get the type of the argument"""
252
253
  if isinstance(param.annotation, UnionType):
253
254
  # Arguments with default values may have type 'str | None'. If that is the
@@ -276,23 +277,23 @@ class Function:
276
277
  type_ = param.annotation
277
278
 
278
279
  if type_ == str:
279
- return AlgorithmArgumentType.STRING.value
280
+ return AlgorithmArgumentType.STRING
280
281
  elif type_ == dict:
281
- return AlgorithmArgumentType.JSON.value
282
+ return AlgorithmArgumentType.JSON
282
283
  elif type_ == int:
283
- return AlgorithmArgumentType.INTEGER.value
284
+ return AlgorithmArgumentType.INTEGER
284
285
  elif type_ == float:
285
- return AlgorithmArgumentType.FLOAT.value
286
+ return AlgorithmArgumentType.FLOAT
286
287
  elif type_ == bool:
287
- return AlgorithmArgumentType.BOOLEAN.value
288
+ return AlgorithmArgumentType.BOOLEAN
288
289
  elif type_ == list:
289
- return AlgorithmArgumentType.STRINGS.value
290
+ return AlgorithmArgumentType.STRINGS
290
291
  elif type_ == list[str]:
291
- return AlgorithmArgumentType.STRINGS.value
292
+ return AlgorithmArgumentType.STRINGS
292
293
  elif type_ == list[int]:
293
- return AlgorithmArgumentType.INTEGERS.value
294
+ return AlgorithmArgumentType.INTEGERS
294
295
  elif type_ == list[float]:
295
- return AlgorithmArgumentType.FLOATS.value
296
+ return AlgorithmArgumentType.FLOATS
296
297
  else:
297
298
  warning(
298
299
  f"Unsupported argument type: {param.annotation} for argument {name} "
@@ -321,21 +322,14 @@ class Function:
321
322
  header = " ".join(line.strip() for line in lines if line.strip() != "")
322
323
  return header
323
324
 
324
- def _get_step_type(self) -> str:
325
+ def _get_step_type(self) -> AlgorithmStepType | None:
325
326
  """Get the step type of the function"""
326
327
  decorator_type = get_vantage6_decorator_type(self.func)
327
- if decorator_type == DecoratorStepType.FEDERATED:
328
- return AlgorithmStepType.FEDERATED_COMPUTE.value
329
- elif decorator_type == DecoratorStepType.CENTRAL:
330
- return AlgorithmStepType.CENTRAL_COMPUTE.value
331
- elif decorator_type == DecoratorStepType.PREPROCESSING:
332
- return AlgorithmStepType.PREPROCESSING.value
333
- elif decorator_type == DecoratorStepType.DATA_EXTRACTION:
334
- return AlgorithmStepType.DATA_EXTRACTION.value
328
+ if decorator_type in AlgorithmStepType.list():
329
+ return decorator_type
335
330
  else:
336
331
  warning(
337
- f"Unsupported decorator type: {decorator_type} for function "
338
- f"{self.name}"
332
+ f"Unsupported decorator type: {decorator_type} for function {self.name}"
339
333
  )
340
334
  return None
341
335
 
@@ -2,6 +2,7 @@ import click
2
2
 
3
3
  from vantage6.common.docker.addons import check_docker_running
4
4
  from vantage6.common.globals import InstanceType
5
+
5
6
  from vantage6.cli.common.utils import get_server_configuration_list
6
7
 
7
8
 
@@ -12,4 +13,4 @@ def cli_algo_store_configuration_list() -> None:
12
13
  """
13
14
  check_docker_running()
14
15
 
15
- get_server_configuration_list(InstanceType.ALGORITHM_STORE.value)
16
+ get_server_configuration_list(InstanceType.ALGORITHM_STORE)
@@ -7,6 +7,8 @@ from vantage6.common.globals import (
7
7
  InstanceType,
8
8
  Ports,
9
9
  )
10
+
11
+ from vantage6.cli.common.decorator import click_insert_context
10
12
  from vantage6.cli.common.start import (
11
13
  attach_logs,
12
14
  check_for_start,
@@ -17,7 +19,6 @@ from vantage6.cli.common.start import (
17
19
  pull_infra_image,
18
20
  )
19
21
  from vantage6.cli.context.algorithm_store import AlgorithmStoreContext
20
- from vantage6.cli.common.decorator import click_insert_context
21
22
 
22
23
 
23
24
  @click.command()
@@ -27,13 +28,12 @@ from vantage6.cli.common.decorator import click_insert_context
27
28
  @click.option(
28
29
  "--keep/--auto-remove",
29
30
  default=False,
30
- help="Keep image after algorithm store has been stopped. Useful " "for debugging",
31
+ help="Keep image after algorithm store has been stopped. Useful for debugging",
31
32
  )
32
33
  @click.option(
33
34
  "--mount-src",
34
35
  default="",
35
- help="Override vantage6 source code in container with the source"
36
- " code in this path",
36
+ help="Override vantage6 source code in container with the source code in this path",
37
37
  )
38
38
  @click.option(
39
39
  "--attach/--detach",
@@ -54,7 +54,7 @@ def cli_algo_store_start(
54
54
  Start the algorithm store server.
55
55
  """
56
56
  info("Starting algorithm store...")
57
- docker_client = check_for_start(ctx, InstanceType.ALGORITHM_STORE.value)
57
+ docker_client = check_for_start(ctx, InstanceType.ALGORITHM_STORE)
58
58
 
59
59
  image = get_image(image, ctx, "algorithm-store", DEFAULT_ALGO_STORE_IMAGE)
60
60
 
@@ -84,7 +84,7 @@ def cli_algo_store_start(
84
84
  info(cmd)
85
85
 
86
86
  info("Run Docker container")
87
- port_ = str(port or ctx.config["port"] or Ports.DEV_ALGO_STORE.value)
87
+ port_ = str(port or ctx.config["port"] or Ports.DEV_ALGO_STORE)
88
88
  container = docker_client.containers.run(
89
89
  image,
90
90
  command=cmd,
@@ -2,12 +2,13 @@ import click
2
2
  import docker
3
3
  from colorama import Fore, Style
4
4
 
5
- from vantage6.common import info, warning, error
5
+ from vantage6.common import error, info, warning
6
6
  from vantage6.common.docker.addons import (
7
7
  check_docker_running,
8
8
  remove_container_if_exists,
9
9
  )
10
10
  from vantage6.common.globals import APPNAME, InstanceType
11
+
11
12
  from vantage6.cli.common.decorator import click_insert_context
12
13
  from vantage6.cli.context.algorithm_store import AlgorithmStoreContext
13
14
 
@@ -23,7 +24,7 @@ def cli_algo_store_stop(ctx: AlgorithmStoreContext, all_stores: bool):
23
24
  client = docker.from_env()
24
25
 
25
26
  running_stores = client.containers.list(
26
- filters={"label": f"{APPNAME}-type={InstanceType.ALGORITHM_STORE.value}"}
27
+ filters={"label": f"{APPNAME}-type={InstanceType.ALGORITHM_STORE}"}
27
28
  )
28
29
 
29
30
  if not running_stores:
@@ -1,11 +1,13 @@
1
1
  from functools import wraps
2
2
  from pathlib import Path
3
+
3
4
  import click
4
5
 
5
6
  from vantage6.common import error
6
7
  from vantage6.common.globals import InstanceType
8
+
7
9
  from vantage6.cli.configuration_wizard import select_configuration_questionaire
8
- from vantage6.cli.context import select_context_class, get_context
10
+ from vantage6.cli.context import get_context, select_context_class
9
11
 
10
12
 
11
13
  def click_insert_context(
@@ -33,8 +33,8 @@ from vantage6.cli.common.utils import print_log_worker
33
33
  from vantage6.cli.context import AlgorithmStoreContext, ServerContext
34
34
  from vantage6.cli.globals import AlgoStoreGlobals, ServerGlobals
35
35
  from vantage6.cli.utils import (
36
- validate_input_cmd_args,
37
36
  check_config_name_allowed,
37
+ validate_input_cmd_args,
38
38
  )
39
39
 
40
40
 
@@ -69,7 +69,7 @@ def check_for_start(ctx: AppContext, type_: InstanceType) -> DockerClient:
69
69
  )
70
70
  for server in running_servers:
71
71
  if server.name == f"{APPNAME}-{ctx.name}-{ctx.scope}-{type_}":
72
- error(f"Server {Fore.RED}{ctx.name}{Style.RESET_ALL} " "is already running")
72
+ error(f"Server {Fore.RED}{ctx.name}{Style.RESET_ALL} is already running")
73
73
  exit(1)
74
74
  return docker_client
75
75
 
@@ -304,8 +304,6 @@ def attach_logs(container: Container, type_: InstanceType) -> None:
304
304
  type_ : InstanceType
305
305
  The type of instance to attach the logs for
306
306
  """
307
- if isinstance(type_, enum.Enum):
308
- type_ = type_.value
309
307
  logs = container.attach(stream=True, logs=True, stdout=True)
310
308
  Thread(target=print_log_worker, args=(logs,), daemon=True).start()
311
309
  while True:
@@ -78,7 +78,7 @@ def get_running_servers(
78
78
  return [server.name for server in running_servers]
79
79
 
80
80
 
81
- def get_server_configuration_list(instance_type: InstanceType.SERVER) -> None:
81
+ def get_server_configuration_list(instance_type: InstanceType) -> None:
82
82
  """
83
83
  Print list of available server configurations.
84
84
 
@@ -90,11 +90,7 @@ def get_server_configuration_list(instance_type: InstanceType.SERVER) -> None:
90
90
  client = docker.from_env()
91
91
  ctx_class = select_context_class(instance_type)
92
92
 
93
- instance_type_value = (
94
- instance_type.value if isinstance(instance_type, enum.Enum) else instance_type
95
- )
96
-
97
- running_server_names = get_running_servers(client, instance_type_value)
93
+ running_server_names = get_running_servers(client, instance_type)
98
94
  header = "\nName" + (21 * " ") + "Status" + (10 * " ") + "System/User"
99
95
 
100
96
  click.echo(header)
@@ -108,26 +104,24 @@ def get_server_configuration_list(instance_type: InstanceType.SERVER) -> None:
108
104
  for config in configs:
109
105
  status = (
110
106
  running
111
- if f"{APPNAME}-{config.name}-system-{instance_type_value}"
112
- in running_server_names
107
+ if f"{APPNAME}-{config.name}-system-{instance_type}" in running_server_names
113
108
  else stopped
114
109
  )
115
- click.echo(f"{config.name:25}" f"{status:25} System ")
110
+ click.echo(f"{config.name:25}{status:25} System ")
116
111
 
117
112
  # user folders
118
113
  configs, f2 = ctx_class.available_configurations(system_folders=False)
119
114
  for config in configs:
120
115
  status = (
121
116
  running
122
- if f"{APPNAME}-{config.name}-user-{instance_type_value}"
123
- in running_server_names
117
+ if f"{APPNAME}-{config.name}-user-{instance_type}" in running_server_names
124
118
  else stopped
125
119
  )
126
- click.echo(f"{config.name:25}" f"{status:25} User ")
120
+ click.echo(f"{config.name:25}{status:25} User ")
127
121
 
128
122
  click.echo("-" * 85)
129
123
  if len(f1) + len(f2):
130
- warning(f"{Fore.RED}Failed imports: {len(f1)+len(f2)}{Style.RESET_ALL}")
124
+ warning(f"{Fore.RED}Failed imports: {len(f1) + len(f2)}{Style.RESET_ALL}")
131
125
 
132
126
 
133
127
  def print_log_worker(logs_stream: Iterable[bytes]) -> None:
@@ -1,4 +1,6 @@
1
- from schema import And, Or, Use, Optional
1
+ from typing import Self
2
+
3
+ from schema import And, Optional, Or, Use
2
4
 
3
5
  from vantage6.common.configuration_manager import Configuration, ConfigurationManager
4
6
 
@@ -63,7 +65,7 @@ class NodeConfigurationManager(ConfigurationManager):
63
65
  super().__init__(conf_class=NodeConfiguration, name=name)
64
66
 
65
67
  @classmethod
66
- def from_file(cls, path: str) -> "NodeConfigurationManager":
68
+ def from_file(cls, path: str) -> Self:
67
69
  """
68
70
  Create a new instance of the NodeConfigurationManager from a
69
71
  configuration file.
@@ -95,7 +97,7 @@ class ServerConfigurationManager(ConfigurationManager):
95
97
  super().__init__(conf_class=ServerConfiguration, name=name)
96
98
 
97
99
  @classmethod
98
- def from_file(cls, path) -> "ServerConfigurationManager":
100
+ def from_file(cls, path) -> Self:
99
101
  """
100
102
  Create a new instance of the ServerConfigurationManager from a
101
103
  configuration file.