Skip to content

Commit 6e76143

Browse files
Merge branch 'is4481/upgrade-libs' into is4481/upgrade-services
2 parents 3f781e6 + fa7072d commit 6e76143

File tree

128 files changed

+688
-65
lines changed

Some content is hidden

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

128 files changed

+688
-65
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Makefile @pcrespov @sanderegg
1313
/api/ @sanderegg @pcrespov @matusdrobuliak66
1414
/ci/ @sanderegg @pcrespov
1515
/docs/ @pcrespov
16+
/packages/common-library/ @giancarloromeo
1617
/packages/models-library/ @sanderegg @pcrespov @matusdrobuliak66
1718
/packages/postgres-database/ @matusdrobuliak66
1819
/packages/pytest-simcore/ @pcrespov @sanderegg

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

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ jobs:
5454
aws-library: ${{ steps.filter.outputs.aws-library }}
5555
dask-task-models-library: ${{ steps.filter.outputs.dask-task-models-library }}
5656
models-library: ${{ steps.filter.outputs.models-library }}
57+
common-library: ${{ steps.filter.outputs.common-library }}
5758
notifications-library: ${{ steps.filter.outputs.notifications-library }}
5859
postgres-database: ${{ steps.filter.outputs.postgres-database }}
5960
service-integration: ${{ steps.filter.outputs.service-integration }}
@@ -110,6 +111,8 @@ jobs:
110111
- 'services/docker-compose*'
111112
- 'scripts/mypy/*'
112113
- 'mypy.ini'
114+
common-library:
115+
- 'packages/common-library/**'
113116
notifications-library:
114117
- 'packages/notifications-library/**'
115118
- 'packages/postgres-database/**'
@@ -1593,6 +1596,47 @@ jobs:
15931596
with:
15941597
flags: unittests #optional
15951598

1599+
unit-test-common-library:
1600+
needs: changes
1601+
if: ${{ needs.changes.outputs.common-library == 'true' || github.event_name == 'push' }}
1602+
timeout-minutes: 18 # if this timeout gets too small, then split the tests
1603+
name: "[unit] common-library"
1604+
runs-on: ${{ matrix.os }}
1605+
strategy:
1606+
matrix:
1607+
python: ["3.11"]
1608+
os: [ubuntu-22.04]
1609+
fail-fast: false
1610+
steps:
1611+
- uses: actions/checkout@v4
1612+
- name: setup docker buildx
1613+
id: buildx
1614+
uses: docker/setup-buildx-action@v3
1615+
with:
1616+
driver: docker-container
1617+
- name: setup python environment
1618+
uses: actions/setup-python@v5
1619+
with:
1620+
python-version: ${{ matrix.python }}
1621+
- name: install uv
1622+
uses: yezz123/setup-uv@v4
1623+
- uses: actions/cache@v4
1624+
id: cache-uv
1625+
with:
1626+
path: ~/.cache/uv
1627+
key: ${{ runner.os }}-${{ github.job }}-python-${{ matrix.python }}-uv
1628+
- name: show system version
1629+
run: ./ci/helpers/show_system_versions.bash
1630+
- name: install
1631+
run: ./ci/github/unit-testing/common-library.bash install
1632+
- name: typecheck
1633+
run: ./ci/github/unit-testing/common-library.bash typecheck
1634+
- name: test
1635+
run: ./ci/github/unit-testing/common-library.bash test
1636+
- uses: codecov/[email protected]
1637+
with:
1638+
flags: unittests #optional
1639+
15961640
unit-test-notifications-library:
15971641
needs: changes
15981642
if: ${{ needs.changes.outputs.notifications-library == 'true' || github.event_name == 'push' }}
@@ -1704,6 +1748,7 @@ jobs:
17041748
unit-test-efs-guardian,
17051749
unit-test-frontend,
17061750
unit-test-models-library,
1751+
unit-test-common-library,
17071752
unit-test-notifications-library,
17081753
unit-test-osparc-gateway-server,
17091754
unit-test-payments,
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
3+
set -o errexit # abort on nonzero exitstatus
4+
set -o nounset # abort on unbound variable
5+
set -o pipefail # don't hide errors within pipes
6+
IFS=$'\n\t'
7+
8+
install() {
9+
make devenv
10+
# shellcheck source=/dev/null
11+
source .venv/bin/activate
12+
pushd packages/common-library
13+
make install-ci
14+
popd
15+
uv pip list
16+
}
17+
18+
test() {
19+
# shellcheck source=/dev/null
20+
source .venv/bin/activate
21+
pushd packages/common-library
22+
make tests-ci
23+
popd
24+
}
25+
26+
typecheck() {
27+
# shellcheck source=/dev/null
28+
source .venv/bin/activate
29+
uv pip install mypy
30+
pushd packages/common-library
31+
make mypy
32+
popd
33+
}
34+
35+
# Check if the function exists (bash specific)
36+
if declare -f "$1" >/dev/null; then
37+
# call arguments verbatim
38+
"$@"
39+
else
40+
# Show a helpful error
41+
echo "'$1' is not a known function name" >&2
42+
exit 1
43+
fi

packages/aws-library/requirements/_base.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Specifies third-party dependencies for 'aws-library'
33
#
44
--constraint ../../../requirements/constraints.txt
5+
--requirement ../../../packages/common-library/requirements/_base.in
56
--requirement ../../../packages/models-library/requirements/_base.in
67
--requirement ../../../packages/service-library/requirements/_base.in
78
--requirement ../../../packages/settings-library/requirements/_base.in

packages/aws-library/src/aws_library/ec2/_errors.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
# pylint: disable=too-many-ancestors
2-
from typing import Any
3-
4-
from models_library.errors_classes import OsparcErrorMixin
2+
from common_library.errors_classes import OsparcErrorMixin
53

64

75
class EC2BaseError(OsparcErrorMixin, Exception):
8-
def __init__(self, **ctx: Any) -> None:
9-
super().__init__(**ctx)
6+
pass
107

118

129
class EC2RuntimeError(EC2BaseError, RuntimeError):

packages/aws-library/src/aws_library/s3/_errors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from models_library.errors_classes import OsparcErrorMixin
1+
from common_library.errors_classes import OsparcErrorMixin
22

33

44
class S3RuntimeError(OsparcErrorMixin, RuntimeError):

packages/aws-library/src/aws_library/ssm/_errors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from models_library.errors_classes import OsparcErrorMixin
1+
from common_library.errors_classes import OsparcErrorMixin
22

33

44
class SSMRuntimeError(OsparcErrorMixin, RuntimeError):

packages/common-library/.gitignore

Whitespace-only changes.

packages/common-library/Makefile

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#
2+
# Targets for DEVELOPMENT of common Library
3+
#
4+
include ../../scripts/common.Makefile
5+
include ../../scripts/common-package.Makefile
6+
7+
.PHONY: requirements
8+
requirements: ## compiles pip requirements (.in -> .txt)
9+
@$(MAKE_C) requirements reqs
10+
11+
12+
.PHONY: install-dev install-prod install-ci
13+
install-dev install-prod install-ci: _check_venv_active ## install app in development/production or CI mode
14+
# installing in $(subst install-,,$@) mode
15+
@uv pip sync requirements/$(subst install-,,$@).txt
16+
17+
18+
.PHONY: tests tests-ci
19+
tests: ## runs unit tests
20+
# running unit tests
21+
@pytest \
22+
--asyncio-mode=auto \
23+
--color=yes \
24+
--cov-config=../../.coveragerc \
25+
--cov-report=term-missing \
26+
--cov=common_library \
27+
--durations=10 \
28+
--exitfirst \
29+
--failed-first \
30+
--pdb \
31+
-vv \
32+
$(CURDIR)/tests
33+
34+
tests-ci: ## runs unit tests [ci-mode]
35+
# running unit tests
36+
@pytest \
37+
--asyncio-mode=auto \
38+
--color=yes \
39+
--cov-append \
40+
--cov-config=../../.coveragerc \
41+
--cov-report=term-missing \
42+
--cov-report=xml \
43+
--cov=common_library \
44+
--durations=10 \
45+
--log-date-format="%Y-%m-%d %H:%M:%S" \
46+
--log-format="%(asctime)s %(levelname)s %(message)s" \
47+
--verbose \
48+
-m "not heavy_load" \
49+
$(CURDIR)/tests

packages/common-library/README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# simcore pydantic common library
2+
3+
Contains the common classes, functions and in general utilities for use in the simcore platform.
4+
5+
## Installation
6+
7+
```console
8+
make help
9+
make install-dev
10+
```
11+
12+
## Test
13+
14+
```console
15+
make help
16+
make test-dev
17+
```
18+
19+
20+
## Diagnostics
21+
22+
How run diagnostics on the service metadata published in a docker registry?
23+
24+
1. Setup environment
25+
```bash
26+
make devenv
27+
source .venv/bin/activate
28+
29+
cd packages/common-library
30+
make install-dev
31+
```
32+
2. Set ``REGISTRY_*`` env vars in ``.env`` (in the repository base folder)
33+
3. Download test data, run diagnostics, archive tests-data, and cleanup
34+
```bash
35+
export DEPLOY_NAME=my-deploy
36+
37+
make pull_test_data >$DEPLOY_NAME-registry-diagnostics.log 2>&1
38+
pytest -vv -m diagnostics >>$DEPLOY_NAME-registry-diagnostics.log 2>&1
39+
zip -r $DEPLOY_NAME-registry-test-data.zip tests/data/.downloaded-ignore
40+
rm -r tests/data/.downloaded-ignore
41+
```
42+
4. Move all ``$DEPLOY_NAME-*`` files to an archive

0 commit comments

Comments
 (0)