vantage6-algorithm-store 5.0.0b4__tar.gz → 5.0.0rc2__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 (64) hide show
  1. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/PKG-INFO +5 -5
  2. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/README.md +2 -2
  3. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/dev_store.sh +10 -1
  4. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/pyproject.toml +3 -3
  5. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/server.sh +4 -1
  6. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/tests_store/test___init__.py +2 -2
  7. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/__init__.py +6 -13
  8. vantage6_algorithm_store-5.0.0rc2/vantage6/algorithm/store/init_db.py +43 -0
  9. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/templates/mail/algorithm_review_finalized.html +1 -14
  10. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/templates/mail/new_algorithm.html +1 -14
  11. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/templates/mail/new_review.html +1 -14
  12. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/templates/mail/review_no_longer_required.html +1 -14
  13. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/.gitignore +0 -0
  14. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/Makefile +0 -0
  15. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/tests_store/__init__.py +0 -0
  16. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/tests_store/base/__init__.py +0 -0
  17. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/tests_store/base/unittest_base.py +0 -0
  18. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/tests_store/resources/__init__.py +0 -0
  19. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/tests_store/resources/test_algorithm.py +0 -0
  20. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/tests_store/resources/test_policy.py +0 -0
  21. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/tests_store/resources/test_review.py +0 -0
  22. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/tests_store/resources/test_role.py +0 -0
  23. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/tests_store/resources/test_rule.py +0 -0
  24. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/tests_store/resources/test_user.py +0 -0
  25. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/tests_store/resources/test_version.py +0 -0
  26. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/_data/unittest_config.yaml +0 -0
  27. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/_data/unittest_fixtures.yaml +0 -0
  28. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/db.py +0 -0
  29. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/default_roles.py +0 -0
  30. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/globals.py +0 -0
  31. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/model/__init__.py +0 -0
  32. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/model/algorithm.py +0 -0
  33. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/model/allowed_argument_value.py +0 -0
  34. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/model/argument.py +0 -0
  35. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/model/base.py +0 -0
  36. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/model/common/enums.py +0 -0
  37. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/model/common/ui_visualization_schemas.py +0 -0
  38. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/model/database.py +0 -0
  39. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/model/function.py +0 -0
  40. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/model/permission.py +0 -0
  41. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/model/policy.py +0 -0
  42. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/model/review.py +0 -0
  43. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/model/role.py +0 -0
  44. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/model/role_rule_association.py +0 -0
  45. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/model/rule.py +0 -0
  46. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/model/ui_visualization.py +0 -0
  47. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/model/user.py +0 -0
  48. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/permission.py +0 -0
  49. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/resource/__init__.py +0 -0
  50. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/resource/algorithm.py +0 -0
  51. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/resource/policy.py +0 -0
  52. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/resource/review.py +0 -0
  53. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/resource/role.py +0 -0
  54. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/resource/rule.py +0 -0
  55. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/resource/schema/input_schema.py +0 -0
  56. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/resource/schema/output_schema.py +0 -0
  57. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/resource/user.py +0 -0
  58. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/resource/version.py +0 -0
  59. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/static/robots.txt +0 -0
  60. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/templates/mail/algorithm_review_finalized.txt +0 -0
  61. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/templates/mail/new_algorithm.txt +0 -0
  62. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/templates/mail/new_review.txt +0 -0
  63. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/templates/mail/review_no_longer_required.txt +0 -0
  64. {vantage6_algorithm_store-5.0.0b4 → vantage6_algorithm_store-5.0.0rc2}/vantage6/algorithm/store/wsgi.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vantage6-algorithm-store
3
- Version: 5.0.0b4
3
+ Version: 5.0.0rc2
4
4
  Summary: Vantage6 algorithm store
5
5
  Author: Vantage6 Team
6
6
  Maintainer-email: Frank Martin <f.martin@iknl.nl>, Bart van Beusekom <b.vanbeusekom@iknl.nl>
@@ -18,8 +18,8 @@ Requires-Dist: python-keycloak==5.5.0
18
18
  Requires-Dist: requests==2.32.4
19
19
  Requires-Dist: schema==0.7.5
20
20
  Requires-Dist: sqlalchemy==2.0.37
21
- Requires-Dist: vantage6-common==5.0.0b4
22
- Requires-Dist: vantage6==5.0.0b4
21
+ Requires-Dist: vantage6-common==5.0.0rc2
22
+ Requires-Dist: vantage6==5.0.0rc2
23
23
  Provides-Extra: dev
24
24
  Requires-Dist: black; extra == 'dev'
25
25
  Requires-Dist: coverage==7.10.2; extra == 'dev'
@@ -49,5 +49,5 @@ the **[main Vantage6 README](https://github.com/vantage6/vantage6/blob/main/READ
49
49
 
50
50
  Vantage6 is a Privacy Enhancing Technology (PET) Operations platform that enables
51
51
  federated learning and multi-party computation. For more information, visit
52
- [vantage6.ai](https://vantage6.ai) or join our
53
- [Discord community](https://discord.gg/yAyFf6Y).
52
+ [vantage6.ai](https://vantage6.ai) or view our
53
+ [documentation](https://docs.vantage6.ai).
@@ -21,5 +21,5 @@ the **[main Vantage6 README](https://github.com/vantage6/vantage6/blob/main/READ
21
21
 
22
22
  Vantage6 is a Privacy Enhancing Technology (PET) Operations platform that enables
23
23
  federated learning and multi-party computation. For more information, visit
24
- [vantage6.ai](https://vantage6.ai) or join our
25
- [Discord community](https://discord.gg/yAyFf6Y).
24
+ [vantage6.ai](https://vantage6.ai) or view our
25
+ [documentation](https://docs.vantage6.ai).
@@ -12,8 +12,17 @@ if [ -z "$VANTAGE6_STORE_CONFIG_LOCATION" ]; then
12
12
  fi
13
13
 
14
14
 
15
+ # Run from repo root so module imports don't shadow stdlib modules.
16
+ cd /vantage6
15
17
 
16
- uwsgi \
18
+ python -m vantage6.algorithm.store.init_db "${VANTAGE6_STORE_CONFIG_LOCATION}"
19
+ status=$?
20
+ if [ "$status" -ne 0 ]; then
21
+ echo "ERROR: failed to initialize algorithm store database" >&2
22
+ exit "$status"
23
+ fi
24
+
25
+ exec uwsgi \
17
26
  --py-autoreload 1 \
18
27
  --reload-mercy 1 \
19
28
  --gevent 100 \
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "vantage6-algorithm-store"
7
- version = "5.0.0b4"
7
+ version = "5.0.0rc2"
8
8
  description = "Vantage6 algorithm store"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -30,8 +30,8 @@ dependencies = [
30
30
  "requests==2.32.4",
31
31
  "schema==0.7.5",
32
32
  "sqlalchemy==2.0.37",
33
- "vantage6-common==5.0.0b4",
34
- "vantage6==5.0.0b4",
33
+ "vantage6-common==5.0.0rc2",
34
+ "vantage6==5.0.0rc2",
35
35
  ]
36
36
 
37
37
  [project.optional-dependencies]
@@ -10,8 +10,11 @@ if [ -z "$VANTAGE6_CONFIG_LOCATION" ]; then
10
10
  fi
11
11
 
12
12
 
13
+ # initialize the database
14
+ python /vantage6/vantage6-algorithm-store/vantage6/algorithm/store/init_db.py "${VANTAGE6_CONFIG_LOCATION}"
13
15
 
14
- uwsgi \
16
+ # start the algorithm store
17
+ exec uwsgi \
15
18
  --http :80 \
16
19
  --gevent 100 \
17
20
  --http-websockets \
@@ -47,7 +47,7 @@ class TestAlgorithmStoreApp(TestResources):
47
47
 
48
48
  @patch("vantage6.algorithm.store.AlgorithmStoreApp._add_default_roles")
49
49
  @patch("vantage6.algorithm.store.AlgorithmStoreApp._add_keycloak_id_to_super_user")
50
- def test_store_startup(self, mock_add_keycloak_id, mock_add_default_roles):
50
+ def test_store_db_initialized(self, mock_add_keycloak_id, mock_add_default_roles):
51
51
  """Test that the store is started correctly"""
52
52
 
53
53
  # ensure root role is present - this role will be assigned to the root user
@@ -59,7 +59,7 @@ class TestAlgorithmStoreApp(TestResources):
59
59
  "username": "superuser",
60
60
  }
61
61
 
62
- self.backend.start()
62
+ self.backend.ensure_db_initialized()
63
63
 
64
64
  mock_add_default_roles.assert_called_once()
65
65
  mock_add_keycloak_id.assert_called_once()
@@ -235,30 +235,24 @@ class AlgorithmStoreApp(Vantage6App):
235
235
  ):
236
236
  algorithm.approve()
237
237
 
238
- def start(self) -> None:
238
+ def ensure_db_initialized(self) -> None:
239
239
  """
240
- Start the service.
241
-
242
- Before service is really started, some database settings are checked and
243
- (re)set where appropriate.
240
+ Ensure the database contains default roles and the configured root user.
244
241
  """
245
242
  self._add_default_roles(get_default_roles(), db)
246
243
 
247
244
  # add root user from config file if they do not exist
248
- if root_user := self.ctx.config.get("root_user", {}):
249
- root_username = root_user.get("username")
250
- root_organization = root_user.get("organization_id")
245
+ if root_user_config := self.ctx.config.get("root_user", {}):
246
+ root_username = root_user_config.get("username")
247
+ root_organization = root_user_config.get("organization_id")
251
248
  if root_username:
252
- # if the user does not exist already, add it
253
249
  root_user = db.User.get_by_username(root_username)
254
250
  if not root_user:
255
251
  log.warning(
256
252
  "Creating root user. Please note that it cannot be verified at "
257
253
  "this point that the user exists at the given vantage6 HQ."
258
254
  )
259
-
260
255
  root = db.Role.get_by_name(DefaultRole.ROOT.value)
261
-
262
256
  root_user = db.User(
263
257
  username=root_username,
264
258
  organization_id=root_organization,
@@ -296,7 +290,6 @@ class AlgorithmStoreApp(Vantage6App):
296
290
  "No root user found in the configuration file, nor are users defined in"
297
291
  " the database. This means no-one can alter resources on this store."
298
292
  )
299
- return self
300
293
 
301
294
 
302
295
  def run_store(config: str, system_folders: bool = True) -> AlgorithmStoreApp:
@@ -319,4 +312,4 @@ def run_store(config: str, system_folders: bool = True) -> AlgorithmStoreApp:
319
312
  config, system_folders, in_container=True
320
313
  )
321
314
  Database().connect(uri=ctx.get_database_uri(), allow_drop_all=False)
322
- return AlgorithmStoreApp(ctx).start()
315
+ return AlgorithmStoreApp(ctx)
@@ -0,0 +1,43 @@
1
+ """
2
+ One-shot database initialization for the algorithm store.
3
+
4
+ This script can be run before uWSGI starts to ensure that:
5
+ - default roles exist and are up to date
6
+ - the configured root user exists
7
+
8
+ By doing this in a separate script, we can avoid that multiple processes try to
9
+ create the same database objects concurrently.
10
+
11
+ It reuses the same context and database setup as run_store.
12
+ """
13
+
14
+ import os
15
+ import sys
16
+
17
+ from vantage6.cli.context.algorithm_store import AlgorithmStoreContext
18
+
19
+ from vantage6.algorithm.store import (
20
+ AlgorithmStoreApp,
21
+ Database,
22
+ )
23
+
24
+
25
+ def main() -> None:
26
+ if len(sys.argv) >= 2:
27
+ config_file = sys.argv[1]
28
+ else:
29
+ config_file = os.environ.get(
30
+ "VANTAGE6_STORE_CONFIG_LOCATION", "/mnt/config.yaml"
31
+ )
32
+
33
+ ctx = AlgorithmStoreContext.from_external_config_file(
34
+ config_file, system_folders=False, in_container=True
35
+ )
36
+ Database().connect(uri=ctx.get_database_uri(), allow_drop_all=False)
37
+
38
+ app = AlgorithmStoreApp(ctx)
39
+ app.ensure_db_initialized()
40
+
41
+
42
+ if __name__ == "__main__":
43
+ main()
@@ -2,7 +2,7 @@
2
2
  HTML Email Starter Kit
3
3
  Documentation: https://github.com/timothylong/html-email-starter-kit
4
4
  -->
5
- <!DOCTYPE html>
5
+ <!doctype html>
6
6
  <html>
7
7
  <head>
8
8
  <meta charset="UTF-8" />
@@ -184,19 +184,6 @@
184
184
  >vantage6.ai</a
185
185
  >
186
186
  </td>
187
- <td
188
- style="
189
- padding-top: 20px;
190
- padding-bottom: 20px;
191
- text-align: center;
192
- "
193
- >
194
- <a
195
- style="color: #0f497b; font-weight: bold"
196
- href="https://discord.gg/yAyFf6Y"
197
- >Join our Discord channel</a
198
- >
199
- </td>
200
187
  <td
201
188
  style="
202
189
  padding-top: 20px;
@@ -2,7 +2,7 @@
2
2
  HTML Email Starter Kit
3
3
  Documentation: https://github.com/timothylong/html-email-starter-kit
4
4
  -->
5
- <!DOCTYPE html>
5
+ <!doctype html>
6
6
  <html>
7
7
  <head>
8
8
  <meta charset="UTF-8" />
@@ -190,19 +190,6 @@
190
190
  >vantage6.ai</a
191
191
  >
192
192
  </td>
193
- <td
194
- style="
195
- padding-top: 20px;
196
- padding-bottom: 20px;
197
- text-align: center;
198
- "
199
- >
200
- <a
201
- style="color: #0f497b; font-weight: bold"
202
- href="https://discord.gg/yAyFf6Y"
203
- >Join our Discord channel</a
204
- >
205
- </td>
206
193
  <td
207
194
  style="
208
195
  padding-top: 20px;
@@ -2,7 +2,7 @@
2
2
  HTML Email Starter Kit
3
3
  Documentation: https://github.com/timothylong/html-email-starter-kit
4
4
  -->
5
- <!DOCTYPE html>
5
+ <!doctype html>
6
6
  <html>
7
7
  <head>
8
8
  <meta charset="UTF-8" />
@@ -190,19 +190,6 @@
190
190
  >vantage6.ai</a
191
191
  >
192
192
  </td>
193
- <td
194
- style="
195
- padding-top: 20px;
196
- padding-bottom: 20px;
197
- text-align: center;
198
- "
199
- >
200
- <a
201
- style="color: #0f497b; font-weight: bold"
202
- href="https://discord.gg/yAyFf6Y"
203
- >Join our Discord channel</a
204
- >
205
- </td>
206
193
  <td
207
194
  style="
208
195
  padding-top: 20px;
@@ -2,7 +2,7 @@
2
2
  HTML Email Starter Kit
3
3
  Documentation: https://github.com/timothylong/html-email-starter-kit
4
4
  -->
5
- <!DOCTYPE html>
5
+ <!doctype html>
6
6
  <html>
7
7
  <head>
8
8
  <meta charset="UTF-8" />
@@ -186,19 +186,6 @@
186
186
  >vantage6.ai</a
187
187
  >
188
188
  </td>
189
- <td
190
- style="
191
- padding-top: 20px;
192
- padding-bottom: 20px;
193
- text-align: center;
194
- "
195
- >
196
- <a
197
- style="color: #0f497b; font-weight: bold"
198
- href="https://discord.gg/yAyFf6Y"
199
- >Join our Discord channel</a
200
- >
201
- </td>
202
189
  <td
203
190
  style="
204
191
  padding-top: 20px;