Skip to content

🔨 Remove dev env var remnants #214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions clients/python/src/osparc/_api_files_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
DEFAULT_TIMEOUT_SECONDS,
PaginationGenerator,
compute_sha256,
dev_features_enabled,
file_chunk_generator,
)

Expand All @@ -60,11 +59,6 @@ def __init__(self, api_client: ApiClient):
else None
)

def __getattr__(self, name: str) -> Any:
if (name in FilesApi._dev_features) and (not dev_features_enabled()):
raise NotImplementedError(f"FilesApi.{name} is still under development")
return super().__getattribute__(name)

def download_file(
self,
file_id: str,
Expand Down
11 changes: 1 addition & 10 deletions clients/python/src/osparc/_api_solvers_api.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Wraps osparc_client.api.solvers_api

from typing import Any, List, Optional
from typing import List, Optional

import httpx
from osparc_client.api.solvers_api import SolversApi as _SolversApi
Expand All @@ -12,8 +12,6 @@
_DEFAULT_PAGINATION_LIMIT,
_DEFAULT_PAGINATION_OFFSET,
PaginationGenerator,
dev_feature,
dev_features_enabled,
)

import warnings
Expand Down Expand Up @@ -41,11 +39,6 @@ def __init__(self, api_client: ApiClient):
else None
)

def __getattr__(self, name: str) -> Any:
if (name in SolversApi._dev_features) and (not dev_features_enabled()):
raise NotImplementedError(f"SolversApi.{name} is still under development")
return super().__getattribute__(name)

def list_solver_ports(
self, solver_key: str, version: str, **kwargs
) -> List[SolverPort]:
Expand All @@ -54,7 +47,6 @@ def list_solver_ports(
)
return page.items if page.items else []

@dev_feature
def iter_jobs(self, solver_key: str, version: str, **kwargs) -> PaginationGenerator:
"""Returns an iterator through which one can iterate over
all Jobs submitted to the solver
Expand Down Expand Up @@ -87,7 +79,6 @@ def _pagination_method():
auth=self._auth,
)

@dev_feature
def jobs(self, solver_key: str, version: str, **kwargs) -> PaginationGenerator:
warnings.warn(
"The 'jobs' method is deprecated and will be removed in a future version. "
Expand Down
8 changes: 1 addition & 7 deletions clients/python/src/osparc/_api_studies_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import logging
from pathlib import Path
from tempfile import mkdtemp
from typing import Any, Optional
from typing import Optional

import httpx
from .models import JobInputs, JobLogsMap, PageStudy
Expand All @@ -18,7 +18,6 @@
_DEFAULT_PAGINATION_LIMIT,
_DEFAULT_PAGINATION_OFFSET,
PaginationGenerator,
dev_features_enabled,
)
import warnings

Expand Down Expand Up @@ -58,11 +57,6 @@ def __init__(self, api_client: ApiClient):
else None
)

def __getattr__(self, name: str) -> Any:
if (name in StudiesApi._dev_features) and (not dev_features_enabled()):
raise NotImplementedError(f"StudiesApi.{name} is still under development")
return super().__getattribute__(name)

def create_study_job(self, study_id: str, job_inputs: JobInputs, **kwargs):
kwargs = {**kwargs, **ParentProjectInfo().model_dump(exclude_none=True)}
return super().create_study_job(study_id, job_inputs, **kwargs)
Expand Down
16 changes: 0 additions & 16 deletions clients/python/src/osparc/_utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import asyncio
import hashlib
import os
from functools import wraps
from pathlib import Path
from typing import AsyncGenerator, Callable, Generator, Optional, Tuple, TypeVar, Union

Expand Down Expand Up @@ -119,17 +117,3 @@ async def compute_sha256(file: Path) -> str:
break
sha256.update(data)
return sha256.hexdigest()


def dev_features_enabled() -> bool:
return os.environ.get("OSPARC_DEV_FEATURES_ENABLED") == "1"


def dev_feature(func: Callable):
@wraps(func)
def _wrapper(*args, **kwargs):
if not dev_features_enabled():
raise NotImplementedError(f"{func.__name__} is still under development")
return func(*args, **kwargs)

return _wrapper
5 changes: 0 additions & 5 deletions clients/python/test/e2e/_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
import subprocess
from pathlib import Path
from typing import Optional
Expand All @@ -11,10 +10,6 @@
assert _clients_python_dir.is_dir()


def osparc_dev_features_enabled() -> bool:
return os.environ.get("OSPARC_DEV_FEATURES_ENABLED") == "1"


def repo_version() -> Version:
subprocess.run(
"make VERSION", cwd=_clients_python_dir.resolve(), shell=True
Expand Down
21 changes: 7 additions & 14 deletions clients/python/test/e2e/ci/e2e/e2e/_models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import configparser
from pathlib import Path
from typing import Dict
from typing import Dict, Final, Set

import osparc
from packaging.version import InvalidVersion, Version
Expand Down Expand Up @@ -38,18 +38,20 @@ def is_empty(v):
return v is None or v == ""


_CLIENT_VERSION_IDS: Final[Set[str]] = {"latest_release", "latest_master"}


class ClientSettings(BaseSettings):
"""Holds data about client configuration.
This data should uniquely determine how to install client
"""

version: str
dev_features: bool = False

@field_validator("version", mode="after")
@classmethod
def _validate_client(cls, v):
if v not in {"latest_release", "latest_master"}:
if v not in _CLIENT_VERSION_IDS:
try:
version = Version(v)
assert version == Version(osparc.__version__)
Expand All @@ -62,21 +64,12 @@ def _validate_client(cls, v):
@property
def ref(self) -> str:
"""Returns the reference for this client in the compatibility table"""
if self.dev_features:
return f"{osparc.__version__}+dev_features"
else:
return f"{osparc.__version__}-dev_features"
return f"{osparc.__version__}"

@property
def compatibility_ref(self) -> str:
"""Returns the reference for this client in the compatibility table"""
if self.version == "latest_master":
if self.dev_features:
return "master+dev_features"
else:
return "master-dev_features"
else:
return "production"
return "master" if self.version == "latest_master" else "production"


class PytestConfig(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
server,client,is_compatible
api.osparc-master.speag.com,master+dev_features,True
api.osparc-master.speag.com,master-dev_features,True
api.osparc-master.speag.com,master,True
api.osparc-master.speag.com,production,True
api.osparc-staging.speag.com,master+dev_features,False
api.osparc-staging.speag.com,master-dev_features,True
api.osparc-staging.speag.com,master,True
api.osparc-staging.speag.com,production,True
api.osparc.speag.com,master+dev_features,False
api.osparc.speag.com,master-dev_features,False
api.osparc.speag.com,master,False
api.osparc.speag.com,production,True
api.osparc-staging.io,master+dev_features,False
api.osparc-staging.io,master-dev_features,True
api.osparc-staging.io,master,True
api.osparc-staging.io,production,True
api.osparc.io,master+dev_features,False
api.osparc.io,master-dev_features,False
api.osparc.io,master,False
api.osparc.io,production,True
api.sim4life.io,master+dev_features,False
api.sim4life.io,master-dev_features,True
api.sim4life.io,master,False
api.sim4life.io,production,True
3 changes: 0 additions & 3 deletions clients/python/test/e2e/ci/e2e/e2e/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ def generate_ini(
envs.append(f"OSPARC_API_HOST={urlparse(server_cfg.host).geturl()}")
envs.append(f"OSPARC_API_KEY={server_cfg.key.get_secret_value()}")
envs.append(f"OSPARC_API_SECRET={server_cfg.secret.get_secret_value()}")
envs.append(
f"OSPARC_DEV_FEATURES_ENABLED=" f"{1 if client_cfg.dev_features else 0}"
)

html_log = (
artifacts_dir
Expand Down
5 changes: 0 additions & 5 deletions clients/python/test/test_osparc/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,3 @@ def cfg(faker: Faker) -> osparc.Configuration:
@pytest.fixture
def api_client(cfg: osparc.Configuration) -> osparc.ApiClient:
return osparc.ApiClient(configuration=cfg)


@pytest.fixture
def dev_mode_enabled(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setenv("OSPARC_DEV_FEATURES_ENABLED", "1")
1 change: 0 additions & 1 deletion clients/python/test/test_osparc/test_apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ def test_create_jobs_parent_headers(
mocker: MockerFixture,
faker: Faker,
create_parent_env: Callable,
dev_mode_enabled: None,
parent_env: bool,
api_client: ApiClient,
):
Expand Down
Loading