Skip to content

Commit 82c69d0

Browse files
authored
Merge pull request #6600 from sanderegg/update-branch
🎨Update from upstream/master
2 parents 3cf68ba + fb48eb1 commit 82c69d0

File tree

109 files changed

+1007
-752
lines changed

Some content is hidden

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

109 files changed

+1007
-752
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ops/
88
*.py[cod]
99

1010
# virtualenv
11-
.venv
11+
**/.venv
1212

1313
#python eggs
1414
**/*.egg-info

packages/aws-library/requirements/_base.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ email-validator==2.2.0
8585
# via pydantic
8686
fast-depends==2.4.12
8787
# via faststream
88-
faststream==0.5.23
88+
faststream==0.5.28
8989
# via -r requirements/../../../packages/service-library/requirements/_base.in
9090
frozenlist==1.4.1
9191
# via

packages/models-library/src/models_library/projects_state.py

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@
44

55
from enum import Enum, unique
66

7-
from pydantic import BaseModel, ConfigDict, Field, ValidationInfo, field_validator
7+
from pydantic import (
8+
BaseModel,
9+
ConfigDict,
10+
Field,
11+
ValidationInfo,
12+
field_validator,
13+
model_validator,
14+
)
815

916
from .projects_access import Owner
1017

@@ -56,12 +63,12 @@ class ProjectStatus(str, Enum):
5663

5764
class ProjectLocked(BaseModel):
5865
value: bool = Field(..., description="True if the project is locked")
66+
status: ProjectStatus = Field(..., description="The status of the project")
5967
owner: Owner | None = Field(
6068
default=None,
6169
description="If locked, the user that owns the lock",
6270
validate_default=True,
6371
)
64-
status: ProjectStatus = Field(..., description="The status of the project")
6572
model_config = ConfigDict(
6673
extra="forbid",
6774
use_enum_values=True,
@@ -81,15 +88,7 @@ class ProjectLocked(BaseModel):
8188
},
8289
)
8390

84-
@field_validator("owner", mode="before")
85-
@classmethod
86-
def check_not_null(cls, v, info: ValidationInfo):
87-
if info.data["value"] is True and v is None:
88-
msg = "value cannot be None when project is locked"
89-
raise ValueError(msg)
90-
return v
91-
92-
@field_validator("status")
91+
@field_validator("status", mode="after")
9392
@classmethod
9493
def check_status_compatible(cls, v, info: ValidationInfo):
9594
if info.data["value"] is False and v not in ["CLOSED", "OPENED"]:
@@ -100,6 +99,23 @@ def check_status_compatible(cls, v, info: ValidationInfo):
10099
raise ValueError(msg)
101100
return v
102101

102+
@model_validator(mode="before")
103+
@classmethod
104+
def check_owner_compatible(cls, values):
105+
if (
106+
values["value"] is True
107+
and values.get("owner") is None
108+
and values["status"]
109+
in [
110+
status.value
111+
for status in ProjectStatus
112+
if status != ProjectStatus.MAINTAINING
113+
]
114+
):
115+
msg = "Owner must be specified when the project is not in the 'MAINTAINING' status."
116+
raise ValueError(msg)
117+
return values
118+
103119

104120
class ProjectRunningState(BaseModel):
105121
value: RunningState = Field(

packages/models-library/tests/test_projects_state.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ def test_project_locked_with_missing_owner_raises():
88
ProjectLocked.model_validate({"value": False, "status": ProjectStatus.OPENED})
99

1010

11+
def test_project_locked_with_missing_owner_ok_during_maintaining():
12+
ProjectLocked.parse_obj({"value": True, "status": ProjectStatus.MAINTAINING})
13+
14+
1115
@pytest.mark.parametrize(
1216
"lock, status",
1317
[

packages/postgres-database/docker/Dockerfile

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# syntax=docker/dockerfile:1
2-
FROM python:3.6-slim AS base
2+
ARG PYTHON_VERSION="3.11.9"
3+
ARG UV_VERSION="0.4"
4+
FROM ghcr.io/astral-sh/uv:${UV_VERSION} AS uv_build
5+
# we docker image is built based on debian
6+
FROM python:${PYTHON_VERSION}-slim-bookworm AS base
37

48
LABEL maintainer=sanderegg
59

@@ -22,16 +26,14 @@ RUN apt-get update \
2226
&& apt-get clean \
2327
&& rm -rf /var/lib/apt/lists/*
2428

25-
# NOTE: install https://github.com/astral-sh/uv ultra-fast rust-based pip replacement
26-
RUN --mount=type=cache,mode=0755,target=/root/.cache/pip \
27-
pip install uv~=0.2
29+
# install UV https://docs.astral.sh/uv/guides/integration/docker/#installing-uv
30+
COPY --from=uv_build /uv /uvx /bin/
2831

2932
# NOTE: python virtualenv is used here such that installed packages may be moved to production image easily by copying the venv
3033
RUN uv venv "${VIRTUAL_ENV}"
3134

32-
RUN --mount=type=cache,mode=0755,target=/root/.cache/uv \
35+
RUN --mount=type=cache,target=/root/.cache/uv \
3336
uv pip install --upgrade \
34-
pip~=24.0 \
3537
wheel \
3638
setuptools
3739

@@ -44,6 +46,8 @@ RUN git clone --single-branch --branch ${GIT_BRANCH} ${GIT_REPOSITORY} osparc-si
4446
FROM base AS production
4547

4648
ENV PYTHONOPTIMIZE=TRUE
49+
# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode
50+
ENV UV_COMPILE_BYTECODE=1
4751

4852
WORKDIR /home/scu
4953
# ensure home folder is read/writable for user scu

packages/postgres-database/scripts/erd/Dockerfile

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# syntax=docker/dockerfile:1
2+
3+
# Define arguments in the global scope
24
ARG PYTHON_VERSION="3.11.9"
5+
ARG UV_VERSION="0.4"
6+
FROM ghcr.io/astral-sh/uv:${UV_VERSION} AS uv_build
7+
# we docker image is built based on debian
38
FROM python:${PYTHON_VERSION}-slim-bookworm AS base
49

510
RUN apt-get update \
@@ -15,15 +20,14 @@ RUN apt-get update \
1520
&& apt-get clean
1621

1722

18-
RUN --mount=type=cache,mode=0755,target=/root/.cache/pip \
19-
pip install --upgrade \
20-
pip~=24.0 \
23+
RUN --mount=type=cache,target=/root/.cache/uv \
24+
uv pip install --upgrade \
2125
wheel \
2226
setuptools
2327

2428

2529
# devenv
2630
COPY requirements.txt requirements.txt
27-
RUN --mount=type=cache,mode=0755,target=/root/.cache/pip \
28-
pip install \
29-
-r requirements.txt
31+
RUN --mount=type=cache,target=/root/.cache/uv \
32+
uv pip sync \
33+
requirements.txt

packages/service-integration/Dockerfile

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# syntax=docker/dockerfile:1
2+
3+
# Define arguments in the global scope
24
ARG PYTHON_VERSION="3.11.9"
5+
ARG UV_VERSION="0.4"
6+
FROM ghcr.io/astral-sh/uv:${UV_VERSION} AS uv_build
7+
# we docker image is built based on debian
38
FROM python:${PYTHON_VERSION}-slim-bookworm AS base
49

510
LABEL maintainer=pcrespov
@@ -38,12 +43,13 @@ ENV LANG=C.UTF-8
3843
# Turns off writing .pyc files; superfluous on an ephemeral container.
3944
ENV PYTHONDONTWRITEBYTECODE=1 \
4045
VIRTUAL_ENV=/home/scu/.venv
46+
# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode
47+
ENV UV_COMPILE_BYTECODE=1
4148

4249
# Ensures that the python and pip executables used
4350
# in the image will be those from our virtualenv.
4451
ENV PATH="${VIRTUAL_ENV}/bin:$PATH"
4552

46-
4753
# -------------------------- Build stage -------------------
4854

4955
FROM base AS build
@@ -55,15 +61,14 @@ RUN --mount=type=cache,target=/var/cache/apt,mode=0755,sharing=private \
5561
&& apt-get install -y --no-install-recommends \
5662
build-essential
5763

58-
# NOTE: install https://github.com/astral-sh/uv ultra-fast rust-based pip replacement
59-
RUN --mount=type=cache,mode=0755,target=/root/.cache/pip \
60-
pip install uv~=0.2
64+
# install UV https://docs.astral.sh/uv/guides/integration/docker/#installing-uv
65+
COPY --from=uv_build /uv /uvx /bin/
6166

6267
# NOTE: python virtualenv is used here such that installed
6368
# packages may be moved to production image easily by copying the venv
6469
RUN uv venv "${VIRTUAL_ENV}"
6570

66-
RUN --mount=type=cache,mode=0755,target=/root/.cache/uv \
71+
RUN --mount=type=cache,target=/root/.cache/uv \
6772
uv pip install --upgrade \
6873
pip~=24.0 \
6974
wheel \
@@ -74,7 +79,7 @@ WORKDIR /build/packages/service-integration
7479
RUN \
7580
--mount=type=bind,source=packages,target=/build/packages,rw \
7681
--mount=type=bind,source=packages/service-integration,target=/build/packages/service-integration,rw \
77-
--mount=type=cache,mode=0755,target=/root/.cache/uv \
82+
--mount=type=cache,target=/root/.cache/uv \
7883
uv pip install \
7984
--requirement requirements/prod.txt \
8085
&& uv pip list
@@ -86,8 +91,6 @@ FROM base AS development
8691
# NOTE: this is necessary to allow to build development images but is the same as production here
8792
FROM base AS production
8893

89-
ENV PYTHONOPTIMIZE=TRUE
90-
9194
WORKDIR /home/scu
9295
# ensure home folder is read/writable for user scu
9396
RUN chown -R scu /home/scu

packages/service-library/requirements/_base.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ email-validator==2.2.0
5757
# via pydantic
5858
fast-depends==2.4.12
5959
# via faststream
60-
faststream==0.5.23
60+
faststream==0.5.28
6161
# via -r requirements/_base.in
6262
frozenlist==1.4.1
6363
# via

packages/service-library/src/servicelib/deferred_tasks/_deferred_manager.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,9 @@ def __init__(
134134
ClassUniqueReference, type[BaseDeferredHandler]
135135
] = {}
136136

137-
self.broker: RabbitBroker = RabbitBroker(rabbit_settings.dsn)
137+
self.broker: RabbitBroker = RabbitBroker(
138+
rabbit_settings.dsn, log_level=logging.DEBUG
139+
)
138140
self.router: RabbitRouter = RabbitRouter()
139141

140142
# NOTE: do not move this to a function, must remain in constructor

packages/simcore-sdk/requirements/_base.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ email-validator==2.2.0
8383
# via pydantic
8484
fast-depends==2.4.12
8585
# via faststream
86-
faststream==0.5.23
86+
faststream==0.5.28
8787
# via -r requirements/../../../packages/service-library/requirements/_base.in
8888
flexcache==0.3
8989
# via pint

0 commit comments

Comments
 (0)