From 132a4f8a09c632aeeea86157fc731c88e084dcbd Mon Sep 17 00:00:00 2001 From: Mads Bisgaard Date: Mon, 23 Oct 2023 11:33:27 +0200 Subject: [PATCH 1/3] update workflow before publishing python package fix dependency issue and bump version point to website in project description fix broken dependency improve doc add github token to download artifacts ensure only read-access @wvangeit yet another attempt at downloading artifacts make sure to use repo that ran the trigger wf another attempt at fixing change owner allow publishing to testpypi also when pr minor change revert minor (but breaking) change minor fix add debug messages another debug message hopefully the final version final fix minor fix move master and tag to individual jobs add debug messages add python script for determining semantic version minor changes minor changes improve error handling and add version file to artifacts check if release minor fix ensure to enter venv also when tagging source venv in publishin workflow ensure only master add script for testing 'pure' semver adapt workflows to new python script minor change attempt to evaluate expressions correctly several fixes to fix tests ensure repo is checked out in publish workflow several small fixes cleanup debug minor cleanup mionr changes add debug message minor change minor change yet another try minor change minor change minor change mionr change minor changes correct workflow run id cosmetic change avoid using gh change to a single job for publishing minor cleanup swap loops in clean up jobs correction get correct versions of github workflow files update a couple of other files update a few more tests update yet another file yet another file From 379ac040d434f8b64688ff7d95007bfde37ca37a Mon Sep 17 00:00:00 2001 From: Mads Bisgaard Date: Mon, 15 Jul 2024 14:26:09 +0200 Subject: [PATCH 2/3] fix OSPARC_API_BASE_URL has preference --- clients/python/client/osparc/_models.py | 3 ++- clients/python/test/test_osparc/test_apis.py | 21 ++++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/clients/python/client/osparc/_models.py b/clients/python/client/osparc/_models.py index b5266f28..136c653f 100644 --- a/clients/python/client/osparc/_models.py +++ b/clients/python/client/osparc/_models.py @@ -1,7 +1,7 @@ from typing import Optional from uuid import UUID -from pydantic import AnyHttpUrl, Field, field_validator +from pydantic import AliasChoices, AnyHttpUrl, Field, field_validator from pydantic_settings import BaseSettings @@ -29,6 +29,7 @@ class ConfigurationModel(BaseSettings): OSPARC_API_HOST: AnyHttpUrl = Field( default=..., + validation_alias=AliasChoices("OSPARC_API_BASE_URL", "OSPARC_API_HOST"), description="OSPARC api url", examples=["https://api.osparc-master.speag.com/"], ) diff --git a/clients/python/test/test_osparc/test_apis.py b/clients/python/test/test_osparc/test_apis.py index 4f01a961..4b27d101 100644 --- a/clients/python/test/test_osparc/test_apis.py +++ b/clients/python/test/test_osparc/test_apis.py @@ -70,29 +70,46 @@ def check_headers(**kwargs): @pytest.mark.parametrize( "OSPARC_API_HOST", ["https://api.foo.com", "https://api.bar.com/", None] ) +@pytest.mark.parametrize( + "OSPARC_API_BASE_URL", ["https://api.sdkjbf.com", "https://api.alskjd.com/", None] +) @pytest.mark.parametrize("OSPARC_API_KEY", ["key", None]) @pytest.mark.parametrize("OSPARC_API_SECRET", ["secret", None]) def test_api_client_constructor( monkeypatch: pytest.MonkeyPatch, OSPARC_API_HOST: Optional[str], + OSPARC_API_BASE_URL: Optional[str], OSPARC_API_KEY: Optional[str], OSPARC_API_SECRET: Optional[str], ): with monkeypatch.context() as patch: patch.delenv("OSPARC_API_HOST", raising=False) + patch.delenv("OSPARC_API_BASE_URL", raising=False) patch.delenv("OSPARC_API_KEY", raising=False) patch.delenv("OSPARC_API_SECRET", raising=False) if OSPARC_API_HOST is not None: patch.setenv("OSPARC_API_HOST", OSPARC_API_HOST) + if OSPARC_API_BASE_URL is not None: + patch.setenv("OSPARC_API_BASE_URL", OSPARC_API_BASE_URL) if OSPARC_API_KEY is not None: patch.setenv("OSPARC_API_KEY", OSPARC_API_KEY) if OSPARC_API_SECRET is not None: patch.setenv("OSPARC_API_SECRET", OSPARC_API_SECRET) - if OSPARC_API_HOST and OSPARC_API_KEY and OSPARC_API_SECRET: + if ( + (OSPARC_API_HOST or OSPARC_API_BASE_URL) + and OSPARC_API_KEY + and OSPARC_API_SECRET + ): api = ApiClient() - assert api.configuration.host == OSPARC_API_HOST.rstrip("/") + # if OSPARC_API_BASE_URL and OSPARC_API_HOST are both + # in env, the former has preference + if OSPARC_API_BASE_URL is not None: + assert api.configuration.host == OSPARC_API_BASE_URL.rstrip("/") + elif OSPARC_API_HOST is not None: + assert api.configuration.host == OSPARC_API_HOST.rstrip("/") + assert api.configuration.username == OSPARC_API_KEY assert api.configuration.password == OSPARC_API_SECRET From a5b96331a5af03e3bc41480caecca378d6112693 Mon Sep 17 00:00:00 2001 From: Mads Bisgaard Date: Mon, 15 Jul 2024 14:27:25 +0200 Subject: [PATCH 3/3] document server side changes --- clients/python/client/osparc/_models.py | 1 + 1 file changed, 1 insertion(+) diff --git a/clients/python/client/osparc/_models.py b/clients/python/client/osparc/_models.py index 136c653f..24c74243 100644 --- a/clients/python/client/osparc/_models.py +++ b/clients/python/client/osparc/_models.py @@ -27,6 +27,7 @@ def _validate_uuids(cls, v: Optional[str]) -> Optional[str]: class ConfigurationModel(BaseSettings): """Model for capturing env vars which should go into the Configuration""" + # Service side: https://github.com/ITISFoundation/osparc-simcore/pull/5966 OSPARC_API_HOST: AnyHttpUrl = Field( default=..., validation_alias=AliasChoices("OSPARC_API_BASE_URL", "OSPARC_API_HOST"),