Skip to content
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

feature/update mex-common to 0.48.0 #241

Merged
merged 2 commits into from
Jan 29, 2025
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changes

- update mex-common to 0.48.0

### Deprecated

### Removed

- remove backend settings that were just duplicating common settings
- removed BackendIdentityProvider enum, because it is now included in common

### Fixed

### Security
Expand Down
4 changes: 2 additions & 2 deletions mex/backend/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
__path__ = extend_path(__path__, __name__)

from mex.backend.identity.provider import GraphIdentityProvider
from mex.backend.types import BackendIdentityProvider
from mex.common.identity.registry import register_provider
from mex.common.types import IdentityProvider

register_provider(BackendIdentityProvider.GRAPH, GraphIdentityProvider)
register_provider(IdentityProvider.GRAPH, GraphIdentityProvider)
21 changes: 1 addition & 20 deletions mex/backend/settings.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@
from pydantic import Field, SecretStr

from mex.backend.types import APIKeyDatabase, APIUserDatabase, BackendIdentityProvider
from mex.backend.types import APIKeyDatabase, APIUserDatabase
from mex.common.settings import BaseSettings
from mex.common.types import IdentityProvider, Sink


class BackendSettings(BaseSettings):
"""Settings definition for the backend server."""

debug: bool = Field(
False,
alias="reload",
description="Enable debug mode.",
validation_alias="MEX_DEBUG",
)
sink: list[Sink] = Field(
[Sink.GRAPH],
description=(
"Where to send ingested data. Defaults to writing to the graph db."
),
validation_alias="MEX_SINK",
)
backend_host: str = Field(
"localhost",
min_length=1,
Expand Down Expand Up @@ -70,8 +56,3 @@ class BackendSettings(BaseSettings):
description="Database of users.",
validation_alias="MEX_BACKEND_API_USER_DATABASE",
)
identity_provider: IdentityProvider | BackendIdentityProvider = Field(
IdentityProvider.MEMORY,
description="Provider to assign stableTargetIds to new model instances.",
validation_alias="MEX_IDENTITY_PROVIDER",
) # type: ignore[assignment]
6 changes: 0 additions & 6 deletions mex/backend/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@ class APIUserDatabase(BaseModel):
write: dict[str, APIUserPassword] = {}


class BackendIdentityProvider(Enum):
"""Identity providers implemented by mex-backend."""

GRAPH = "graph"


class DynamicStrEnum(EnumMeta):
"""Meta class to dynamically populate the an enumeration from a list of strings."""

Expand Down
8 changes: 4 additions & 4 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies = [
"fastapi>=0.115,<1",
"httpx>=0.27,<1",
"jinja2>=3,<4",
"mex-common @ git+https://github.com/robert-koch-institut/mex-common.git@0.47.1",
"mex-common @ git+https://github.com/robert-koch-institut/mex-common.git@0.48.0",
"neo4j>=5,<6",
"pydantic>=2,<3",
"starlette>=0.41,<1",
Expand Down
6 changes: 2 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from mex.backend.main import app
from mex.backend.rules.helpers import create_and_get_rule_set
from mex.backend.settings import BackendSettings
from mex.backend.types import APIKeyDatabase, APIUserDatabase, BackendIdentityProvider
from mex.backend.types import APIKeyDatabase, APIUserDatabase
from mex.common.connector import CONNECTOR_STORE
from mex.common.models import (
MEX_PRIMARY_SOURCE_STABLE_TARGET_ID,
Expand Down Expand Up @@ -186,9 +186,7 @@ def set_identity_provider(is_integration_test: bool, monkeypatch: MonkeyPatch) -
for settings in (BaseSettings.get(), BackendSettings.get()):
if is_integration_test:
monkeypatch.setitem(settings.model_config, "validate_assignment", False)
monkeypatch.setattr(
settings, "identity_provider", BackendIdentityProvider.GRAPH
)
monkeypatch.setattr(settings, "identity_provider", IdentityProvider.GRAPH)
else:
monkeypatch.setattr(settings, "identity_provider", IdentityProvider.MEMORY)

Expand Down
Loading