Skip to content

Commit 0ed3f04

Browse files
author
Andrei Neagu
committed
Merge remote-tracking branch 'upstream/master' into pr-osparc-add-director-v0-client
2 parents 77aa41f + c758028 commit 0ed3f04

File tree

68 files changed

+2227
-706
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+2227
-706
lines changed

.github/workflows/ci-testing-deploy.yml

Lines changed: 126 additions & 126 deletions
Large diffs are not rendered by default.

.github/workflows/ci-testing-pull-request.yml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,16 @@ jobs:
2525
with:
2626
python-version: "3.11"
2727
- name: install uv
28-
uses: astral-sh/setup-uv@v4
28+
uses: astral-sh/setup-uv@v5
2929
with:
30-
version: "0.4.x"
31-
enable-cache: false
30+
version: "0.5.x"
31+
enable-cache: true
3232
- name: checkout source branch
3333
uses: actions/checkout@v4
3434
- name: Regenerate specs and check
3535
run: |
36-
uv venv .venv && source .venv/bin/activate
36+
make devenv
37+
source .venv/bin/activate
3738
make openapi-specs
3839
if ! ./ci/github/helpers/openapi-specs-diff.bash diff \
3940
https://raw.githubusercontent.com/${{ github.event.pull_request.head.repo.full_name }}/refs/heads/${{ github.event.pull_request.head.ref }} \
@@ -51,11 +52,6 @@ jobs:
5152
uses: actions/setup-python@v5
5253
with:
5354
python-version: "3.11"
54-
- name: install uv
55-
uses: astral-sh/setup-uv@v4
56-
with:
57-
version: "0.4.x"
58-
enable-cache: false
5955
- name: checkout
6056
uses: actions/checkout@v4
6157
- name: check api-server backwards compatibility
@@ -75,11 +71,6 @@ jobs:
7571
uses: actions/setup-python@v5
7672
with:
7773
python-version: "3.11"
78-
- name: install uv
79-
uses: astral-sh/setup-uv@v4
80-
with:
81-
version: "0.4.x"
82-
enable-cache: false
8374
- name: checkout
8475
uses: actions/checkout@v4
8576
- name: Check openapi-specs backwards compatibility

.vscode/settings.template.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"**/requirements/*.txt": "pip-requirements",
1515
"*logs.txt": "log",
1616
"*Makefile": "makefile",
17-
"*sql.*": "sql",
17+
"*.sql": "sql",
1818
"docker-compose*.yml": "dockercompose",
1919
"Dockerfile*": "dockerfile"
2020
},
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
""" Helper script to generate OAS automatically
2+
"""
3+
4+
# pylint: disable=redefined-outer-name
5+
# pylint: disable=unused-argument
6+
# pylint: disable=unused-variable
7+
# pylint: disable=too-many-arguments
8+
9+
from typing import Annotated
10+
11+
from _common import as_query
12+
from fastapi import APIRouter, Depends
13+
from models_library.api_schemas_webserver.licensed_items_purchases import (
14+
LicensedItemPurchaseGet,
15+
)
16+
from models_library.generics import Envelope
17+
from models_library.rest_error import EnvelopedError
18+
from models_library.rest_pagination import Page
19+
from simcore_service_webserver._meta import API_VTAG
20+
from simcore_service_webserver.licenses._exceptions_handlers import _TO_HTTP_ERROR_MAP
21+
from simcore_service_webserver.licenses._licensed_items_checkouts_models import (
22+
LicensedItemCheckoutPathParams,
23+
LicensedItemsCheckoutsListQueryParams,
24+
)
25+
from simcore_service_webserver.wallets._handlers import WalletsPathParams
26+
27+
router = APIRouter(
28+
prefix=f"/{API_VTAG}",
29+
tags=[
30+
"licenses",
31+
],
32+
responses={
33+
i.status_code: {"model": EnvelopedError} for i in _TO_HTTP_ERROR_MAP.values()
34+
},
35+
)
36+
37+
38+
@router.get(
39+
"/wallets/{wallet_id}/licensed-items-checkouts",
40+
response_model=Page[LicensedItemPurchaseGet],
41+
tags=["wallets"],
42+
)
43+
async def list_licensed_item_checkouts_for_wallet(
44+
_path: Annotated[WalletsPathParams, Depends()],
45+
_query: Annotated[as_query(LicensedItemsCheckoutsListQueryParams), Depends()],
46+
):
47+
...
48+
49+
50+
@router.get(
51+
"/licensed-items-checkouts/{licensed_item_checkout_id}",
52+
response_model=Envelope[LicensedItemPurchaseGet],
53+
)
54+
async def get_licensed_item_checkout(
55+
_path: Annotated[LicensedItemCheckoutPathParams, Depends()],
56+
):
57+
...

api/specs/web-server/_tags.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
@router.post(
2323
"/tags",
2424
response_model=Envelope[TagGet],
25+
status_code=status.HTTP_201_CREATED,
2526
)
2627
async def create_tag(_body: TagCreate):
2728
...

api/specs/web-server/_tags_groups.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88

99
from fastapi import APIRouter, Depends, status
1010
from models_library.generics import Envelope
11+
from models_library.rest_error import EnvelopedError
1112
from simcore_service_webserver._meta import API_VTAG
13+
from simcore_service_webserver.tags._rest import _TO_HTTP_ERROR_MAP
1214
from simcore_service_webserver.tags.schemas import (
1315
TagGet,
1416
TagGroupCreate,
@@ -23,6 +25,9 @@
2325
"tags",
2426
"groups",
2527
],
28+
responses={
29+
i.status_code: {"model": EnvelopedError} for i in _TO_HTTP_ERROR_MAP.values()
30+
},
2631
)
2732

2833

@@ -31,7 +36,7 @@
3136
response_model=Envelope[list[TagGroupGet]],
3237
)
3338
async def list_tag_groups(_path_params: Annotated[TagPathParams, Depends()]):
34-
...
39+
"""Lists all groups associated to this tag"""
3540

3641

3742
@router.post(
@@ -42,22 +47,22 @@ async def list_tag_groups(_path_params: Annotated[TagPathParams, Depends()]):
4247
async def create_tag_group(
4348
_path_params: Annotated[TagGroupPathParams, Depends()], _body: TagGroupCreate
4449
):
45-
...
50+
"""Shares tag `tag_id` with an organization or user with `group_id` providing access-rights to it"""
4651

4752

4853
@router.put(
4954
"/tags/{tag_id}/groups/{group_id}",
5055
response_model=Envelope[list[TagGroupGet]],
5156
)
52-
async def replace_tag_groups(
57+
async def replace_tag_group(
5358
_path_params: Annotated[TagGroupPathParams, Depends()], _body: TagGroupCreate
5459
):
55-
...
60+
"""Replace access rights on tag for associated organization or user with `group_id`"""
5661

5762

5863
@router.delete(
5964
"/tags/{tag_id}/groups/{group_id}",
6065
status_code=status.HTTP_204_NO_CONTENT,
6166
)
6267
async def delete_tag_group(_path_params: Annotated[TagGroupPathParams, Depends()]):
63-
...
68+
"""Delete access rights on tag to an associated organization or user with `group_id`"""

api/specs/web-server/openapi.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"_long_running_tasks",
3939
"_licensed_items",
4040
"_licensed_items_purchases",
41+
"_licensed_items_checkouts",
4142
"_metamodeling",
4243
"_nih_sparc",
4344
"_nih_sparc_redirections",
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from typing_extensions import TypedDict
2+
3+
4+
class AccessRightsDict(TypedDict):
5+
read: bool
6+
write: bool
7+
delete: bool

packages/common-library/tests/test_unset.py renamed to packages/common-library/tests/test_exclude.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import Any
22

3-
from common_library.unset import UnSet, as_dict_exclude_unset
3+
from common_library.exclude import UnSet, as_dict_exclude_none, as_dict_exclude_unset
44

55

66
def test_as_dict_exclude_unset():
@@ -13,3 +13,10 @@ def f(
1313
assert f(par1="hi") == {"par1": "hi"}
1414
assert f(par2=4) == {"par2": 4}
1515
assert f(par1="hi", par2=4) == {"par1": "hi", "par2": 4}
16+
17+
# still expected behavior
18+
assert as_dict_exclude_unset(par1=None) == {"par1": None}
19+
20+
21+
def test_as_dict_exclude_none():
22+
assert as_dict_exclude_none(par1=None) == {}

0 commit comments

Comments
 (0)