Skip to content

Commit ea0665c

Browse files
committed
Merge branch 'master' into extract-celery-code
2 parents 0fc9137 + 403186c commit ea0665c

File tree

358 files changed

+9663
-3825
lines changed

Some content is hidden

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

358 files changed

+9663
-3825
lines changed

.github/copilot-instructions.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ This document provides guidelines and best practices for using GitHub Copilot in
2323
- ensure we use `fastapi` >0.100 compatible code
2424
- use f-string formatting
2525
- Only add comments in function if strictly necessary
26+
- use relative imports
27+
- imports should be at top of the file
2628

2729

2830
### Json serialization

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ jobs:
116116
- 'mypy.ini'
117117
common-library:
118118
- 'packages/common-library/**'
119+
- 'packages/pytest-simcore/**'
120+
- 'services/docker-compose*'
121+
- 'scripts/mypy/*'
122+
- 'mypy.ini'
119123
notifications-library:
120124
- 'packages/notifications-library/**'
121125
- 'packages/postgres-database/**'
@@ -1745,7 +1749,11 @@ jobs:
17451749
with:
17461750
python-version: ${{ matrix.python }}
17471751
- name: install uv
1748-
uses: yezz123/setup-uv@v4
1752+
uses: astral-sh/setup-uv@v6
1753+
with:
1754+
version: "0.6.x"
1755+
enable-cache: false
1756+
cache-dependency-glob: "**/common-library/requirements/ci.txt"
17491757
- name: show system version
17501758
run: ./ci/helpers/show_system_versions.bash
17511759
- name: install
@@ -1755,6 +1763,9 @@ jobs:
17551763
- name: test
17561764
run: ./ci/github/unit-testing/common-library.bash test
17571765
- uses: codecov/codecov-action@v5
1766+
if: ${{ !cancelled() }}
1767+
env:
1768+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
17581769
with:
17591770
flags: unittests #optional
17601771

.vscode/extensions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"DevSoft.svg-viewer-vscode",
66
"eamodio.gitlens",
77
"exiasr.hadolint",
8-
"ms-azuretools.vscode-docker",
8+
"ms-azuretools.vscode-containers",
99
"ms-python.black-formatter",
1010
"ms-python.pylint",
1111
"ms-python.python",

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ The SIM-CORE, named **o<sup>2</sup>S<sup>2</sup>PARC** – **O**pen **O**nline *
3333
The aim of o<sup>2</sup>S<sup>2</sup>PARC is to establish a comprehensive, freely accessible, intuitive, and interactive online platform for simulating peripheral nerve system neuromodulation/ stimulation and its impact on organ physiology in a precise and predictive manner.
3434
To achieve this, the platform will comprise both state-of-the art and highly detailed animal and human anatomical models with realistic tissue property distributions that make it possible to perform simulations ranging from the molecular scale up to the complexity of the human body.
3535

36+
3637
## Getting Started
3738

3839
A production instance of **o<sup>2</sup>S<sup>2</sup>PARC** is running at [oSPARC.io](https://osparc.io).

api/specs/web-server/_auth.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,8 @@ async def email_confirmation(code: str):
260260

261261
@router.get(
262262
"/auth/captcha",
263-
operation_id="request_captcha",
263+
operation_id="create_captcha",
264264
status_code=status.HTTP_200_OK,
265265
responses={status.HTTP_200_OK: {"content": {"image/png": {}}}},
266266
)
267-
async def request_captcha(): ...
267+
async def create_captcha(): ...

api/specs/web-server/_computations.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66
from models_library.api_schemas_webserver.computations import (
77
ComputationGet,
88
ComputationPathParams,
9+
ComputationRunIterationsLatestListQueryParams,
10+
ComputationRunIterationsListQueryParams,
911
ComputationRunPathParams,
1012
ComputationRunRestGet,
11-
ComputationRunWithFiltersListQueryParams,
1213
ComputationStart,
1314
ComputationStarted,
1415
ComputationTaskRestGet,
1516
)
1617
from models_library.generics import Envelope
1718
from simcore_service_webserver._meta import API_VTAG
1819
from simcore_service_webserver.director_v2._controller.computations_rest import (
19-
ComputationRunListQueryParams,
2020
ComputationTaskListQueryParams,
2121
ComputationTaskPathParams,
2222
)
@@ -71,7 +71,9 @@ async def stop_computation(_path: Annotated[ComputationPathParams, Depends()]):
7171
response_model=Page[ComputationRunRestGet],
7272
)
7373
async def list_computations_latest_iteration(
74-
_query: Annotated[as_query(ComputationRunWithFiltersListQueryParams), Depends()],
74+
_query: Annotated[
75+
as_query(ComputationRunIterationsLatestListQueryParams), Depends()
76+
],
7577
): ...
7678

7779

@@ -80,7 +82,7 @@ async def list_computations_latest_iteration(
8082
response_model=Page[ComputationRunRestGet],
8183
)
8284
async def list_computation_iterations(
83-
_query: Annotated[as_query(ComputationRunListQueryParams), Depends()],
85+
_query: Annotated[as_query(ComputationRunIterationsListQueryParams), Depends()],
8486
_path: Annotated[ComputationRunPathParams, Depends()],
8587
): ...
8688

api/specs/web-server/_users.py

Lines changed: 40 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,25 @@
77
from enum import Enum
88
from typing import Annotated
99

10+
from _common import as_query
1011
from fastapi import APIRouter, Depends, status
1112
from models_library.api_schemas_webserver.users import (
1213
MyPermissionGet,
1314
MyProfileGet,
1415
MyProfilePatch,
1516
MyTokenCreate,
1617
MyTokenGet,
17-
UserForAdminGet,
18+
UserAccountApprove,
19+
UserAccountGet,
20+
UserAccountReject,
21+
UserAccountSearchQueryParams,
1822
UserGet,
19-
UsersForAdminSearchQueryParams,
23+
UsersAccountListQueryParams,
2024
UsersSearch,
2125
)
2226
from models_library.api_schemas_webserver.users_preferences import PatchRequestBody
2327
from models_library.generics import Envelope
28+
from models_library.rest_pagination import Page
2429
from models_library.user_preferences import PreferenceIdentifier
2530
from simcore_service_webserver._meta import API_VTAG
2631
from simcore_service_webserver.users._common.schemas import PreRegisteredUserGet
@@ -144,20 +149,46 @@ async def search_users(_body: UsersSearch): ...
144149

145150

146151
@router.get(
147-
"/admin/users:search",
148-
response_model=Envelope[list[UserForAdminGet]],
152+
"/admin/user-accounts",
153+
response_model=Page[UserAccountGet],
149154
tags=_extra_tags,
150155
)
151-
async def search_users_for_admin(
152-
_query: Annotated[UsersForAdminSearchQueryParams, Depends()],
156+
async def list_users_accounts(
157+
_query: Annotated[as_query(UsersAccountListQueryParams), Depends()],
158+
): ...
159+
160+
161+
@router.post(
162+
"/admin/user-accounts:approve",
163+
status_code=status.HTTP_204_NO_CONTENT,
164+
tags=_extra_tags,
165+
)
166+
async def approve_user_account(_body: UserAccountApprove): ...
167+
168+
169+
@router.post(
170+
"/admin/user-accounts:reject",
171+
status_code=status.HTTP_204_NO_CONTENT,
172+
tags=_extra_tags,
173+
)
174+
async def reject_user_account(_body: UserAccountReject): ...
175+
176+
177+
@router.get(
178+
"/admin/user-accounts:search",
179+
response_model=Envelope[list[UserAccountGet]],
180+
tags=_extra_tags,
181+
)
182+
async def search_user_accounts(
183+
_query: Annotated[UserAccountSearchQueryParams, Depends()],
153184
):
154185
# NOTE: see `Search` in `Common Custom Methods` in https://cloud.google.com/apis/design/custom_methods
155186
...
156187

157188

158189
@router.post(
159-
"/admin/users:pre-register",
160-
response_model=Envelope[UserForAdminGet],
190+
"/admin/user-accounts:pre-register",
191+
response_model=Envelope[UserAccountGet],
161192
tags=_extra_tags,
162193
)
163-
async def pre_register_user_for_admin(_body: PreRegisteredUserGet): ...
194+
async def pre_register_user_account(_body: PreRegisteredUserGet): ...

api/tests/requirements.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,8 @@ pytest==8.3.5
8585
# pytest-cov
8686
# pytest-instafail
8787
# pytest-sugar
88-
pytest-asyncio==0.23.8
89-
# via
90-
# -c ../../requirements/constraints.txt
91-
# -r requirements.in
88+
pytest-asyncio==0.26.0
89+
# via -r requirements.in
9290
pytest-cov==6.0.0
9391
# via -r requirements.in
9492
pytest-instafail==0.5.0
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Prompt
2+
3+
```
4+
Please convert all pydantic model fields that use `Field()` with default values to use the Annotated pattern instead.
5+
Follow these guidelines:
6+
7+
1. Move default values outside of `Field()` like this: `field_name: Annotated[field_type, Field(description="")] = default_value`.
8+
2. Keep all other parameters like validation_alias and descriptions inside `Field()`.
9+
3. For fields using default_factory, keep that parameter as is in the `Field()` constructor, but set the default value outside to DEFAULT_FACTORY from common_library.basic_types. Example: `field_name: Annotated[dict_type, Field(default_factory=dict)] = DEFAULT_FACTORY`.
10+
4. Add the import: `from common_library.basic_types import DEFAULT_FACTORY` if it's not already present.
11+
5. If `Field()` has no parameters (empty), don't use Annotated at all. Just use: `field_name: field_type = default_value`.
12+
6. Leave any model validations, `model_config` settings, and `field_validators` untouched.
13+
```
14+
## Examples
15+
16+
### Before:
17+
18+
```python
19+
from pydantic import BaseModel, Field
20+
21+
class UserModel(BaseModel):
22+
name: str = Field(default="Anonymous", description="User's display name")
23+
age: int = Field(default=18, ge=0, lt=120)
24+
tags: list[str] = Field(default_factory=list, description="User tags")
25+
metadata: dict[str, str] = Field(default_factory=dict)
26+
is_active: bool = Field(default=True)
27+
```
28+
29+
- **After**
30+
31+
```python
32+
from typing import Annotated
33+
from pydantic import BaseModel, Field
34+
from common_library.basic_types import DEFAULT_FACTORY
35+
36+
class UserModel(BaseModel):
37+
name: Annotated[str, Field(description="User's display name")] = "Anonymous"
38+
age: Annotated[int, Field(ge=0, lt=120)] = 18
39+
tags: Annotated[list[str], Field(default_factory=list, description="User tags")] = DEFAULT_FACTORY
40+
metadata: Annotated[dict[str, str], Field(default_factory=dict)] = DEFAULT_FACTORY
41+
is_active: bool = True
42+
```
43+
44+
## Another Example with Complex Fields
45+
46+
### Before:
47+
48+
```python
49+
from pydantic import BaseModel, Field, field_validator
50+
from datetime import datetime
51+
52+
class ProjectModel(BaseModel):
53+
id: str = Field(default_factory=uuid.uuid4, description="Unique project identifier")
54+
name: str = Field(default="Untitled Project", min_length=3, max_length=50)
55+
created_at: datetime = Field(default_factory=datetime.now)
56+
config: dict = Field(default={"version": "1.0", "theme": "default"})
57+
58+
@field_validator("name")
59+
def validate_name(cls, v):
60+
if v.isdigit():
61+
raise ValueError("Name cannot be only digits")
62+
return v
63+
```
64+
65+
### After:
66+
67+
```python
68+
from typing import Annotated
69+
from pydantic import BaseModel, Field, field_validator
70+
from datetime import datetime
71+
from common_library.basic_types import DEFAULT_FACTORY
72+
73+
class ProjectModel(BaseModel):
74+
id: Annotated[str, Field(default_factory=uuid.uuid4, description="Unique project identifier")] = DEFAULT_FACTORY
75+
name: Annotated[str, Field(min_length=3, max_length=50)] = "Untitled Project"
76+
created_at: Annotated[datetime, Field(default_factory=datetime.now)] = DEFAULT_FACTORY
77+
config: dict = {"version": "1.0", "theme": "default"}
78+
79+
@field_validator("name")
80+
def validate_name(cls, v):
81+
if v.isdigit():
82+
raise ValueError("Name cannot be only digits")
83+
return v
84+
```

packages/aws-library/requirements/_base.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ opentelemetry-api==1.30.0
145145
# opentelemetry-exporter-otlp-proto-grpc
146146
# opentelemetry-exporter-otlp-proto-http
147147
# opentelemetry-instrumentation
148+
# opentelemetry-instrumentation-aio-pika
148149
# opentelemetry-instrumentation-botocore
149150
# opentelemetry-instrumentation-logging
150151
# opentelemetry-instrumentation-redis
@@ -164,10 +165,13 @@ opentelemetry-exporter-otlp-proto-http==1.30.0
164165
# via opentelemetry-exporter-otlp
165166
opentelemetry-instrumentation==0.51b0
166167
# via
168+
# opentelemetry-instrumentation-aio-pika
167169
# opentelemetry-instrumentation-botocore
168170
# opentelemetry-instrumentation-logging
169171
# opentelemetry-instrumentation-redis
170172
# opentelemetry-instrumentation-requests
173+
opentelemetry-instrumentation-aio-pika==0.51b0
174+
# via -r requirements/../../../packages/service-library/requirements/_base.in
171175
opentelemetry-instrumentation-botocore==0.51b0
172176
# via -r requirements/_base.in
173177
opentelemetry-instrumentation-logging==0.51b0
@@ -431,6 +435,7 @@ wrapt==1.17.2
431435
# aiobotocore
432436
# deprecated
433437
# opentelemetry-instrumentation
438+
# opentelemetry-instrumentation-aio-pika
434439
# opentelemetry-instrumentation-redis
435440
yarl==1.18.3
436441
# via

0 commit comments

Comments
 (0)