From 968b5ab764b80c80decb0cc38b45cbd4e6ad7253 Mon Sep 17 00:00:00 2001 From: Giancarlo Romeo Date: Mon, 7 Oct 2024 09:28:13 +0200 Subject: [PATCH 01/16] Add common library --- packages/common-library/.gitignore | 3 ++ packages/common-library/Makefile | 49 ++++++++++++++++++++++++ packages/common-library/README.md | 40 ++++++++++++++++++++ packages/common-library/VERSION | 1 + packages/common-library/setup.cfg | 24 ++++++++++++ packages/common-library/setup.py | 60 ++++++++++++++++++++++++++++++ 6 files changed, 177 insertions(+) create mode 100644 packages/common-library/.gitignore create mode 100644 packages/common-library/Makefile create mode 100644 packages/common-library/README.md create mode 100644 packages/common-library/VERSION create mode 100644 packages/common-library/setup.cfg create mode 100644 packages/common-library/setup.py diff --git a/packages/common-library/.gitignore b/packages/common-library/.gitignore new file mode 100644 index 00000000000..98149591573 --- /dev/null +++ b/packages/common-library/.gitignore @@ -0,0 +1,3 @@ + +# erdantic outputs +erd-*.svg 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..ee3957a4031 --- /dev/null +++ b/packages/common-library/README.md @@ -0,0 +1,40 @@ +# simcore pydantic common library + +## 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/setup.cfg b/packages/common-library/setup.cfg new file mode 100644 index 00000000000..07196483569 --- /dev/null +++ b/packages/common-library/setup.cfg @@ -0,0 +1,24 @@ +[bumpversion] +current_version = 0.1.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..24dded82a04 --- /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": "Sylvain Anderegg (sanderegg)", + "description": "Core service library for simcore pydantic common", + "python_requires": "~=3.10", + "classifiers": [ + "Development Status :: 2 - Pre-Alpha", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Natural Language :: English", + "Programming Language :: Python :: 3.10", + ], + "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) From 3f5d881fc7384df76418c956a14fb0d441051c84 Mon Sep 17 00:00:00 2001 From: Giancarlo Romeo Date: Mon, 7 Oct 2024 13:21:50 +0200 Subject: [PATCH 02/16] add base common library --- .github/workflows/ci-testing-deploy.yml | 45 +++++++++++ ci/github/unit-testing/common-library.bash | 43 ++++++++++ packages/common-library/README.md | 11 ++- packages/common-library/VERSION | 2 +- packages/common-library/requirements/Makefile | 6 ++ packages/common-library/requirements/_base.in | 6 ++ .../common-library/requirements/_base.txt | 12 +++ packages/common-library/requirements/_test.in | 21 +++++ .../common-library/requirements/_test.txt | 55 +++++++++++++ .../common-library/requirements/_tools.in | 5 ++ .../common-library/requirements/_tools.txt | 79 +++++++++++++++++++ packages/common-library/requirements/ci.txt | 17 ++++ packages/common-library/requirements/dev.txt | 18 +++++ packages/common-library/setup.cfg | 2 +- packages/common-library/setup.py | 4 +- .../src/common_library/__init__.py | 12 +++ .../common-library/src/common_library/base.py | 2 + packages/common-library/tests/conftest.py | 33 ++++++++ packages/common-library/tests/test_base.py | 4 + 19 files changed, 371 insertions(+), 6 deletions(-) create mode 100755 ci/github/unit-testing/common-library.bash create mode 100644 packages/common-library/requirements/Makefile create mode 100644 packages/common-library/requirements/_base.in create mode 100644 packages/common-library/requirements/_base.txt create mode 100644 packages/common-library/requirements/_test.in create mode 100644 packages/common-library/requirements/_test.txt create mode 100644 packages/common-library/requirements/_tools.in create mode 100644 packages/common-library/requirements/_tools.txt create mode 100644 packages/common-library/requirements/ci.txt create mode 100644 packages/common-library/requirements/dev.txt create mode 100644 packages/common-library/src/common_library/__init__.py create mode 100644 packages/common-library/src/common_library/base.py create mode 100644 packages/common-library/tests/conftest.py create mode 100644 packages/common-library/tests/test_base.py 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/common-library/README.md b/packages/common-library/README.md index ee3957a4031..8e30b4405ca 100644 --- a/packages/common-library/README.md +++ b/packages/common-library/README.md @@ -1,4 +1,11 @@ -# simcore pydantic common library +# simcore pydantic models library + +Contains the [pydantic](https://pydantic-docs.helpmanual.io/)-based models for use in the simcore platform. As a reminder pydantic allows creation of python classes that automatically validate their contents based on types. It also provides mechanism to generate json schemas describing the classes internals. + +Requirements to be compatible with the library: + +- be a pydantic-based model +- not a model for use in a REST API (or at least not directly) only for a specific service (ServiceUpdate model for use in a PATCH REST call on the webserver has nothing to do in the library for example, but a base class for it is ok) ## Installation @@ -24,7 +31,7 @@ How run diagnostics on the service metadata published in a docker registry? make devenv source .venv/bin/activate -cd packages/common-library +cd packages/models-library make install-dev ``` 2. Set ``REGISTRY_*`` env vars in ``.env`` (in the repository base folder) diff --git a/packages/common-library/VERSION b/packages/common-library/VERSION index 6e8bf73aa55..0ea3a944b39 100644 --- a/packages/common-library/VERSION +++ b/packages/common-library/VERSION @@ -1 +1 @@ -0.1.0 +0.2.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..e8ecb6f4060 --- /dev/null +++ b/packages/common-library/requirements/_base.in @@ -0,0 +1,6 @@ +# +# Specifies third-party dependencies for 'models-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..161f20fda46 --- /dev/null +++ b/packages/common-library/requirements/_test.in @@ -0,0 +1,21 @@ +# +# Specifies dependencies required to run 'models-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..ff171610d5d --- /dev/null +++ b/packages/common-library/requirements/ci.txt @@ -0,0 +1,17 @@ +# Shortcut to install all packages for the contigous integration (CI) of 'models-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..32d383e9ccc --- /dev/null +++ b/packages/common-library/requirements/dev.txt @@ -0,0 +1,18 @@ +# Shortcut to install all packages needed to develop 'models-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 index 07196483569..b33be52008a 100644 --- a/packages/common-library/setup.cfg +++ b/packages/common-library/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.1.0 +current_version = 0.2.0 commit = True message = packages/common-library version: {current_version} → {new_version} tag = False diff --git a/packages/common-library/setup.py b/packages/common-library/setup.py index 24dded82a04..ceef017dfb1 100644 --- a/packages/common-library/setup.py +++ b/packages/common-library/setup.py @@ -32,7 +32,7 @@ def read_reqs(reqs_path: Path) -> set[str]: SETUP = { "name": "simcore-common-library", "version": Path(CURRENT_DIR / "VERSION").read_text().strip(), - "author": "Sylvain Anderegg (sanderegg)", + "author": "Giancarlo Romeo (giancarloromeo)", "description": "Core service library for simcore pydantic common", "python_requires": "~=3.10", "classifiers": [ @@ -40,7 +40,7 @@ def read_reqs(reqs_path: Path) -> set[str]: "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", - "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", ], "long_description": Path(CURRENT_DIR / "README.md").read_text(), "license": "MIT license", 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..bc773957a1a --- /dev/null +++ b/packages/common-library/src/common_library/__init__.py @@ -0,0 +1,12 @@ +""" osparc's service models 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/common-library/src/common_library/base.py b/packages/common-library/src/common_library/base.py new file mode 100644 index 00000000000..f1001ed1f5a --- /dev/null +++ b/packages/common-library/src/common_library/base.py @@ -0,0 +1,2 @@ +class Initial: + pass 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/common-library/tests/test_base.py b/packages/common-library/tests/test_base.py new file mode 100644 index 00000000000..24f5b8875a3 --- /dev/null +++ b/packages/common-library/tests/test_base.py @@ -0,0 +1,4 @@ +from common_library.base import Initial + +def test_model(): + assert Initial() From df864b4054144402f20e9da2e31edf1684768437 Mon Sep 17 00:00:00 2001 From: Giancarlo Romeo Date: Mon, 7 Oct 2024 10:41:55 +0200 Subject: [PATCH 03/16] add error classes --- .../common-library/src/common_library/base.py | 2 - .../src/common_library/errors_classes.py | 42 +++++ packages/common-library/tests/test_base.py | 4 - .../tests/test_errors_classes.py | 143 ++++++++++++++++++ 4 files changed, 185 insertions(+), 6 deletions(-) delete mode 100644 packages/common-library/src/common_library/base.py create mode 100644 packages/common-library/src/common_library/errors_classes.py delete mode 100644 packages/common-library/tests/test_base.py create mode 100644 packages/common-library/tests/test_errors_classes.py diff --git a/packages/common-library/src/common_library/base.py b/packages/common-library/src/common_library/base.py deleted file mode 100644 index f1001ed1f5a..00000000000 --- a/packages/common-library/src/common_library/base.py +++ /dev/null @@ -1,2 +0,0 @@ -class Initial: - pass diff --git a/packages/common-library/src/common_library/errors_classes.py b/packages/common-library/src/common_library/errors_classes.py new file mode 100644 index 00000000000..1438536d550 --- /dev/null +++ b/packages/common-library/src/common_library/errors_classes.py @@ -0,0 +1,42 @@ +from pydantic.errors import PydanticErrorMixin + + +class _DefaultDict(dict): + def __missing__(self, key): + return f"'{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() + return super().__new__(cls) + + def __init__(self, *_args, **kwargs) -> None: + self.__dict__ = kwargs + super().__init__(message=self._build_message(), code=self.code) # type: ignore[arg-type] + + def __str__(self) -> str: + return self._build_message() + + def _build_message(self) -> str: + # NOTE: safe. Does not raise KeyError + return self.msg_template.format_map(_DefaultDict(**self.__dict__)) + + @classmethod + def _get_full_class_name(cls) -> str: + relevant_classes = [ + c.__name__ + for c in cls.__mro__[:-1] + if c.__name__ + not in ( + "PydanticErrorMixin", + "OsparcErrorMixin", + "Exception", + "BaseException", + ) + ] + return ".".join(reversed(relevant_classes)) diff --git a/packages/common-library/tests/test_base.py b/packages/common-library/tests/test_base.py deleted file mode 100644 index 24f5b8875a3..00000000000 --- a/packages/common-library/tests/test_base.py +++ /dev/null @@ -1,4 +0,0 @@ -from common_library.base import Initial - -def test_model(): - assert Initial() diff --git a/packages/common-library/tests/test_errors_classes.py b/packages/common-library/tests/test_errors_classes.py new file mode 100644 index 00000000000..ae0ed8c1e3d --- /dev/null +++ b/packages/common-library/tests/test_errors_classes.py @@ -0,0 +1,143 @@ +# pylint: disable=protected-access +# pylint: disable=redefined-outer-name +# pylint: disable=unused-argument +# pylint: disable=unused-variable +# pylint: disable=no-member + + +from datetime import datetime +from typing import Any + +import pytest +from common_library.errors_classes import OsparcErrorMixin + + +def test_get_full_class_name(): + class A(OsparcErrorMixin): + ... + + class B1(A): + ... + + class B2(A): + ... + + class C(B2): + ... + + class B12(B1, ValueError): + ... + + assert B1._get_full_class_name() == "A.B1" + assert C._get_full_class_name() == "A.B2.C" + assert A._get_full_class_name() == "A" + + # diamond inheritance (not usual but supported) + assert B12._get_full_class_name() == "ValueError.A.B1.B12" + + +def test_error_codes_and_msg_template(): + class MyBaseError(OsparcErrorMixin, Exception): + def __init__(self, **ctx: Any) -> None: + super().__init__(**ctx) # Do not forget this for base exceptions! + + class MyValueError(MyBaseError, ValueError): + msg_template = "Wrong value {value}" + + error = MyValueError(value=42) + + assert error.code == "ValueError.MyBaseError.MyValueError" + assert f"{error}" == "Wrong value 42" + + class MyTypeError(MyBaseError, TypeError): + code = "i_want_this" + msg_template = "Wrong type {type}" + + error = MyTypeError(type="int") + + assert error.code == "i_want_this" + assert f"{error}" == "Wrong type int" + + +def test_error_msg_template_override(): + class MyError(OsparcErrorMixin, Exception): + msg_template = "Wrong value {value}" + + error_override_msg = MyError(msg_template="I want this message") + assert str(error_override_msg) == "I want this message" + + error = MyError(value=42) + assert hasattr(error, "value") + assert str(error) == f"Wrong value {error.value}" + + +def test_error_msg_template_nicer_override(): + class MyError(OsparcErrorMixin, Exception): + msg_template = "Wrong value {value}" + + def __init__(self, msg=None, **ctx: Any) -> None: + super().__init__(**ctx) + # positional argument msg (if defined) overrides the msg_template + if msg: + self.msg_template = msg + + error_override_msg = MyError("I want this message") + assert str(error_override_msg) == "I want this message" + + error = MyError(value=42) + assert hasattr(error, "value") + assert str(error) == f"Wrong value {error.value}" + + +def test_error_with_constructor(): + class MyError(OsparcErrorMixin, ValueError): + msg_template = "Wrong value {value}" + + # handy e.g. autocompletion + def __init__(self, *, my_value: int = 42, **extra): + super().__init__(**extra) + self.value = my_value + + error = MyError(my_value=33, something_else="yes") + assert error.value == 33 + assert str(error) == "Wrong value 33" + assert not hasattr(error, "my_value") + + # the autocompletion does not see this + assert error.something_else == "yes" + + +@pytest.mark.parametrize( + "str_format,ctx,expected", + [ + pytest.param("{value:10}", {"value": "Python"}, "Python ", id="left-align"), + pytest.param( + "{value:>10}", {"value": "Python"}, " Python", id="right-align" + ), + pytest.param( + "{value:^10}", {"value": "Python"}, " Python ", id="center-align" + ), + pytest.param("{v:.2f}", {"v": 3.1415926}, "3.14", id="decimals"), + pytest.param( + "{dt:%Y-%m-%d %H:%M}", + {"dt": datetime(2020, 5, 17, 18, 45)}, + "2020-05-17 18:45", + id="datetime", + ), + ], +) +def test_msg_template_with_different_formats( + str_format: str, ctx: dict[str, Any], expected: str +): + class MyError(OsparcErrorMixin, ValueError): + msg_template = str_format + + error = MyError(**ctx) + assert str(error) == expected + + +def test_missing_keys_in_msg_template_does_not_raise(): + class MyError(OsparcErrorMixin, ValueError): + msg_template = "{value} and {missing}" + + assert str(MyError(value=42)) == "42 and 'missing=?'" From 09c00735c62332000b96c80733306c5084570165 Mon Sep 17 00:00:00 2001 From: Giancarlo Romeo Date: Mon, 7 Oct 2024 13:39:35 +0200 Subject: [PATCH 04/16] point to common library --- .../src/models_library/osparc_variable_identifier.py | 3 ++- .../src/models_library/utils/specs_substitution.py | 3 ++- packages/models-library/tests/test_errors_classes.py | 2 +- .../notifications-library/src/notifications_library/errors.py | 2 +- .../src/servicelib/rabbitmq/rpc_interfaces/catalog/errors.py | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) 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/models-library/tests/test_errors_classes.py b/packages/models-library/tests/test_errors_classes.py index 754367805e2..ae0ed8c1e3d 100644 --- a/packages/models-library/tests/test_errors_classes.py +++ b/packages/models-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/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-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): From d752d18e03ea3b528e1dec6fafb7491c551c8078 Mon Sep 17 00:00:00 2001 From: Giancarlo Romeo Date: Mon, 7 Oct 2024 13:44:20 +0200 Subject: [PATCH 05/16] fix names --- packages/common-library/README.md | 11 +++-------- packages/common-library/requirements/_base.in | 2 +- packages/common-library/requirements/_test.in | 2 +- packages/common-library/requirements/ci.txt | 2 +- packages/common-library/requirements/dev.txt | 2 +- .../common-library/src/common_library/__init__.py | 2 +- packages/common-library/tests/conftest.py | 2 +- 7 files changed, 9 insertions(+), 14 deletions(-) diff --git a/packages/common-library/README.md b/packages/common-library/README.md index 8e30b4405ca..8e5c489787b 100644 --- a/packages/common-library/README.md +++ b/packages/common-library/README.md @@ -1,11 +1,6 @@ -# simcore pydantic models library +# simcore pydantic common library -Contains the [pydantic](https://pydantic-docs.helpmanual.io/)-based models for use in the simcore platform. As a reminder pydantic allows creation of python classes that automatically validate their contents based on types. It also provides mechanism to generate json schemas describing the classes internals. - -Requirements to be compatible with the library: - -- be a pydantic-based model -- not a model for use in a REST API (or at least not directly) only for a specific service (ServiceUpdate model for use in a PATCH REST call on the webserver has nothing to do in the library for example, but a base class for it is ok) +Contains the common classes, functions and in general utilities for use in the simcore platform. ## Installation @@ -31,7 +26,7 @@ How run diagnostics on the service metadata published in a docker registry? make devenv source .venv/bin/activate -cd packages/models-library +cd packages/common-library make install-dev ``` 2. Set ``REGISTRY_*`` env vars in ``.env`` (in the repository base folder) diff --git a/packages/common-library/requirements/_base.in b/packages/common-library/requirements/_base.in index e8ecb6f4060..73cc02bceb7 100644 --- a/packages/common-library/requirements/_base.in +++ b/packages/common-library/requirements/_base.in @@ -1,5 +1,5 @@ # -# Specifies third-party dependencies for 'models-library' +# Specifies third-party dependencies for 'common-library' # --constraint ../../../requirements/constraints.txt diff --git a/packages/common-library/requirements/_test.in b/packages/common-library/requirements/_test.in index 161f20fda46..4454d79d36a 100644 --- a/packages/common-library/requirements/_test.in +++ b/packages/common-library/requirements/_test.in @@ -1,5 +1,5 @@ # -# Specifies dependencies required to run 'models-library' +# Specifies dependencies required to run 'common-library' # --constraint ../../../requirements/constraints.txt diff --git a/packages/common-library/requirements/ci.txt b/packages/common-library/requirements/ci.txt index ff171610d5d..ed9eb3028e8 100644 --- a/packages/common-library/requirements/ci.txt +++ b/packages/common-library/requirements/ci.txt @@ -1,4 +1,4 @@ -# Shortcut to install all packages for the contigous integration (CI) of 'models-library' +# Shortcut to install all packages for the contigous integration (CI) of 'common-library' # # - As ci.txt but w/ tests # diff --git a/packages/common-library/requirements/dev.txt b/packages/common-library/requirements/dev.txt index 32d383e9ccc..02718f95c3a 100644 --- a/packages/common-library/requirements/dev.txt +++ b/packages/common-library/requirements/dev.txt @@ -1,4 +1,4 @@ -# Shortcut to install all packages needed to develop 'models-library' +# Shortcut to install all packages needed to develop 'common-library' # # - As ci.txt but with current and repo packages in develop (edit) mode # diff --git a/packages/common-library/src/common_library/__init__.py b/packages/common-library/src/common_library/__init__.py index bc773957a1a..dc0c65ff721 100644 --- a/packages/common-library/src/common_library/__init__.py +++ b/packages/common-library/src/common_library/__init__.py @@ -1,4 +1,4 @@ -""" osparc's service models library +""" osparc's service common library """ diff --git a/packages/common-library/tests/conftest.py b/packages/common-library/tests/conftest.py index 46f09f86b46..124e3c2b022 100644 --- a/packages/common-library/tests/conftest.py +++ b/packages/common-library/tests/conftest.py @@ -9,7 +9,7 @@ import pytest pytest_plugins = [ - "pytest_simcore.pydantic_models", + "pytest_simcore.pydantic_common", "pytest_simcore.pytest_global_environs", "pytest_simcore.repository_paths", "pytest_simcore.schemas", From 3f0ec865e2a3fbb0ceda26fbb19f2f84a759a5a2 Mon Sep 17 00:00:00 2001 From: Giancarlo Romeo Date: Mon, 7 Oct 2024 13:45:38 +0200 Subject: [PATCH 06/16] remove moved modules --- .../src/models_library/errors_classes.py | 41 ----- .../tests/test_errors_classes.py | 143 ------------------ 2 files changed, 184 deletions(-) delete mode 100644 packages/models-library/src/models_library/errors_classes.py delete mode 100644 packages/models-library/tests/test_errors_classes.py diff --git a/packages/models-library/src/models_library/errors_classes.py b/packages/models-library/src/models_library/errors_classes.py deleted file mode 100644 index 6f6d9e0c266..00000000000 --- a/packages/models-library/src/models_library/errors_classes.py +++ /dev/null @@ -1,41 +0,0 @@ -from pydantic.errors import PydanticErrorMixin - - -class _DefaultDict(dict): - def __missing__(self, key): - return f"'{key}=?'" - - -class OsparcErrorMixin(PydanticErrorMixin): - msg_template: str - - def __new__(cls, *_args, **_kwargs): - if not hasattr(cls, "code"): - cls.code = cls._get_full_class_name() # type: ignore[assignment] - return super().__new__(cls) - - def __init__(self, *_args, **kwargs) -> None: - self.__dict__ = kwargs - super().__init__(message=self._build_message(), code=self.code) - - def __str__(self) -> str: - return self._build_message() - - def _build_message(self) -> str: - # NOTE: safe. Does not raise KeyError - return self.msg_template.format_map(_DefaultDict(**self.__dict__)) - - @classmethod - def _get_full_class_name(cls) -> str: - relevant_classes = [ - c.__name__ - for c in cls.__mro__[:-1] - if c.__name__ - not in ( - "PydanticErrorMixin", - "OsparcErrorMixin", - "Exception", - "BaseException", - ) - ] - return ".".join(reversed(relevant_classes)) diff --git a/packages/models-library/tests/test_errors_classes.py b/packages/models-library/tests/test_errors_classes.py deleted file mode 100644 index ae0ed8c1e3d..00000000000 --- a/packages/models-library/tests/test_errors_classes.py +++ /dev/null @@ -1,143 +0,0 @@ -# pylint: disable=protected-access -# pylint: disable=redefined-outer-name -# pylint: disable=unused-argument -# pylint: disable=unused-variable -# pylint: disable=no-member - - -from datetime import datetime -from typing import Any - -import pytest -from common_library.errors_classes import OsparcErrorMixin - - -def test_get_full_class_name(): - class A(OsparcErrorMixin): - ... - - class B1(A): - ... - - class B2(A): - ... - - class C(B2): - ... - - class B12(B1, ValueError): - ... - - assert B1._get_full_class_name() == "A.B1" - assert C._get_full_class_name() == "A.B2.C" - assert A._get_full_class_name() == "A" - - # diamond inheritance (not usual but supported) - assert B12._get_full_class_name() == "ValueError.A.B1.B12" - - -def test_error_codes_and_msg_template(): - class MyBaseError(OsparcErrorMixin, Exception): - def __init__(self, **ctx: Any) -> None: - super().__init__(**ctx) # Do not forget this for base exceptions! - - class MyValueError(MyBaseError, ValueError): - msg_template = "Wrong value {value}" - - error = MyValueError(value=42) - - assert error.code == "ValueError.MyBaseError.MyValueError" - assert f"{error}" == "Wrong value 42" - - class MyTypeError(MyBaseError, TypeError): - code = "i_want_this" - msg_template = "Wrong type {type}" - - error = MyTypeError(type="int") - - assert error.code == "i_want_this" - assert f"{error}" == "Wrong type int" - - -def test_error_msg_template_override(): - class MyError(OsparcErrorMixin, Exception): - msg_template = "Wrong value {value}" - - error_override_msg = MyError(msg_template="I want this message") - assert str(error_override_msg) == "I want this message" - - error = MyError(value=42) - assert hasattr(error, "value") - assert str(error) == f"Wrong value {error.value}" - - -def test_error_msg_template_nicer_override(): - class MyError(OsparcErrorMixin, Exception): - msg_template = "Wrong value {value}" - - def __init__(self, msg=None, **ctx: Any) -> None: - super().__init__(**ctx) - # positional argument msg (if defined) overrides the msg_template - if msg: - self.msg_template = msg - - error_override_msg = MyError("I want this message") - assert str(error_override_msg) == "I want this message" - - error = MyError(value=42) - assert hasattr(error, "value") - assert str(error) == f"Wrong value {error.value}" - - -def test_error_with_constructor(): - class MyError(OsparcErrorMixin, ValueError): - msg_template = "Wrong value {value}" - - # handy e.g. autocompletion - def __init__(self, *, my_value: int = 42, **extra): - super().__init__(**extra) - self.value = my_value - - error = MyError(my_value=33, something_else="yes") - assert error.value == 33 - assert str(error) == "Wrong value 33" - assert not hasattr(error, "my_value") - - # the autocompletion does not see this - assert error.something_else == "yes" - - -@pytest.mark.parametrize( - "str_format,ctx,expected", - [ - pytest.param("{value:10}", {"value": "Python"}, "Python ", id="left-align"), - pytest.param( - "{value:>10}", {"value": "Python"}, " Python", id="right-align" - ), - pytest.param( - "{value:^10}", {"value": "Python"}, " Python ", id="center-align" - ), - pytest.param("{v:.2f}", {"v": 3.1415926}, "3.14", id="decimals"), - pytest.param( - "{dt:%Y-%m-%d %H:%M}", - {"dt": datetime(2020, 5, 17, 18, 45)}, - "2020-05-17 18:45", - id="datetime", - ), - ], -) -def test_msg_template_with_different_formats( - str_format: str, ctx: dict[str, Any], expected: str -): - class MyError(OsparcErrorMixin, ValueError): - msg_template = str_format - - error = MyError(**ctx) - assert str(error) == expected - - -def test_missing_keys_in_msg_template_does_not_raise(): - class MyError(OsparcErrorMixin, ValueError): - msg_template = "{value} and {missing}" - - assert str(MyError(value=42)) == "42 and 'missing=?'" From 4a30d09aa0ee42f89b7d8b76f192b5dd8bd2b73b Mon Sep 17 00:00:00 2001 From: Giancarlo Romeo Date: Mon, 7 Oct 2024 13:50:30 +0200 Subject: [PATCH 07/16] fix rename --- packages/common-library/tests/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/common-library/tests/conftest.py b/packages/common-library/tests/conftest.py index 124e3c2b022..46f09f86b46 100644 --- a/packages/common-library/tests/conftest.py +++ b/packages/common-library/tests/conftest.py @@ -9,7 +9,7 @@ import pytest pytest_plugins = [ - "pytest_simcore.pydantic_common", + "pytest_simcore.pydantic_models", "pytest_simcore.pytest_global_environs", "pytest_simcore.repository_paths", "pytest_simcore.schemas", From 1e5722084ed54e1e2383f9652221409c8c1df0a2 Mon Sep 17 00:00:00 2001 From: Giancarlo Romeo Date: Mon, 7 Oct 2024 14:14:30 +0200 Subject: [PATCH 08/16] add utils --- .../utils/pydantic_fields_extension.py | 22 ++++++ .../src/common_library/utils/serialization.py | 32 ++++++++ .../tests/test_utils_pydantic_extension.py | 76 +++++++++++++++++++ .../tests/test_utils_serialization.py | 30 ++++++++ 4 files changed, 160 insertions(+) create mode 100644 packages/common-library/src/common_library/utils/pydantic_fields_extension.py create mode 100644 packages/common-library/src/common_library/utils/serialization.py create mode 100644 packages/common-library/tests/test_utils_pydantic_extension.py create mode 100644 packages/common-library/tests/test_utils_serialization.py diff --git a/packages/common-library/src/common_library/utils/pydantic_fields_extension.py b/packages/common-library/src/common_library/utils/pydantic_fields_extension.py new file mode 100644 index 00000000000..f2f6d59a5f4 --- /dev/null +++ b/packages/common-library/src/common_library/utils/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/utils/serialization.py b/packages/common-library/src/common_library/utils/serialization.py new file mode 100644 index 00000000000..91f41aad795 --- /dev/null +++ b/packages/common-library/src/common_library/utils/serialization.py @@ -0,0 +1,32 @@ +from typing import Any + +from common_library.utils.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/test_utils_pydantic_extension.py b/packages/common-library/tests/test_utils_pydantic_extension.py new file mode 100644 index 00000000000..72634f5762d --- /dev/null +++ b/packages/common-library/tests/test_utils_pydantic_extension.py @@ -0,0 +1,76 @@ +from typing import Literal + +import pytest +from common_library.utils.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_utils_serialization.py b/packages/common-library/tests/test_utils_serialization.py new file mode 100644 index 00000000000..3a55de6026b --- /dev/null +++ b/packages/common-library/tests/test_utils_serialization.py @@ -0,0 +1,30 @@ +from typing import Final + +import pytest +from models_library.utils.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) From cb7ac13a2185cda98e578d9578f98e7e9a844a4f Mon Sep 17 00:00:00 2001 From: Giancarlo Romeo Date: Mon, 7 Oct 2024 14:49:55 +0200 Subject: [PATCH 09/16] add common modules --- .../{utils => }/pydantic_fields_extension.py | 0 .../pydantic_networks_extension.py | 5 +++++ .../{utils => }/serialization.py | 2 +- ...n.py => test_pydantic_fields_extension.py} | 6 +----- .../tests/test_pydantic_networks_extension.py | 20 +++++++++++++++++++ ...serialization.py => test_serialization.py} | 2 +- 6 files changed, 28 insertions(+), 7 deletions(-) rename packages/common-library/src/common_library/{utils => }/pydantic_fields_extension.py (100%) create mode 100644 packages/common-library/src/common_library/pydantic_networks_extension.py rename packages/common-library/src/common_library/{utils => }/serialization.py (93%) rename packages/common-library/tests/{test_utils_pydantic_extension.py => test_pydantic_fields_extension.py} (92%) create mode 100644 packages/common-library/tests/test_pydantic_networks_extension.py rename packages/common-library/tests/{test_utils_serialization.py => test_serialization.py} (90%) diff --git a/packages/common-library/src/common_library/utils/pydantic_fields_extension.py b/packages/common-library/src/common_library/pydantic_fields_extension.py similarity index 100% rename from packages/common-library/src/common_library/utils/pydantic_fields_extension.py rename to packages/common-library/src/common_library/pydantic_fields_extension.py 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/utils/serialization.py b/packages/common-library/src/common_library/serialization.py similarity index 93% rename from packages/common-library/src/common_library/utils/serialization.py rename to packages/common-library/src/common_library/serialization.py index 91f41aad795..510bdf6a469 100644 --- a/packages/common-library/src/common_library/utils/serialization.py +++ b/packages/common-library/src/common_library/serialization.py @@ -1,6 +1,6 @@ from typing import Any -from common_library.utils.pydantic_fields_extension import get_type +from common_library.pydantic_fields_extension import get_type from pydantic import BaseModel, SecretStr diff --git a/packages/common-library/tests/test_utils_pydantic_extension.py b/packages/common-library/tests/test_pydantic_fields_extension.py similarity index 92% rename from packages/common-library/tests/test_utils_pydantic_extension.py rename to packages/common-library/tests/test_pydantic_fields_extension.py index 72634f5762d..50ff5443c41 100644 --- a/packages/common-library/tests/test_utils_pydantic_extension.py +++ b/packages/common-library/tests/test_pydantic_fields_extension.py @@ -1,11 +1,7 @@ from typing import Literal import pytest -from common_library.utils.pydantic_fields_extension import ( - get_type, - is_literal, - is_nullable, -) +from common_library.pydantic_fields_extension import get_type, is_literal, is_nullable from pydantic import BaseModel, Field 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_utils_serialization.py b/packages/common-library/tests/test_serialization.py similarity index 90% rename from packages/common-library/tests/test_utils_serialization.py rename to packages/common-library/tests/test_serialization.py index 3a55de6026b..d53db58809c 100644 --- a/packages/common-library/tests/test_utils_serialization.py +++ b/packages/common-library/tests/test_serialization.py @@ -1,7 +1,7 @@ from typing import Final import pytest -from models_library.utils.serialization import model_dump_with_secrets +from common_library.serialization import model_dump_with_secrets from pydantic import BaseModel, SecretStr From 0ead0b4ec2a4692b3572929b52125c4ef3fffabf Mon Sep 17 00:00:00 2001 From: Giancarlo Romeo Date: Mon, 7 Oct 2024 15:44:56 +0200 Subject: [PATCH 10/16] update requirements --- packages/models-library/requirements/_base.in | 1 + packages/models-library/requirements/ci.txt | 1 + packages/models-library/requirements/dev.txt | 1 + 3 files changed, 3 insertions(+) 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/ From 727c6349575935305d2786bbb7bcaa99c15a835a Mon Sep 17 00:00:00 2001 From: Giancarlo Romeo Date: Mon, 7 Oct 2024 15:49:06 +0200 Subject: [PATCH 11/16] add py.typed --- packages/common-library/src/common_library/py.typed | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 packages/common-library/src/common_library/py.typed 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 From f387ebb1b979c8e6c4fa2aac3685a57c903dd713 Mon Sep 17 00:00:00 2001 From: Giancarlo Romeo Date: Mon, 7 Oct 2024 15:54:19 +0200 Subject: [PATCH 12/16] add me as codeowner --- .github/CODEOWNERS | 1 + 1 file changed, 1 insertion(+) 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 From 5ed512a04cc659cc4378d7dcb7afcf49d0fb0a56 Mon Sep 17 00:00:00 2001 From: Giancarlo Romeo Date: Mon, 7 Oct 2024 16:06:05 +0200 Subject: [PATCH 13/16] update requirements --- packages/service-library/requirements/_base.in | 1 + packages/service-library/requirements/ci.txt | 1 + packages/service-library/requirements/ci[aiohttp].txt | 1 + packages/service-library/requirements/ci[all].txt | 1 + packages/service-library/requirements/ci[fastapi].txt | 1 + packages/service-library/requirements/dev.txt | 1 + packages/service-library/requirements/dev[aiohttp].txt | 1 + packages/service-library/requirements/dev[all].txt | 1 + packages/service-library/requirements/dev[fastapi].txt | 1 + 9 files changed, 9 insertions(+) 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/ From 7bc87155a027c9a3a5dbec65f3fbc2f3dbad8448 Mon Sep 17 00:00:00 2001 From: Giancarlo Romeo Date: Mon, 7 Oct 2024 16:06:22 +0200 Subject: [PATCH 14/16] update requirements --- packages/aws-library/requirements/_base.in | 1 + packages/dask-task-models-library/requirements/_base.in | 1 + packages/dask-task-models-library/requirements/ci.txt | 1 + packages/dask-task-models-library/requirements/dev.txt | 1 + packages/notifications-library/requirements/_base.in | 1 + packages/notifications-library/requirements/ci.txt | 1 + packages/notifications-library/requirements/dev.txt | 1 + packages/service-integration/requirements/_base.in | 1 + packages/service-integration/requirements/ci.txt | 1 + packages/service-integration/requirements/dev.txt | 1 + packages/settings-library/requirements/_base.in | 5 ++++- packages/settings-library/requirements/ci.txt | 1 + packages/settings-library/requirements/dev.txt | 1 + packages/simcore-sdk/requirements/_base.in | 2 ++ packages/simcore-sdk/requirements/ci.txt | 1 + packages/simcore-sdk/requirements/dev.txt | 1 + 16 files changed, 20 insertions(+), 1 deletion(-) 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/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/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/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/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/ From 18ad6d18f199e50057dea7d11154f1706adbeb66 Mon Sep 17 00:00:00 2001 From: Giancarlo Romeo Date: Mon, 7 Oct 2024 16:24:29 +0200 Subject: [PATCH 15/16] update requirements --- services/agent/requirements/_base.in | 1 + services/agent/requirements/ci.txt | 1 + services/agent/requirements/dev.txt | 1 + services/api-server/requirements/_base.in | 1 + services/api-server/requirements/ci.txt | 1 + services/api-server/requirements/dev.txt | 1 + services/autoscaling/requirements/_base.in | 1 + services/autoscaling/requirements/ci.txt | 1 + services/autoscaling/requirements/dev.txt | 1 + services/catalog/requirements/_base.in | 1 + services/catalog/requirements/ci.txt | 1 + services/catalog/requirements/dev.txt | 1 + services/clusters-keeper/requirements/_base.in | 1 + services/clusters-keeper/requirements/ci.txt | 1 + services/clusters-keeper/requirements/dev.txt | 1 + services/dask-sidecar/requirements/_base.in | 1 + services/dask-sidecar/requirements/ci.txt | 1 + services/dask-sidecar/requirements/dev.txt | 1 + services/datcore-adapter/requirements/_base.in | 1 + services/datcore-adapter/requirements/ci.txt | 1 + services/datcore-adapter/requirements/dev.txt | 1 + services/director-v2/requirements/_base.in | 1 + services/director-v2/requirements/ci.txt | 1 + services/director-v2/requirements/dev.txt | 1 + services/dynamic-scheduler/requirements/_base.in | 1 + services/dynamic-scheduler/requirements/ci.txt | 1 + services/dynamic-scheduler/requirements/dev.txt | 1 + services/dynamic-sidecar/requirements/_base.in | 1 + services/dynamic-sidecar/requirements/ci.txt | 1 + services/dynamic-sidecar/requirements/dev.txt | 1 + services/efs-guardian/requirements/_base.in | 1 + services/efs-guardian/requirements/ci.txt | 1 + services/efs-guardian/requirements/dev.txt | 1 + services/invitations/requirements/_base.in | 1 + services/invitations/requirements/ci.txt | 3 ++- services/invitations/requirements/dev.txt | 4 +++- services/payments/requirements/_base.in | 1 + services/payments/requirements/ci.txt | 2 ++ services/payments/requirements/dev.txt | 1 + services/resource-usage-tracker/requirements/_base.in | 1 + services/resource-usage-tracker/requirements/ci.txt | 1 + services/resource-usage-tracker/requirements/dev.txt | 1 + services/storage/requirements/_base.in | 1 + services/storage/requirements/ci.txt | 1 + services/storage/requirements/dev.txt | 1 + 45 files changed, 49 insertions(+), 2 deletions(-) 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..9b554714968 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/models-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/ From f63a537f2bfda15b20d83ea74f902c066210c27e Mon Sep 17 00:00:00 2001 From: Giancarlo Romeo Date: Mon, 7 Oct 2024 16:30:27 +0200 Subject: [PATCH 16/16] minor fixes --- packages/common-library/.gitignore | 3 --- packages/common-library/VERSION | 2 +- packages/common-library/setup.py | 2 +- services/api-server/requirements/ci.txt | 2 +- 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/common-library/.gitignore b/packages/common-library/.gitignore index 98149591573..e69de29bb2d 100644 --- a/packages/common-library/.gitignore +++ b/packages/common-library/.gitignore @@ -1,3 +0,0 @@ - -# erdantic outputs -erd-*.svg diff --git a/packages/common-library/VERSION b/packages/common-library/VERSION index 0ea3a944b39..6e8bf73aa55 100644 --- a/packages/common-library/VERSION +++ b/packages/common-library/VERSION @@ -1 +1 @@ -0.2.0 +0.1.0 diff --git a/packages/common-library/setup.py b/packages/common-library/setup.py index ceef017dfb1..4e381f5bbc2 100644 --- a/packages/common-library/setup.py +++ b/packages/common-library/setup.py @@ -34,7 +34,7 @@ def read_reqs(reqs_path: Path) -> set[str]: "version": Path(CURRENT_DIR / "VERSION").read_text().strip(), "author": "Giancarlo Romeo (giancarloromeo)", "description": "Core service library for simcore pydantic common", - "python_requires": "~=3.10", + "python_requires": "~=3.11", "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", diff --git a/services/api-server/requirements/ci.txt b/services/api-server/requirements/ci.txt index 9b554714968..844706d5fb2 100644 --- a/services/api-server/requirements/ci.txt +++ b/services/api-server/requirements/ci.txt @@ -11,7 +11,7 @@ --requirement _test.txt # installs this repo's packages -simcore-common-library @ ../../packages/models-library +simcore-common-library @ ../../packages/common-library simcore-models-library @ ../../packages/models-library simcore-postgres-database @ ../../packages/postgres-database/ pytest-simcore @ ../../packages/pytest-simcore/