diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 89701508fbf..faa7597a371 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -13,6 +13,7 @@ Makefile @pcrespov @sanderegg /api/ @sanderegg @pcrespov @matusdrobuliak66 /ci/ @sanderegg @pcrespov /docs/ @pcrespov +/packages/common-library/ @giancarloromeo /packages/models-library/ @sanderegg @pcrespov @matusdrobuliak66 /packages/postgres-database/ @matusdrobuliak66 /packages/pytest-simcore/ @pcrespov @sanderegg diff --git a/.github/workflows/ci-testing-deploy.yml b/.github/workflows/ci-testing-deploy.yml index 1ec9dd55293..adbea2e8e41 100644 --- a/.github/workflows/ci-testing-deploy.yml +++ b/.github/workflows/ci-testing-deploy.yml @@ -54,6 +54,7 @@ jobs: aws-library: ${{ steps.filter.outputs.aws-library }} dask-task-models-library: ${{ steps.filter.outputs.dask-task-models-library }} models-library: ${{ steps.filter.outputs.models-library }} + common-library: ${{ steps.filter.outputs.common-library }} notifications-library: ${{ steps.filter.outputs.notifications-library }} postgres-database: ${{ steps.filter.outputs.postgres-database }} service-integration: ${{ steps.filter.outputs.service-integration }} @@ -110,6 +111,8 @@ jobs: - 'services/docker-compose*' - 'scripts/mypy/*' - 'mypy.ini' + common-library: + - 'packages/common-library/**' notifications-library: - 'packages/notifications-library/**' - 'packages/postgres-database/**' @@ -1593,6 +1596,47 @@ jobs: with: flags: unittests #optional + unit-test-common-library: + needs: changes + if: ${{ needs.changes.outputs.common-library == 'true' || github.event_name == 'push' }} + timeout-minutes: 18 # if this timeout gets too small, then split the tests + name: "[unit] common-library" + runs-on: ${{ matrix.os }} + strategy: + matrix: + python: ["3.11"] + os: [ubuntu-22.04] + fail-fast: false + steps: + - uses: actions/checkout@v4 + - name: setup docker buildx + id: buildx + uses: docker/setup-buildx-action@v3 + with: + driver: docker-container + - name: setup python environment + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} + - name: install uv + uses: yezz123/setup-uv@v4 + - uses: actions/cache@v4 + id: cache-uv + with: + path: ~/.cache/uv + key: ${{ runner.os }}-${{ github.job }}-python-${{ matrix.python }}-uv + - name: show system version + run: ./ci/helpers/show_system_versions.bash + - name: install + run: ./ci/github/unit-testing/common-library.bash install + - name: typecheck + run: ./ci/github/unit-testing/common-library.bash typecheck + - name: test + run: ./ci/github/unit-testing/common-library.bash test + - uses: codecov/codecov-action@v4.5.0 + with: + flags: unittests #optional + unit-test-notifications-library: needs: changes if: ${{ needs.changes.outputs.notifications-library == 'true' || github.event_name == 'push' }} @@ -1704,6 +1748,7 @@ jobs: unit-test-efs-guardian, unit-test-frontend, unit-test-models-library, + unit-test-common-library, unit-test-notifications-library, unit-test-osparc-gateway-server, unit-test-payments, diff --git a/ci/github/unit-testing/common-library.bash b/ci/github/unit-testing/common-library.bash new file mode 100755 index 00000000000..71547174103 --- /dev/null +++ b/ci/github/unit-testing/common-library.bash @@ -0,0 +1,43 @@ +#!/bin/bash +# http://redsymbol.net/articles/unofficial-bash-strict-mode/ +set -o errexit # abort on nonzero exitstatus +set -o nounset # abort on unbound variable +set -o pipefail # don't hide errors within pipes +IFS=$'\n\t' + +install() { + make devenv + # shellcheck source=/dev/null + source .venv/bin/activate + pushd packages/common-library + make install-ci + popd + uv pip list +} + +test() { + # shellcheck source=/dev/null + source .venv/bin/activate + pushd packages/common-library + make tests-ci + popd +} + +typecheck() { + # shellcheck source=/dev/null + source .venv/bin/activate + uv pip install mypy + pushd packages/common-library + make mypy + popd +} + +# Check if the function exists (bash specific) +if declare -f "$1" >/dev/null; then + # call arguments verbatim + "$@" +else + # Show a helpful error + echo "'$1' is not a known function name" >&2 + exit 1 +fi diff --git a/packages/aws-library/requirements/_base.in b/packages/aws-library/requirements/_base.in index 628cebcf110..d884806f703 100644 --- a/packages/aws-library/requirements/_base.in +++ b/packages/aws-library/requirements/_base.in @@ -2,6 +2,7 @@ # Specifies third-party dependencies for 'aws-library' # --constraint ../../../requirements/constraints.txt +--requirement ../../../packages/common-library/requirements/_base.in --requirement ../../../packages/models-library/requirements/_base.in --requirement ../../../packages/service-library/requirements/_base.in --requirement ../../../packages/settings-library/requirements/_base.in diff --git a/packages/common-library/.gitignore b/packages/common-library/.gitignore new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/common-library/Makefile b/packages/common-library/Makefile new file mode 100644 index 00000000000..b554ec6f9c0 --- /dev/null +++ b/packages/common-library/Makefile @@ -0,0 +1,49 @@ +# +# Targets for DEVELOPMENT of common Library +# +include ../../scripts/common.Makefile +include ../../scripts/common-package.Makefile + +.PHONY: requirements +requirements: ## compiles pip requirements (.in -> .txt) + @$(MAKE_C) requirements reqs + + +.PHONY: install-dev install-prod install-ci +install-dev install-prod install-ci: _check_venv_active ## install app in development/production or CI mode + # installing in $(subst install-,,$@) mode + @uv pip sync requirements/$(subst install-,,$@).txt + + +.PHONY: tests tests-ci +tests: ## runs unit tests + # running unit tests + @pytest \ + --asyncio-mode=auto \ + --color=yes \ + --cov-config=../../.coveragerc \ + --cov-report=term-missing \ + --cov=common_library \ + --durations=10 \ + --exitfirst \ + --failed-first \ + --pdb \ + -vv \ + $(CURDIR)/tests + +tests-ci: ## runs unit tests [ci-mode] + # running unit tests + @pytest \ + --asyncio-mode=auto \ + --color=yes \ + --cov-append \ + --cov-config=../../.coveragerc \ + --cov-report=term-missing \ + --cov-report=xml \ + --cov=common_library \ + --durations=10 \ + --log-date-format="%Y-%m-%d %H:%M:%S" \ + --log-format="%(asctime)s %(levelname)s %(message)s" \ + --verbose \ + -m "not heavy_load" \ + $(CURDIR)/tests diff --git a/packages/common-library/README.md b/packages/common-library/README.md new file mode 100644 index 00000000000..8e5c489787b --- /dev/null +++ b/packages/common-library/README.md @@ -0,0 +1,42 @@ +# simcore pydantic common library + +Contains the common classes, functions and in general utilities for use in the simcore platform. + +## Installation + +```console +make help +make install-dev +``` + +## Test + +```console +make help +make test-dev +``` + + +## Diagnostics + +How run diagnostics on the service metadata published in a docker registry? + +1. Setup environment +```bash +make devenv +source .venv/bin/activate + +cd packages/common-library +make install-dev +``` +2. Set ``REGISTRY_*`` env vars in ``.env`` (in the repository base folder) +3. Download test data, run diagnostics, archive tests-data, and cleanup +```bash +export DEPLOY_NAME=my-deploy + +make pull_test_data >$DEPLOY_NAME-registry-diagnostics.log 2>&1 +pytest -vv -m diagnostics >>$DEPLOY_NAME-registry-diagnostics.log 2>&1 +zip -r $DEPLOY_NAME-registry-test-data.zip tests/data/.downloaded-ignore +rm -r tests/data/.downloaded-ignore +``` +4. Move all ``$DEPLOY_NAME-*`` files to an archive diff --git a/packages/common-library/VERSION b/packages/common-library/VERSION new file mode 100644 index 00000000000..6e8bf73aa55 --- /dev/null +++ b/packages/common-library/VERSION @@ -0,0 +1 @@ +0.1.0 diff --git a/packages/common-library/requirements/Makefile b/packages/common-library/requirements/Makefile new file mode 100644 index 00000000000..3f25442b790 --- /dev/null +++ b/packages/common-library/requirements/Makefile @@ -0,0 +1,6 @@ +# +# Targets to pip-compile requirements +# +include ../../../requirements/base.Makefile + +# Add here any extra explicit dependency: e.g. _migration.txt: _base.txt diff --git a/packages/common-library/requirements/_base.in b/packages/common-library/requirements/_base.in new file mode 100644 index 00000000000..73cc02bceb7 --- /dev/null +++ b/packages/common-library/requirements/_base.in @@ -0,0 +1,6 @@ +# +# Specifies third-party dependencies for 'common-library' +# +--constraint ../../../requirements/constraints.txt + +pydantic diff --git a/packages/common-library/requirements/_base.txt b/packages/common-library/requirements/_base.txt new file mode 100644 index 00000000000..32a8575abea --- /dev/null +++ b/packages/common-library/requirements/_base.txt @@ -0,0 +1,12 @@ +annotated-types==0.7.0 + # via pydantic +pydantic==2.9.2 + # via + # -c requirements/../../../requirements/constraints.txt + # -r requirements/_base.in +pydantic-core==2.23.4 + # via pydantic +typing-extensions==4.12.2 + # via + # pydantic + # pydantic-core diff --git a/packages/common-library/requirements/_test.in b/packages/common-library/requirements/_test.in new file mode 100644 index 00000000000..4454d79d36a --- /dev/null +++ b/packages/common-library/requirements/_test.in @@ -0,0 +1,21 @@ +# +# Specifies dependencies required to run 'common-library' +# +--constraint ../../../requirements/constraints.txt + +# Adds base AS CONSTRAINT specs, not requirement. +# - Resulting _text.txt is a frozen list of EXTRA packages for testing, besides _base.txt +# +--constraint _base.txt + +coverage +faker +pytest +pytest-asyncio +pytest-cov +pytest-icdiff +pytest-instafail +pytest-mock +pytest-runner +pytest-sugar +python-dotenv diff --git a/packages/common-library/requirements/_test.txt b/packages/common-library/requirements/_test.txt new file mode 100644 index 00000000000..2354abd790d --- /dev/null +++ b/packages/common-library/requirements/_test.txt @@ -0,0 +1,55 @@ +coverage==7.6.1 + # via + # -r requirements/_test.in + # pytest-cov +faker==30.1.0 + # via -r requirements/_test.in +icdiff==2.0.7 + # via pytest-icdiff +iniconfig==2.0.0 + # via pytest +packaging==24.1 + # via + # pytest + # pytest-sugar +pluggy==1.5.0 + # via pytest +pprintpp==0.4.0 + # via pytest-icdiff +pytest==8.3.3 + # via + # -r requirements/_test.in + # pytest-asyncio + # pytest-cov + # pytest-icdiff + # pytest-instafail + # pytest-mock + # pytest-sugar +pytest-asyncio==0.23.8 + # via + # -c requirements/../../../requirements/constraints.txt + # -r requirements/_test.in +pytest-cov==5.0.0 + # via -r requirements/_test.in +pytest-icdiff==0.9 + # via -r requirements/_test.in +pytest-instafail==0.5.0 + # via -r requirements/_test.in +pytest-mock==3.14.0 + # via -r requirements/_test.in +pytest-runner==6.0.1 + # via -r requirements/_test.in +pytest-sugar==1.0.0 + # via -r requirements/_test.in +python-dateutil==2.9.0.post0 + # via faker +python-dotenv==1.0.1 + # via -r requirements/_test.in +six==1.16.0 + # via python-dateutil +termcolor==2.5.0 + # via pytest-sugar +typing-extensions==4.12.2 + # via + # -c requirements/_base.txt + # faker diff --git a/packages/common-library/requirements/_tools.in b/packages/common-library/requirements/_tools.in new file mode 100644 index 00000000000..1def82c12a3 --- /dev/null +++ b/packages/common-library/requirements/_tools.in @@ -0,0 +1,5 @@ +--constraint ../../../requirements/constraints.txt +--constraint _base.txt +--constraint _test.txt + +--requirement ../../../requirements/devenv.txt diff --git a/packages/common-library/requirements/_tools.txt b/packages/common-library/requirements/_tools.txt new file mode 100644 index 00000000000..a333bb822ae --- /dev/null +++ b/packages/common-library/requirements/_tools.txt @@ -0,0 +1,79 @@ +astroid==3.3.5 + # via pylint +black==24.8.0 + # via -r requirements/../../../requirements/devenv.txt +build==1.2.2.post1 + # via pip-tools +bump2version==1.0.1 + # via -r requirements/../../../requirements/devenv.txt +cfgv==3.4.0 + # via pre-commit +click==8.1.7 + # via + # black + # pip-tools +dill==0.3.9 + # via pylint +distlib==0.3.8 + # via virtualenv +filelock==3.16.1 + # via virtualenv +identify==2.6.1 + # via pre-commit +isort==5.13.2 + # via + # -r requirements/../../../requirements/devenv.txt + # pylint +mccabe==0.7.0 + # via pylint +mypy==1.11.2 + # via -r requirements/../../../requirements/devenv.txt +mypy-extensions==1.0.0 + # via + # black + # mypy +nodeenv==1.9.1 + # via pre-commit +packaging==24.1 + # via + # -c requirements/_test.txt + # black + # build +pathspec==0.12.1 + # via black +pip==24.2 + # via pip-tools +pip-tools==7.4.1 + # via -r requirements/../../../requirements/devenv.txt +platformdirs==4.3.6 + # via + # black + # pylint + # virtualenv +pre-commit==4.0.0 + # via -r requirements/../../../requirements/devenv.txt +pylint==3.3.1 + # via -r requirements/../../../requirements/devenv.txt +pyproject-hooks==1.2.0 + # via + # build + # pip-tools +pyyaml==6.0.2 + # via + # -c requirements/../../../requirements/constraints.txt + # pre-commit +ruff==0.6.9 + # via -r requirements/../../../requirements/devenv.txt +setuptools==75.1.0 + # via pip-tools +tomlkit==0.13.2 + # via pylint +typing-extensions==4.12.2 + # via + # -c requirements/_base.txt + # -c requirements/_test.txt + # mypy +virtualenv==20.26.6 + # via pre-commit +wheel==0.44.0 + # via pip-tools diff --git a/packages/common-library/requirements/ci.txt b/packages/common-library/requirements/ci.txt new file mode 100644 index 00000000000..ed9eb3028e8 --- /dev/null +++ b/packages/common-library/requirements/ci.txt @@ -0,0 +1,17 @@ +# Shortcut to install all packages for the contigous integration (CI) of 'common-library' +# +# - As ci.txt but w/ tests +# +# Usage: +# pip install -r requirements/ci.txt +# + +# installs base + tests requirements +--requirement _base.txt +--requirement _test.txt + +# installs this repo's packages +pytest-simcore @ ../pytest-simcore + +# current module +simcore-common-library @ . diff --git a/packages/common-library/requirements/dev.txt b/packages/common-library/requirements/dev.txt new file mode 100644 index 00000000000..02718f95c3a --- /dev/null +++ b/packages/common-library/requirements/dev.txt @@ -0,0 +1,18 @@ +# Shortcut to install all packages needed to develop 'common-library' +# +# - As ci.txt but with current and repo packages in develop (edit) mode +# +# Usage: +# pip install -r requirements/dev.txt +# + +# installs base + tests requirements +--requirement _base.txt +--requirement _test.txt +--requirement _tools.txt + +# installs this repo's packages +--editable ../pytest-simcore/ + +# current module +--editable . diff --git a/packages/common-library/setup.cfg b/packages/common-library/setup.cfg new file mode 100644 index 00000000000..b33be52008a --- /dev/null +++ b/packages/common-library/setup.cfg @@ -0,0 +1,24 @@ +[bumpversion] +current_version = 0.2.0 +commit = True +message = packages/common-library version: {current_version} → {new_version} +tag = False +commit_args = --no-verify + +[bumpversion:file:VERSION] + +[bdist_wheel] +universal = 1 + +[aliases] +test = pytest + +[tool:pytest] +asyncio_mode = auto +markers = + diagnostics: "can be used to run diagnostics against deployed data (e.g. database, registry etc)" + testit: "marks test to run during development" + +[mypy] +plugins = + pydantic.mypy diff --git a/packages/common-library/setup.py b/packages/common-library/setup.py new file mode 100644 index 00000000000..4e381f5bbc2 --- /dev/null +++ b/packages/common-library/setup.py @@ -0,0 +1,60 @@ +import re +import sys +from pathlib import Path + +from setuptools import find_packages, setup + + +def read_reqs(reqs_path: Path) -> set[str]: + return { + r + for r in re.findall( + r"(^[^#\n-][\w\[,\]]+[-~>=<.\w]*)", + reqs_path.read_text(), + re.MULTILINE, + ) + if isinstance(r, str) + } + + +CURRENT_DIR = Path(sys.argv[0] if __name__ == "__main__" else __file__).resolve().parent + + +INSTALL_REQUIREMENTS = tuple( + read_reqs(CURRENT_DIR / "requirements" / "_base.in") +) # WEAK requirements + +TEST_REQUIREMENTS = tuple( + read_reqs(CURRENT_DIR / "requirements" / "_test.txt") +) # STRICK requirements + + +SETUP = { + "name": "simcore-common-library", + "version": Path(CURRENT_DIR / "VERSION").read_text().strip(), + "author": "Giancarlo Romeo (giancarloromeo)", + "description": "Core service library for simcore pydantic common", + "python_requires": "~=3.11", + "classifiers": [ + "Development Status :: 2 - Pre-Alpha", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Natural Language :: English", + "Programming Language :: Python :: 3.11", + ], + "long_description": Path(CURRENT_DIR / "README.md").read_text(), + "license": "MIT license", + "install_requires": INSTALL_REQUIREMENTS, + "packages": find_packages(where="src"), + "package_data": {"": ["py.typed"]}, + "package_dir": {"": "src"}, + "include_package_data": True, + "test_suite": "tests", + "tests_require": TEST_REQUIREMENTS, + "extras_require": {"test": TEST_REQUIREMENTS}, + "zip_safe": False, +} + + +if __name__ == "__main__": + setup(**SETUP) diff --git a/packages/common-library/src/common_library/__init__.py b/packages/common-library/src/common_library/__init__.py new file mode 100644 index 00000000000..dc0c65ff721 --- /dev/null +++ b/packages/common-library/src/common_library/__init__.py @@ -0,0 +1,12 @@ +""" osparc's service common library + +""" + +# +# NOTE: +# - "examples" = [ ...] keyword and NOT "example". See https://json-schema.org/understanding-json-schema/reference/generic.html#annotations +# + +from importlib.metadata import version + +__version__: str = version("simcore-common-library") diff --git a/packages/models-library/src/models_library/errors_classes.py b/packages/common-library/src/common_library/errors_classes.py similarity index 89% rename from packages/models-library/src/models_library/errors_classes.py rename to packages/common-library/src/common_library/errors_classes.py index 6f6d9e0c266..1438536d550 100644 --- a/packages/models-library/src/models_library/errors_classes.py +++ b/packages/common-library/src/common_library/errors_classes.py @@ -7,16 +7,17 @@ def __missing__(self, key): class OsparcErrorMixin(PydanticErrorMixin): + code: str # type: ignore[assignment] msg_template: str def __new__(cls, *_args, **_kwargs): if not hasattr(cls, "code"): - cls.code = cls._get_full_class_name() # type: ignore[assignment] + cls.code = cls._get_full_class_name() return super().__new__(cls) def __init__(self, *_args, **kwargs) -> None: self.__dict__ = kwargs - super().__init__(message=self._build_message(), code=self.code) + super().__init__(message=self._build_message(), code=self.code) # type: ignore[arg-type] def __str__(self) -> str: return self._build_message() diff --git a/packages/common-library/src/common_library/py.typed b/packages/common-library/src/common_library/py.typed new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/common-library/src/common_library/pydantic_fields_extension.py b/packages/common-library/src/common_library/pydantic_fields_extension.py new file mode 100644 index 00000000000..f2f6d59a5f4 --- /dev/null +++ b/packages/common-library/src/common_library/pydantic_fields_extension.py @@ -0,0 +1,22 @@ +from types import UnionType +from typing import Any, Literal, get_args, get_origin + +from pydantic.fields import FieldInfo + + +def get_type(info: FieldInfo) -> Any: + field_type = info.annotation + if args := get_args(info.annotation): + field_type = next(a for a in args if a != type(None)) + return field_type + + +def is_literal(info: FieldInfo) -> bool: + return get_origin(info.annotation) is Literal + + +def is_nullable(info: FieldInfo) -> bool: + origin = get_origin(info.annotation) # X | None or Optional[X] will return Union + if origin is UnionType: + return any(x in get_args(info.annotation) for x in (type(None), Any)) + return False diff --git a/packages/common-library/src/common_library/pydantic_networks_extension.py b/packages/common-library/src/common_library/pydantic_networks_extension.py new file mode 100644 index 00000000000..b53a2bfc8ae --- /dev/null +++ b/packages/common-library/src/common_library/pydantic_networks_extension.py @@ -0,0 +1,5 @@ +from typing import Annotated, TypeAlias +from pydantic import AfterValidator, AnyHttpUrl + + +AnyHttpUrlLegacy: TypeAlias = Annotated[str, AnyHttpUrl, AfterValidator(lambda u: u.rstrip("/"))] diff --git a/packages/common-library/src/common_library/serialization.py b/packages/common-library/src/common_library/serialization.py new file mode 100644 index 00000000000..510bdf6a469 --- /dev/null +++ b/packages/common-library/src/common_library/serialization.py @@ -0,0 +1,32 @@ +from typing import Any + +from common_library.pydantic_fields_extension import get_type +from pydantic import BaseModel, SecretStr + + +def model_dump_with_secrets( + settings_obj: BaseModel, show_secrets: bool, **pydantic_export_options +) -> dict[str, Any]: + data = settings_obj.model_dump(**pydantic_export_options) + + for field_name in settings_obj.model_fields: + if field_name not in data: + continue + + field_data = data[field_name] + + if isinstance(field_data, SecretStr): + if show_secrets: + data[field_name] = field_data.get_secret_value() + else: + data[field_name] = str(field_data) + elif isinstance(field_data, dict): + field_type = get_type(settings_obj.model_fields[field_name]) + if issubclass(field_type, BaseModel): + data[field_name] = model_dump_with_secrets( + field_type.model_validate(field_data), + show_secrets, + **pydantic_export_options, + ) + + return data diff --git a/packages/common-library/tests/conftest.py b/packages/common-library/tests/conftest.py new file mode 100644 index 00000000000..46f09f86b46 --- /dev/null +++ b/packages/common-library/tests/conftest.py @@ -0,0 +1,33 @@ +# pylint: disable=redefined-outer-name +# pylint: disable=unused-argument +# pylint: disable=unused-import + +import sys +from pathlib import Path + +import common_library +import pytest + +pytest_plugins = [ + "pytest_simcore.pydantic_models", + "pytest_simcore.pytest_global_environs", + "pytest_simcore.repository_paths", + "pytest_simcore.schemas", +] + +CURRENT_DIR = Path(sys.argv[0] if __name__ == "__main__" else __file__).resolve().parent + + +@pytest.fixture(scope="session") +def package_dir(): + pdir = Path(common_library.__file__).resolve().parent + assert pdir.exists() + return pdir + + +@pytest.fixture(scope="session") +def project_slug_dir() -> Path: + folder = CURRENT_DIR.parent + assert folder.exists() + assert any(folder.glob("src/common_library")) + return folder diff --git a/packages/models-library/tests/test_errors_classes.py b/packages/common-library/tests/test_errors_classes.py similarity index 98% rename from packages/models-library/tests/test_errors_classes.py rename to packages/common-library/tests/test_errors_classes.py index 754367805e2..ae0ed8c1e3d 100644 --- a/packages/models-library/tests/test_errors_classes.py +++ b/packages/common-library/tests/test_errors_classes.py @@ -9,7 +9,7 @@ from typing import Any import pytest -from models_library.errors_classes import OsparcErrorMixin +from common_library.errors_classes import OsparcErrorMixin def test_get_full_class_name(): diff --git a/packages/common-library/tests/test_pydantic_fields_extension.py b/packages/common-library/tests/test_pydantic_fields_extension.py new file mode 100644 index 00000000000..50ff5443c41 --- /dev/null +++ b/packages/common-library/tests/test_pydantic_fields_extension.py @@ -0,0 +1,72 @@ +from typing import Literal + +import pytest +from common_library.pydantic_fields_extension import get_type, is_literal, is_nullable +from pydantic import BaseModel, Field + + +class MyModel(BaseModel): + a: int + b: float | None = Field(...) + c: str = "bla" + d: bool | None = None + e: Literal["bla"] + + +@pytest.mark.parametrize( + "fn,expected,name", + [ + ( + get_type, + int, + "a", + ), + ( + get_type, + float, + "b", + ), + ( + get_type, + str, + "c", + ), + (get_type, bool, "d"), + ( + is_literal, + False, + "a", + ), + ( + is_literal, + False, + "b", + ), + ( + is_literal, + False, + "c", + ), + (is_literal, False, "d"), + (is_literal, True, "e"), + ( + is_nullable, + False, + "a", + ), + ( + is_nullable, + True, + "b", + ), + ( + is_nullable, + False, + "c", + ), + (is_nullable, True, "d"), + (is_nullable, False, "e"), + ], +) +def test_field_fn(fn, expected, name): + assert expected == fn(MyModel.model_fields[name]) diff --git a/packages/common-library/tests/test_pydantic_networks_extension.py b/packages/common-library/tests/test_pydantic_networks_extension.py new file mode 100644 index 00000000000..3390f7c2acf --- /dev/null +++ b/packages/common-library/tests/test_pydantic_networks_extension.py @@ -0,0 +1,20 @@ +from common_library.pydantic_networks_extension import AnyHttpUrlLegacy +from pydantic import AnyHttpUrl, TypeAdapter +from pydantic_core import Url + + +def test_any_http_url(): + url = TypeAdapter(AnyHttpUrl).validate_python( + "http://backgroud.testserver.io", + ) + + assert isinstance(url, Url) + assert f"{url}" == "http://backgroud.testserver.io/" # NOTE: trailing '/' added in Pydantic v2 + +def test_any_http_url_legacy(): + url = TypeAdapter(AnyHttpUrlLegacy).validate_python( + "http://backgroud.testserver.io", + ) + + assert isinstance(url, str) + assert url == "http://backgroud.testserver.io" diff --git a/packages/common-library/tests/test_serialization.py b/packages/common-library/tests/test_serialization.py new file mode 100644 index 00000000000..d53db58809c --- /dev/null +++ b/packages/common-library/tests/test_serialization.py @@ -0,0 +1,30 @@ +from typing import Final + +import pytest +from common_library.serialization import model_dump_with_secrets +from pydantic import BaseModel, SecretStr + + +class Credentials(BaseModel): + USERNAME: str | None = None + PASSWORD: SecretStr | None = None + + +ME: Final[Credentials] = Credentials(USERNAME="DeepThought", PASSWORD=SecretStr("42")) + + +@pytest.mark.parametrize( + "expected,show_secrets", + [ + ( + {"USERNAME": "DeepThought", "PASSWORD": "42"}, + True, + ), + ( + {"USERNAME": "DeepThought", "PASSWORD": "**********"}, + False, # hide secrets + ), + ], +) +def test_model_dump_with_secrets(expected: dict, show_secrets: bool): + assert expected == model_dump_with_secrets(ME, show_secrets=show_secrets) diff --git a/packages/dask-task-models-library/requirements/_base.in b/packages/dask-task-models-library/requirements/_base.in index 3cdef671c4b..f25da08947b 100644 --- a/packages/dask-task-models-library/requirements/_base.in +++ b/packages/dask-task-models-library/requirements/_base.in @@ -2,6 +2,7 @@ # Specifies third-party dependencies for 'dask-task-models-library' # --constraint ../../../requirements/constraints.txt +--requirement ../../../packages/common-library/requirements/_base.in --requirement ../../../packages/models-library/requirements/_base.in --requirement ../../../packages/settings-library/requirements/_base.in diff --git a/packages/dask-task-models-library/requirements/ci.txt b/packages/dask-task-models-library/requirements/ci.txt index 3e0c9323517..c8775e00d91 100644 --- a/packages/dask-task-models-library/requirements/ci.txt +++ b/packages/dask-task-models-library/requirements/ci.txt @@ -12,6 +12,7 @@ # installs this repo's packages pytest-simcore @ ../pytest-simcore +simcore-common-library @ ../common-library simcore-models-library @ ../models-library simcore-settings-library @ ../settings-library/ diff --git a/packages/dask-task-models-library/requirements/dev.txt b/packages/dask-task-models-library/requirements/dev.txt index 0edd20961ac..a9d9555b2e8 100644 --- a/packages/dask-task-models-library/requirements/dev.txt +++ b/packages/dask-task-models-library/requirements/dev.txt @@ -13,6 +13,7 @@ # installs this repo's packages --editable ../pytest-simcore/ +--editable ../common-library/ --editable ../models-library/ --editable ../settings-library/ diff --git a/packages/models-library/requirements/_base.in b/packages/models-library/requirements/_base.in index e2f8eae097a..b33d20bdd6b 100644 --- a/packages/models-library/requirements/_base.in +++ b/packages/models-library/requirements/_base.in @@ -2,6 +2,7 @@ # Specifies third-party dependencies for 'models-library' # --constraint ../../../requirements/constraints.txt +--requirement ../../../packages/common-library/requirements/_base.in arrow jsonschema diff --git a/packages/models-library/requirements/ci.txt b/packages/models-library/requirements/ci.txt index e8e9fd2aeab..caaa0bb1b31 100644 --- a/packages/models-library/requirements/ci.txt +++ b/packages/models-library/requirements/ci.txt @@ -11,6 +11,7 @@ --requirement _test.txt # installs this repo's packages +simcore-common-library @ ../common-library simcore-postgres-database[migration] @ ../postgres-database/ pytest-simcore @ ../pytest-simcore diff --git a/packages/models-library/requirements/dev.txt b/packages/models-library/requirements/dev.txt index 901530f3644..e8372a6f3f6 100644 --- a/packages/models-library/requirements/dev.txt +++ b/packages/models-library/requirements/dev.txt @@ -12,6 +12,7 @@ --requirement _tools.txt # installs this repo's packages +--editable ../common-library/ --editable ../postgres-database/[migration] --editable ../pytest-simcore/ diff --git a/packages/models-library/src/models_library/osparc_variable_identifier.py b/packages/models-library/src/models_library/osparc_variable_identifier.py index a4b0d4e882b..80a8e6d0fc0 100644 --- a/packages/models-library/src/models_library/osparc_variable_identifier.py +++ b/packages/models-library/src/models_library/osparc_variable_identifier.py @@ -1,8 +1,9 @@ from copy import deepcopy from typing import Any, TypeVar +from common_library.errors_classes import OsparcErrorMixin from models_library.basic_types import ConstrainedStr -from models_library.errors_classes import OsparcErrorMixin + from pydantic import BaseModel from .utils.string_substitution import OSPARC_IDENTIFIER_PREFIX diff --git a/packages/models-library/src/models_library/utils/specs_substitution.py b/packages/models-library/src/models_library/utils/specs_substitution.py index 73260237b22..d8a7e9cf161 100644 --- a/packages/models-library/src/models_library/utils/specs_substitution.py +++ b/packages/models-library/src/models_library/utils/specs_substitution.py @@ -1,6 +1,7 @@ from typing import Any, NamedTuple, TypeAlias, cast -from models_library.errors_classes import OsparcErrorMixin +from common_library.errors_classes import OsparcErrorMixin + from pydantic import StrictBool, StrictFloat, StrictInt from .json_serialization import json_dumps, json_loads diff --git a/packages/notifications-library/requirements/_base.in b/packages/notifications-library/requirements/_base.in index 4879a9d6fb6..047005b4a39 100644 --- a/packages/notifications-library/requirements/_base.in +++ b/packages/notifications-library/requirements/_base.in @@ -2,6 +2,7 @@ # Specifies third-party dependencies for 'notifications-library' # --constraint ../../../requirements/constraints.txt +--requirement ../../../packages/common-library/requirements/_base.in --requirement ../../../packages/models-library/requirements/_base.in --requirement ../../../packages/postgres-database/requirements/_base.in --requirement ../../../packages/settings-library/requirements/_base.in diff --git a/packages/notifications-library/requirements/ci.txt b/packages/notifications-library/requirements/ci.txt index 2ac189e1a32..3432db2c649 100644 --- a/packages/notifications-library/requirements/ci.txt +++ b/packages/notifications-library/requirements/ci.txt @@ -11,6 +11,7 @@ --requirement _test.txt # installs this repo's packages +simcore-common-library @ ../common-library/ simcore-models-library @ ../models-library/ simcore-postgres-database @ ../postgres-database/ pytest-simcore @ ../pytest-simcore/ diff --git a/packages/notifications-library/requirements/dev.txt b/packages/notifications-library/requirements/dev.txt index 723de763080..0a010051348 100644 --- a/packages/notifications-library/requirements/dev.txt +++ b/packages/notifications-library/requirements/dev.txt @@ -12,6 +12,7 @@ --requirement _tools.txt # installs this repo's packages +--editable ../common-library/ --editable ../models-library/ --editable ../postgres-database/ --editable ../pytest-simcore/ diff --git a/packages/notifications-library/src/notifications_library/errors.py b/packages/notifications-library/src/notifications_library/errors.py index 2ffaa461a02..21edbbb0dc7 100644 --- a/packages/notifications-library/src/notifications_library/errors.py +++ b/packages/notifications-library/src/notifications_library/errors.py @@ -1,6 +1,6 @@ from typing import Any -from models_library.errors_classes import OsparcErrorMixin +from common_library.errors_classes import OsparcErrorMixin class NotifierError(OsparcErrorMixin, Exception): diff --git a/packages/service-integration/requirements/_base.in b/packages/service-integration/requirements/_base.in index fee8aa856e2..dc7e5dd4a6c 100644 --- a/packages/service-integration/requirements/_base.in +++ b/packages/service-integration/requirements/_base.in @@ -3,6 +3,7 @@ # --constraint ../../../requirements/constraints.txt +--requirement ../../../packages/common-library/requirements/_base.in --requirement ../../../packages/models-library/requirements/_base.in click diff --git a/packages/service-integration/requirements/ci.txt b/packages/service-integration/requirements/ci.txt index 9b4e9f16e2b..46a2035bfc7 100644 --- a/packages/service-integration/requirements/ci.txt +++ b/packages/service-integration/requirements/ci.txt @@ -10,6 +10,7 @@ --requirement _base.txt --requirement _test.txt +simcore-common-library @ ../common-library simcore-models-library @ ../models-library pytest-simcore @ ../pytest-simcore diff --git a/packages/service-integration/requirements/dev.txt b/packages/service-integration/requirements/dev.txt index 9e2af0f7124..bbe3d832532 100644 --- a/packages/service-integration/requirements/dev.txt +++ b/packages/service-integration/requirements/dev.txt @@ -11,6 +11,7 @@ --requirement _test.txt --requirement _tools.txt +--editable ../common-library/ --editable ../models-library/ --editable ../pytest-simcore/ diff --git a/packages/service-library/requirements/_base.in b/packages/service-library/requirements/_base.in index b806af36443..e0e928cee52 100644 --- a/packages/service-library/requirements/_base.in +++ b/packages/service-library/requirements/_base.in @@ -5,6 +5,7 @@ --constraint ./constraints.txt # intra-repo required dependencies +--requirement ../../../packages/common-library/requirements/_base.in --requirement ../../../packages/models-library/requirements/_base.in --requirement ../../../packages/settings-library/requirements/_base.in diff --git a/packages/service-library/requirements/ci.txt b/packages/service-library/requirements/ci.txt index 4d4dea58c9f..b26845819f4 100644 --- a/packages/service-library/requirements/ci.txt +++ b/packages/service-library/requirements/ci.txt @@ -11,6 +11,7 @@ --requirement _test.txt # installs this repo's packages +simcore-common-library @ ../common-library simcore-models-library @ ../models-library simcore-settings-library @ ../settings-library/ pytest-simcore @ ../pytest-simcore diff --git a/packages/service-library/requirements/ci[aiohttp].txt b/packages/service-library/requirements/ci[aiohttp].txt index 721950755b5..ee41e3b69a6 100644 --- a/packages/service-library/requirements/ci[aiohttp].txt +++ b/packages/service-library/requirements/ci[aiohttp].txt @@ -12,6 +12,7 @@ --requirement _test.txt # installs this repo's packages +simcore-common-library @ ../common-library simcore-models-library @ ../models-library simcore-settings-library @ ../settings-library/ pytest-simcore @ ../pytest-simcore diff --git a/packages/service-library/requirements/ci[all].txt b/packages/service-library/requirements/ci[all].txt index f7610e97111..f43ee95908f 100644 --- a/packages/service-library/requirements/ci[all].txt +++ b/packages/service-library/requirements/ci[all].txt @@ -13,6 +13,7 @@ --requirement _test.txt # installs this repo's packages +simcore-common-library @ ../common-library simcore-models-library @ ../models-library simcore-settings-library @ ../settings-library/ pytest-simcore @ ../pytest-simcore diff --git a/packages/service-library/requirements/ci[fastapi].txt b/packages/service-library/requirements/ci[fastapi].txt index c2c337fd4c0..db051f4ef73 100644 --- a/packages/service-library/requirements/ci[fastapi].txt +++ b/packages/service-library/requirements/ci[fastapi].txt @@ -12,6 +12,7 @@ --requirement _test.txt # installs this repo's packages +simcore-common-library @ ../common-library simcore-models-library @ ../models-library simcore-settings-library @ ../settings-library/ pytest-simcore @ ../pytest-simcore diff --git a/packages/service-library/requirements/dev.txt b/packages/service-library/requirements/dev.txt index b4da8c10382..f814830c46b 100644 --- a/packages/service-library/requirements/dev.txt +++ b/packages/service-library/requirements/dev.txt @@ -12,6 +12,7 @@ --requirement _tools.txt # installs this repo's packages +--editable ../common-library --editable ../models-library --editable ../settings-library --editable ../pytest-simcore diff --git a/packages/service-library/requirements/dev[aiohttp].txt b/packages/service-library/requirements/dev[aiohttp].txt index 5e0ae847c64..87748e35d29 100644 --- a/packages/service-library/requirements/dev[aiohttp].txt +++ b/packages/service-library/requirements/dev[aiohttp].txt @@ -13,6 +13,7 @@ --requirement _tools.txt # installs this repo's packages +--editable ../common-library --editable ../models-library/ --editable ../settings-library/ --editable ../pytest-simcore/ diff --git a/packages/service-library/requirements/dev[all].txt b/packages/service-library/requirements/dev[all].txt index b372254b325..8b23b6105c5 100644 --- a/packages/service-library/requirements/dev[all].txt +++ b/packages/service-library/requirements/dev[all].txt @@ -14,6 +14,7 @@ --requirement _tools.txt # installs this repo's packages +--editable ../common-library --editable ../models-library/ --editable ../settings-library/ --editable ../pytest-simcore/ diff --git a/packages/service-library/requirements/dev[fastapi].txt b/packages/service-library/requirements/dev[fastapi].txt index caea1c80fd5..d66370d7904 100644 --- a/packages/service-library/requirements/dev[fastapi].txt +++ b/packages/service-library/requirements/dev[fastapi].txt @@ -13,6 +13,7 @@ --requirement _tools.txt # installs this repo's packages +--editable ../common-library --editable ../models-library/ --editable ../settings-library/ --editable ../pytest-simcore/ diff --git a/packages/service-library/src/servicelib/rabbitmq/rpc_interfaces/catalog/errors.py b/packages/service-library/src/servicelib/rabbitmq/rpc_interfaces/catalog/errors.py index 65c403853ea..5837beddcae 100644 --- a/packages/service-library/src/servicelib/rabbitmq/rpc_interfaces/catalog/errors.py +++ b/packages/service-library/src/servicelib/rabbitmq/rpc_interfaces/catalog/errors.py @@ -1,6 +1,6 @@ from typing import Any -from models_library.errors_classes import OsparcErrorMixin +from common_library.errors_classes import OsparcErrorMixin class CatalogApiBaseError(OsparcErrorMixin, Exception): diff --git a/packages/settings-library/requirements/_base.in b/packages/settings-library/requirements/_base.in index ec1d848cc85..9672f593a7f 100644 --- a/packages/settings-library/requirements/_base.in +++ b/packages/settings-library/requirements/_base.in @@ -1,8 +1,11 @@ # -# Specifies third-party dependencies for 'models-library' +# Specifies third-party dependencies for 'settings-library' # --constraint ../../../requirements/constraints.txt +# intra-repo required dependencies +--requirement ../../../packages/common-library/requirements/_base.in + pydantic>=1.9 diff --git a/packages/settings-library/requirements/ci.txt b/packages/settings-library/requirements/ci.txt index 9feda17bfaa..d950945b44b 100644 --- a/packages/settings-library/requirements/ci.txt +++ b/packages/settings-library/requirements/ci.txt @@ -12,6 +12,7 @@ # installs this repo's packages pytest-simcore @ ../pytest-simcore +simcore-common-library @ ../common-library/ # current module simcore-settings-library @ . diff --git a/packages/settings-library/requirements/dev.txt b/packages/settings-library/requirements/dev.txt index 32d383e9ccc..2168d7f36e1 100644 --- a/packages/settings-library/requirements/dev.txt +++ b/packages/settings-library/requirements/dev.txt @@ -12,6 +12,7 @@ --requirement _tools.txt # installs this repo's packages +--editable ../common-library/ --editable ../pytest-simcore/ # current module diff --git a/packages/simcore-sdk/requirements/_base.in b/packages/simcore-sdk/requirements/_base.in index a07a0b50b01..7999f81151a 100644 --- a/packages/simcore-sdk/requirements/_base.in +++ b/packages/simcore-sdk/requirements/_base.in @@ -7,6 +7,8 @@ --requirement ../../../packages/service-library/requirements/_base.in --requirement ../../../packages/settings-library/requirements/_base.in --requirement ../../../packages/models-library/requirements/_base.in +--requirement ../../../packages/common-library/requirements/_base.in + aiocache aiofiles diff --git a/packages/simcore-sdk/requirements/ci.txt b/packages/simcore-sdk/requirements/ci.txt index 25fcdd73354..afeb04529b3 100644 --- a/packages/simcore-sdk/requirements/ci.txt +++ b/packages/simcore-sdk/requirements/ci.txt @@ -13,6 +13,7 @@ # installs this repo's packages simcore-postgres-database @ ../postgres-database pytest-simcore @ ../pytest-simcore +simcore-common-library @ ../common-library simcore-models-library @ ../models-library simcore-settings-library @ ../settings-library/ simcore-service-library @ ../service-library/ diff --git a/packages/simcore-sdk/requirements/dev.txt b/packages/simcore-sdk/requirements/dev.txt index b67f43d8690..c7e7f45b7ed 100644 --- a/packages/simcore-sdk/requirements/dev.txt +++ b/packages/simcore-sdk/requirements/dev.txt @@ -15,6 +15,7 @@ --editable ../pytest-simcore/ --editable ../postgres-database +--editable ../common-library/ --editable ../models-library/ --editable ../settings-library/ diff --git a/services/agent/requirements/_base.in b/services/agent/requirements/_base.in index 7064a551898..5fc14c5cfe2 100644 --- a/services/agent/requirements/_base.in +++ b/services/agent/requirements/_base.in @@ -6,6 +6,7 @@ --constraint ./constraints.txt # intra-repo required dependencies +--requirement ../../../packages/common-library/requirements/_base.in --requirement ../../../packages/models-library/requirements/_base.in --requirement ../../../packages/settings-library/requirements/_base.in --requirement ../../../packages/service-library/requirements/_fastapi.in diff --git a/services/agent/requirements/ci.txt b/services/agent/requirements/ci.txt index 394361bc0ae..f7cb0dd72a4 100644 --- a/services/agent/requirements/ci.txt +++ b/services/agent/requirements/ci.txt @@ -11,6 +11,7 @@ --requirement _test.txt # installs this repo's packages +simcore-common-library @ ../../packages/common-library simcore-models-library @ ../../packages/models-library pytest-simcore @ ../../packages/pytest-simcore simcore-service-library @ ../../packages/service-library diff --git a/services/agent/requirements/dev.txt b/services/agent/requirements/dev.txt index a20e1ab941d..6f5e8cf7e24 100644 --- a/services/agent/requirements/dev.txt +++ b/services/agent/requirements/dev.txt @@ -12,6 +12,7 @@ --requirement _tools.txt # installs this repo's packages +--editable ../../packages/common-library --editable ../../packages/models-library --editable ../../packages/pytest-simcore --editable ../../packages/service-library diff --git a/services/api-server/requirements/_base.in b/services/api-server/requirements/_base.in index f63ab332f47..30b633a2e10 100644 --- a/services/api-server/requirements/_base.in +++ b/services/api-server/requirements/_base.in @@ -7,6 +7,7 @@ --constraint ./constraints.txt # intra-repo required dependencies +--requirement ../../../packages/common-library/requirements/_base.in --requirement ../../../packages/models-library/requirements/_base.in --requirement ../../../packages/postgres-database/requirements/_base.in --requirement ../../../packages/settings-library/requirements/_base.in diff --git a/services/api-server/requirements/ci.txt b/services/api-server/requirements/ci.txt index 7ea96c9234e..844706d5fb2 100644 --- a/services/api-server/requirements/ci.txt +++ b/services/api-server/requirements/ci.txt @@ -11,6 +11,7 @@ --requirement _test.txt # installs this repo's packages +simcore-common-library @ ../../packages/common-library simcore-models-library @ ../../packages/models-library simcore-postgres-database @ ../../packages/postgres-database/ pytest-simcore @ ../../packages/pytest-simcore/ diff --git a/services/api-server/requirements/dev.txt b/services/api-server/requirements/dev.txt index 2de1f4cc316..5afc552d753 100644 --- a/services/api-server/requirements/dev.txt +++ b/services/api-server/requirements/dev.txt @@ -12,6 +12,7 @@ --requirement _tools.txt # installs this repo's packages +--editable ../../packages/common-library --editable ../../packages/models-library --editable ../../packages/postgres-database --editable ../../packages/pytest-simcore/ diff --git a/services/autoscaling/requirements/_base.in b/services/autoscaling/requirements/_base.in index ae362ec2744..231b8944c9d 100644 --- a/services/autoscaling/requirements/_base.in +++ b/services/autoscaling/requirements/_base.in @@ -7,6 +7,7 @@ --constraint ../../../services/dask-sidecar/requirements/_dask-distributed.txt # intra-repo required dependencies +--requirement ../../../packages/common-library/requirements/_base.in --requirement ../../../packages/models-library/requirements/_base.in --requirement ../../../packages/settings-library/requirements/_base.in --requirement ../../../packages/aws-library/requirements/_base.in diff --git a/services/autoscaling/requirements/ci.txt b/services/autoscaling/requirements/ci.txt index 6ae3d42db4f..99c6675a719 100644 --- a/services/autoscaling/requirements/ci.txt +++ b/services/autoscaling/requirements/ci.txt @@ -12,6 +12,7 @@ # installs this repo's packages simcore-aws-library @ ../../packages/aws-library +simcore-common-library @ ../../packages/common-library simcore-dask-task-models-library @ ../../packages/dask-task-models-library simcore-models-library @ ../../packages/models-library pytest-simcore @ ../../packages/pytest-simcore diff --git a/services/autoscaling/requirements/dev.txt b/services/autoscaling/requirements/dev.txt index 432e7ef62e9..ab92769203f 100644 --- a/services/autoscaling/requirements/dev.txt +++ b/services/autoscaling/requirements/dev.txt @@ -13,6 +13,7 @@ # installs this repo's packages --editable ../../packages/aws-library +--editable ../../packages/common-library --editable ../../packages/models-library --editable ../../packages/pytest-simcore --editable ../../packages/service-library[fastapi] diff --git a/services/catalog/requirements/_base.in b/services/catalog/requirements/_base.in index ef6f55597c3..1394dd65e5e 100644 --- a/services/catalog/requirements/_base.in +++ b/services/catalog/requirements/_base.in @@ -6,6 +6,7 @@ --constraint ../../../requirements/constraints.txt --constraint constraints.txt +--requirement ../../../packages/common-library/requirements/_base.in --requirement ../../../packages/models-library/requirements/_base.in --requirement ../../../packages/postgres-database/requirements/_base.in --requirement ../../../packages/settings-library/requirements/_base.in diff --git a/services/catalog/requirements/ci.txt b/services/catalog/requirements/ci.txt index 246c4b290a4..4ebc858a454 100644 --- a/services/catalog/requirements/ci.txt +++ b/services/catalog/requirements/ci.txt @@ -11,6 +11,7 @@ --requirement _test.txt # installs this repo's packages +simcore-common-library @ ../../packages/common-library simcore-models-library @ ../../packages/models-library simcore-postgres-database @ ../../packages/postgres-database pytest-simcore @ ../../packages/pytest-simcore/ diff --git a/services/catalog/requirements/dev.txt b/services/catalog/requirements/dev.txt index dccc4f79f39..c9df003398e 100644 --- a/services/catalog/requirements/dev.txt +++ b/services/catalog/requirements/dev.txt @@ -12,6 +12,7 @@ --requirement _tools.txt # installs this repo's packages +--editable ../../packages/common-library --editable ../../packages/models-library --editable ../../packages/postgres-database --editable ../../packages/pytest-simcore/ diff --git a/services/clusters-keeper/requirements/_base.in b/services/clusters-keeper/requirements/_base.in index dc3b222d6db..558d68b67cc 100644 --- a/services/clusters-keeper/requirements/_base.in +++ b/services/clusters-keeper/requirements/_base.in @@ -7,6 +7,7 @@ --constraint ../../../services/dask-sidecar/requirements/_dask-distributed.txt # intra-repo required dependencies +--requirement ../../../packages/common-library/requirements/_base.in --requirement ../../../packages/models-library/requirements/_base.in --requirement ../../../packages/settings-library/requirements/_base.in --requirement ../../../packages/aws-library/requirements/_base.in diff --git a/services/clusters-keeper/requirements/ci.txt b/services/clusters-keeper/requirements/ci.txt index 750d3b3a3d3..12125244536 100644 --- a/services/clusters-keeper/requirements/ci.txt +++ b/services/clusters-keeper/requirements/ci.txt @@ -12,6 +12,7 @@ # installs this repo's packages simcore-aws-library @ ../../packages/aws-library +simcore-common-library @ ../../packages/common-library simcore-models-library @ ../../packages/models-library pytest-simcore @ ../../packages/pytest-simcore simcore-service-library[fastapi] @ ../../packages/service-library diff --git a/services/clusters-keeper/requirements/dev.txt b/services/clusters-keeper/requirements/dev.txt index 5324f4c79f7..faf4378c83d 100644 --- a/services/clusters-keeper/requirements/dev.txt +++ b/services/clusters-keeper/requirements/dev.txt @@ -13,6 +13,7 @@ # installs this repo's packages --editable ../../packages/aws-library +--editable ../../packages/common-library --editable ../../packages/models-library --editable ../../packages/pytest-simcore --editable ../../packages/service-library[fastapi] diff --git a/services/dask-sidecar/requirements/_base.in b/services/dask-sidecar/requirements/_base.in index d2fbda72d85..4ff16158cdf 100644 --- a/services/dask-sidecar/requirements/_base.in +++ b/services/dask-sidecar/requirements/_base.in @@ -11,6 +11,7 @@ # - Added as constraints instead of requirements in order to avoid polluting base.txt # - Will be installed when prod.txt or dev.txt # +--requirement ../../../packages/common-library/requirements/_base.in --requirement ../../../packages/dask-task-models-library/requirements/_base.in --requirement ../../../packages/models-library/requirements/_base.in --requirement ../../../packages/service-library/requirements/_base.in diff --git a/services/dask-sidecar/requirements/ci.txt b/services/dask-sidecar/requirements/ci.txt index 63335c18529..192b4ffcbf0 100644 --- a/services/dask-sidecar/requirements/ci.txt +++ b/services/dask-sidecar/requirements/ci.txt @@ -11,6 +11,7 @@ --requirement _test.txt # installs this repo's packages +simcore-common-library @ ../../packages/common-library/ simcore-dask-task-models-library @ ../../packages/dask-task-models-library/ simcore-models-library @ ../../packages/models-library/ pytest-simcore @ ../../packages/pytest-simcore/ diff --git a/services/dask-sidecar/requirements/dev.txt b/services/dask-sidecar/requirements/dev.txt index 82fbeaefec6..6ad6237135b 100644 --- a/services/dask-sidecar/requirements/dev.txt +++ b/services/dask-sidecar/requirements/dev.txt @@ -12,6 +12,7 @@ --requirement _tools.txt # installs this repo's packages +--editable ../../packages/common-library/ --editable ../../packages/dask-task-models-library/ --editable ../../packages/models-library/ --editable ../../packages/pytest-simcore/ diff --git a/services/datcore-adapter/requirements/_base.in b/services/datcore-adapter/requirements/_base.in index de131dd6430..bcedb3cc8ed 100644 --- a/services/datcore-adapter/requirements/_base.in +++ b/services/datcore-adapter/requirements/_base.in @@ -4,6 +4,7 @@ # NOTE: ALL version constraints MUST be commented --constraint ../../../requirements/constraints.txt +--requirement ../../../packages/common-library/requirements/_base.in --requirement ../../../packages/models-library/requirements/_base.in --requirement ../../../packages/settings-library/requirements/_base.in # service-library[fastapi] diff --git a/services/datcore-adapter/requirements/ci.txt b/services/datcore-adapter/requirements/ci.txt index ddd345522ae..f68013921e7 100644 --- a/services/datcore-adapter/requirements/ci.txt +++ b/services/datcore-adapter/requirements/ci.txt @@ -11,6 +11,7 @@ --requirement _test.txt # installs this repo's packages +simcore-common-library @ ../../packages/common-library simcore-models-library @ ../../packages/models-library pytest-simcore @ ../../packages/pytest-simcore simcore-service-library[fastapi] @ ../../packages/service-library diff --git a/services/datcore-adapter/requirements/dev.txt b/services/datcore-adapter/requirements/dev.txt index 73afce79c61..04e2ca59025 100644 --- a/services/datcore-adapter/requirements/dev.txt +++ b/services/datcore-adapter/requirements/dev.txt @@ -12,6 +12,7 @@ --requirement _tools.txt # installs this repo's packages +--editable ../../packages/common-library --editable ../../packages/models-library --editable ../../packages/pytest-simcore --editable ../../packages/service-library[fastapi] diff --git a/services/director-v2/requirements/_base.in b/services/director-v2/requirements/_base.in index 2198739ef70..dc173e2c2b6 100644 --- a/services/director-v2/requirements/_base.in +++ b/services/director-v2/requirements/_base.in @@ -6,6 +6,7 @@ --constraint ./constraints.txt # NOTE: Make sure they are added in setup.install_requires +--requirement ../../../packages/common-library/requirements/_base.in --requirement ../../../packages/dask-task-models-library/requirements/_base.in --requirement ../../../packages/models-library/requirements/_base.in --requirement ../../../packages/postgres-database/requirements/_base.in diff --git a/services/director-v2/requirements/ci.txt b/services/director-v2/requirements/ci.txt index bda1da73082..67de20ae339 100644 --- a/services/director-v2/requirements/ci.txt +++ b/services/director-v2/requirements/ci.txt @@ -12,6 +12,7 @@ --requirement _test.txt # installs this repo's packages +simcore-common-library @ ../../packages/common-library/ simcore-dask-task-models-library @ ../../packages/dask-task-models-library/ simcore-models-library @ ../../packages/models-library simcore-postgres-database @ ../../packages/postgres-database diff --git a/services/director-v2/requirements/dev.txt b/services/director-v2/requirements/dev.txt index 6d932514ae9..f183201fd55 100644 --- a/services/director-v2/requirements/dev.txt +++ b/services/director-v2/requirements/dev.txt @@ -12,6 +12,7 @@ --requirement _tools.txt # installs this repo's packages +--editable ../../packages/common-library/ --editable ../../packages/dask-task-models-library/ --editable ../../packages/models-library --editable ../../packages/postgres-database/ diff --git a/services/dynamic-scheduler/requirements/_base.in b/services/dynamic-scheduler/requirements/_base.in index 74bc0519c82..12ae0b98af0 100644 --- a/services/dynamic-scheduler/requirements/_base.in +++ b/services/dynamic-scheduler/requirements/_base.in @@ -6,6 +6,7 @@ --constraint ./constraints.txt # intra-repo required dependencies +--requirement ../../../packages/common-library/requirements/_base.in --requirement ../../../packages/models-library/requirements/_base.in --requirement ../../../packages/postgres-database/requirements/_base.in --requirement ../../../packages/settings-library/requirements/_base.in diff --git a/services/dynamic-scheduler/requirements/ci.txt b/services/dynamic-scheduler/requirements/ci.txt index cfd40e964d9..53b69dc323f 100644 --- a/services/dynamic-scheduler/requirements/ci.txt +++ b/services/dynamic-scheduler/requirements/ci.txt @@ -11,6 +11,7 @@ --requirement _test.txt # installs this repo's packages +simcore-common-library @ ../../packages/common-library simcore-models-library @ ../../packages/models-library simcore-postgres-database @ ../../packages/postgres-database pytest-simcore @ ../../packages/pytest-simcore diff --git a/services/dynamic-scheduler/requirements/dev.txt b/services/dynamic-scheduler/requirements/dev.txt index 89e4eb7519c..60cb7217e53 100644 --- a/services/dynamic-scheduler/requirements/dev.txt +++ b/services/dynamic-scheduler/requirements/dev.txt @@ -12,6 +12,7 @@ --requirement _tools.txt # installs this repo's packages +--editable ../../packages/common-library --editable ../../packages/models-library --editable ../../packages/postgres-database --editable ../../packages/pytest-simcore diff --git a/services/dynamic-sidecar/requirements/_base.in b/services/dynamic-sidecar/requirements/_base.in index 251ca3cedfc..66b47a481b5 100644 --- a/services/dynamic-sidecar/requirements/_base.in +++ b/services/dynamic-sidecar/requirements/_base.in @@ -7,6 +7,7 @@ # NOTE: These input-requirements under packages are tested using latest updates # NOTE: Make sure these packages are added in setup.install_requires +--requirement ../../../packages/common-library/requirements/_base.in --requirement ../../../packages/models-library/requirements/_base.in --requirement ../../../packages/postgres-database/requirements/_base.in # service-library[fastapi] diff --git a/services/dynamic-sidecar/requirements/ci.txt b/services/dynamic-sidecar/requirements/ci.txt index c6040c5bc77..3c2e2adeb92 100644 --- a/services/dynamic-sidecar/requirements/ci.txt +++ b/services/dynamic-sidecar/requirements/ci.txt @@ -11,6 +11,7 @@ --requirement _test.txt # installs this repo's packages +simcore-common-library @ ../../packages/common-library/ simcore-models-library @ ../../packages/models-library/ simcore-postgres-database @ ../../packages/postgres-database/ pytest-simcore @ ../../packages/pytest-simcore/ diff --git a/services/dynamic-sidecar/requirements/dev.txt b/services/dynamic-sidecar/requirements/dev.txt index 2d1c00661ed..ce064f44c52 100644 --- a/services/dynamic-sidecar/requirements/dev.txt +++ b/services/dynamic-sidecar/requirements/dev.txt @@ -12,6 +12,7 @@ --requirement _tools.txt # installs this repo's packages +--editable ../../packages/common-library --editable ../../packages/models-library --editable ../../packages/postgres-database/ --editable ../../packages/pytest-simcore/ diff --git a/services/efs-guardian/requirements/_base.in b/services/efs-guardian/requirements/_base.in index 84e8460fa05..f8db1e50412 100644 --- a/services/efs-guardian/requirements/_base.in +++ b/services/efs-guardian/requirements/_base.in @@ -6,6 +6,7 @@ --constraint ./constraints.txt # intra-repo required dependencies +--requirement ../../../packages/common-library/requirements/_base.in --requirement ../../../packages/models-library/requirements/_base.in --requirement ../../../packages/settings-library/requirements/_base.in --requirement ../../../packages/aws-library/requirements/_base.in diff --git a/services/efs-guardian/requirements/ci.txt b/services/efs-guardian/requirements/ci.txt index 85e9fca927f..850a17f5f00 100644 --- a/services/efs-guardian/requirements/ci.txt +++ b/services/efs-guardian/requirements/ci.txt @@ -12,6 +12,7 @@ # installs this repo's packages simcore-aws-library @ ../../packages/aws-library +simcore-common-library @ ../../packages/common-library simcore-models-library @ ../../packages/models-library pytest-simcore @ ../../packages/pytest-simcore simcore-service-library[fastapi] @ ../../packages/service-library diff --git a/services/efs-guardian/requirements/dev.txt b/services/efs-guardian/requirements/dev.txt index 76ea75d980d..bc86a77da96 100644 --- a/services/efs-guardian/requirements/dev.txt +++ b/services/efs-guardian/requirements/dev.txt @@ -13,6 +13,7 @@ # installs this repo's packages --editable ../../packages/aws-library +--editable ../../packages/common-library --editable ../../packages/models-library --editable ../../packages/pytest-simcore --editable ../../packages/service-library[fastapi] diff --git a/services/invitations/requirements/_base.in b/services/invitations/requirements/_base.in index 5ee2336503c..2a775800f93 100644 --- a/services/invitations/requirements/_base.in +++ b/services/invitations/requirements/_base.in @@ -6,6 +6,7 @@ --constraint ./constraints.txt # intra-repo required dependencies +--requirement ../../../packages/common-library/requirements/_base.in --requirement ../../../packages/models-library/requirements/_base.in --requirement ../../../packages/settings-library/requirements/_base.in # service-library[fastapi] diff --git a/services/invitations/requirements/ci.txt b/services/invitations/requirements/ci.txt index bbc14fe4596..4051e96b178 100644 --- a/services/invitations/requirements/ci.txt +++ b/services/invitations/requirements/ci.txt @@ -11,10 +11,11 @@ --requirement _test.txt # installs this repo's packages +simcore-common-library @ ../../packages/common-library +simcore-models-library @ ../../packages/models-library pytest-simcore @ ../../packages/pytest-simcore simcore-service-library[fastapi] @ ../../packages/service-library simcore-settings-library @ ../../packages/settings-library -simcore-models-library @ ../../packages/models-library # installs current package simcore-service-invitations @ . diff --git a/services/invitations/requirements/dev.txt b/services/invitations/requirements/dev.txt index a45c4db8918..1de98a1f08a 100644 --- a/services/invitations/requirements/dev.txt +++ b/services/invitations/requirements/dev.txt @@ -12,10 +12,12 @@ --requirement _tools.txt # installs this repo's packages +--editable ../../packages/common-library +--editable ../../packages/models-library --editable ../../packages/pytest-simcore --editable ../../packages/service-library[fastapi] --editable ../../packages/settings-library ---editable ../../packages/models-library + # installs current package --editable . diff --git a/services/payments/requirements/_base.in b/services/payments/requirements/_base.in index da3813cc2bb..6c79c0abca7 100644 --- a/services/payments/requirements/_base.in +++ b/services/payments/requirements/_base.in @@ -6,6 +6,7 @@ --constraint ./constraints.txt # intra-repo required dependencies +--requirement ../../../packages/common-library/requirements/_base.in --requirement ../../../packages/models-library/requirements/_base.in --requirement ../../../packages/postgres-database/requirements/_base.in --requirement ../../../packages/settings-library/requirements/_base.in diff --git a/services/payments/requirements/ci.txt b/services/payments/requirements/ci.txt index fb0d44c3a77..47e283fa955 100644 --- a/services/payments/requirements/ci.txt +++ b/services/payments/requirements/ci.txt @@ -11,10 +11,12 @@ --requirement _test.txt # installs this repo's packages +simcore-common-library @ ../../packages/common-library simcore-models-library @ ../../packages/models-library simcore-postgres-database @ ../../packages/postgres-database pytest-simcore @ ../../packages/pytest-simcore simcore-service-library[fastapi] @ ../../packages/service-library simcore-settings-library @ ../../packages/settings-library + # installs current package simcore-service-payments @ . diff --git a/services/payments/requirements/dev.txt b/services/payments/requirements/dev.txt index b20ade64f27..80aeaf26dbe 100644 --- a/services/payments/requirements/dev.txt +++ b/services/payments/requirements/dev.txt @@ -12,6 +12,7 @@ --requirement _tools.txt # installs this repo's packages +--editable ../../packages/common-library --editable ../../packages/models-library --editable ../../packages/postgres-database --editable ../../packages/pytest-simcore diff --git a/services/resource-usage-tracker/requirements/_base.in b/services/resource-usage-tracker/requirements/_base.in index c71570d1fee..1ed4215b64f 100644 --- a/services/resource-usage-tracker/requirements/_base.in +++ b/services/resource-usage-tracker/requirements/_base.in @@ -7,6 +7,7 @@ # intra-repo required dependencies --requirement ../../../packages/aws-library/requirements/_base.in +--requirement ../../../packages/common-library/requirements/_base.in --requirement ../../../packages/models-library/requirements/_base.in --requirement ../../../packages/settings-library/requirements/_base.in --requirement ../../../packages/postgres-database/requirements/_base.in diff --git a/services/resource-usage-tracker/requirements/ci.txt b/services/resource-usage-tracker/requirements/ci.txt index 9cfb2df141d..2f2df03f1d5 100644 --- a/services/resource-usage-tracker/requirements/ci.txt +++ b/services/resource-usage-tracker/requirements/ci.txt @@ -12,6 +12,7 @@ # installs this repo's packages simcore-aws-library @ ../../packages/aws-library +simcore-common-library @ ../../packages/common-library simcore-models-library @ ../../packages/models-library pytest-simcore @ ../../packages/pytest-simcore simcore-service-library[fastapi] @ ../../packages/service-library diff --git a/services/resource-usage-tracker/requirements/dev.txt b/services/resource-usage-tracker/requirements/dev.txt index 4fc539932c0..253940c1800 100644 --- a/services/resource-usage-tracker/requirements/dev.txt +++ b/services/resource-usage-tracker/requirements/dev.txt @@ -13,6 +13,7 @@ # installs this repo's packages --editable ../../packages/aws-library +--editable ../../packages/common-library --editable ../../packages/models-library --editable ../../packages/pytest-simcore --editable ../../packages/service-library[fastapi] diff --git a/services/storage/requirements/_base.in b/services/storage/requirements/_base.in index 2db40016724..26ba2b4b835 100644 --- a/services/storage/requirements/_base.in +++ b/services/storage/requirements/_base.in @@ -6,6 +6,7 @@ --requirement ../../../packages/aws-library/requirements/_base.in +--requirement ../../../packages/common-library/requirements/_base.in --requirement ../../../packages/models-library/requirements/_base.in --requirement ../../../packages/postgres-database/requirements/_base.in --requirement ../../../packages/settings-library/requirements/_base.in diff --git a/services/storage/requirements/ci.txt b/services/storage/requirements/ci.txt index f3d92884e0e..25d417f91c7 100644 --- a/services/storage/requirements/ci.txt +++ b/services/storage/requirements/ci.txt @@ -12,6 +12,7 @@ # installs this repo's packages simcore-aws-library @ ../../packages/aws-library/ +simcore-common-library @ ../../packages/common-library/ simcore-models-library @ ../../packages/models-library/ simcore-postgres-database @ ../../packages/postgres-database/ pytest-simcore @ ../../packages/pytest-simcore/ diff --git a/services/storage/requirements/dev.txt b/services/storage/requirements/dev.txt index 0b2b3ae2938..97aefedee51 100644 --- a/services/storage/requirements/dev.txt +++ b/services/storage/requirements/dev.txt @@ -13,6 +13,7 @@ # installs this repo's packages --editable ../../packages/aws-library/ +--editable ../../packages/common-library --editable ../../packages/models-library --editable ../../packages/postgres-database/ --editable ../../packages/pytest-simcore/