fmu-settings 0.1.0__py3-none-any.whl → 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of fmu-settings might be problematic. Click here for more details.
- fmu/settings/_fmu_dir.py +3 -3
- fmu/settings/_resources/__init__.py +5 -0
- fmu/settings/{resources → _resources}/config_managers.py +1 -1
- fmu/settings/_version.py +2 -2
- fmu/settings/models/user_config.py +18 -4
- {fmu_settings-0.1.0.dist-info → fmu_settings-0.2.0.dist-info}/METADATA +1 -1
- {fmu_settings-0.1.0.dist-info → fmu_settings-0.2.0.dist-info}/RECORD +11 -10
- /fmu/settings/{resources/managers.py → _resources/pydantic_resource_manager.py} +0 -0
- {fmu_settings-0.1.0.dist-info → fmu_settings-0.2.0.dist-info}/WHEEL +0 -0
- {fmu_settings-0.1.0.dist-info → fmu_settings-0.2.0.dist-info}/licenses/LICENSE +0 -0
- {fmu_settings-0.1.0.dist-info → fmu_settings-0.2.0.dist-info}/top_level.txt +0 -0
fmu/settings/_fmu_dir.py
CHANGED
|
@@ -4,12 +4,12 @@ from pathlib import Path
|
|
|
4
4
|
from typing import Any, Final, Self, TypeAlias, cast
|
|
5
5
|
|
|
6
6
|
from ._logging import null_logger
|
|
7
|
-
from .
|
|
8
|
-
from .models.user_config import UserConfig
|
|
9
|
-
from .resources.config_managers import (
|
|
7
|
+
from ._resources.config_managers import (
|
|
10
8
|
ProjectConfigManager,
|
|
11
9
|
UserConfigManager,
|
|
12
10
|
)
|
|
11
|
+
from .models.project_config import ProjectConfig
|
|
12
|
+
from .models.user_config import UserConfig
|
|
13
13
|
|
|
14
14
|
logger: Final = null_logger(__name__)
|
|
15
15
|
|
|
@@ -13,7 +13,7 @@ from fmu.settings.models.project_config import ProjectConfig
|
|
|
13
13
|
from fmu.settings.models.user_config import UserConfig
|
|
14
14
|
from fmu.settings.types import ResettableBaseModel, VersionStr # noqa TC001
|
|
15
15
|
|
|
16
|
-
from .
|
|
16
|
+
from .pydantic_resource_manager import PydanticResourceManager
|
|
17
17
|
|
|
18
18
|
if TYPE_CHECKING:
|
|
19
19
|
# Avoid circular dependency for type hint in __init__ only
|
fmu/settings/_version.py
CHANGED
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '0.
|
|
32
|
-
__version_tuple__ = version_tuple = (0,
|
|
31
|
+
__version__ = version = '0.2.0'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 2, 0)
|
|
33
33
|
|
|
34
34
|
__commit_id__ = commit_id = None
|
|
@@ -8,12 +8,18 @@ from typing import Annotated, Self
|
|
|
8
8
|
from uuid import UUID # noqa TC003
|
|
9
9
|
|
|
10
10
|
import annotated_types
|
|
11
|
-
from pydantic import
|
|
11
|
+
from pydantic import (
|
|
12
|
+
AwareDatetime,
|
|
13
|
+
BaseModel,
|
|
14
|
+
SecretStr,
|
|
15
|
+
field_serializer,
|
|
16
|
+
field_validator,
|
|
17
|
+
)
|
|
12
18
|
|
|
13
19
|
from fmu.settings import __version__
|
|
14
20
|
from fmu.settings.types import ResettableBaseModel, VersionStr # noqa TC001
|
|
15
21
|
|
|
16
|
-
|
|
22
|
+
RecentProjectDirectories = Annotated[list[Path], annotated_types.Len(0, 5)]
|
|
17
23
|
|
|
18
24
|
|
|
19
25
|
class UserAPIKeys(BaseModel):
|
|
@@ -38,7 +44,7 @@ class UserConfig(ResettableBaseModel):
|
|
|
38
44
|
version: VersionStr
|
|
39
45
|
created_at: AwareDatetime
|
|
40
46
|
user_api_keys: UserAPIKeys
|
|
41
|
-
|
|
47
|
+
recent_project_directories: RecentProjectDirectories
|
|
42
48
|
|
|
43
49
|
@classmethod
|
|
44
50
|
def reset(cls: type[Self]) -> Self:
|
|
@@ -47,9 +53,17 @@ class UserConfig(ResettableBaseModel):
|
|
|
47
53
|
version=__version__,
|
|
48
54
|
created_at=datetime.now(UTC),
|
|
49
55
|
user_api_keys=UserAPIKeys(),
|
|
50
|
-
|
|
56
|
+
recent_project_directories=[],
|
|
51
57
|
)
|
|
52
58
|
|
|
59
|
+
@field_validator("recent_project_directories", mode="before")
|
|
60
|
+
@classmethod
|
|
61
|
+
def ensure_unique(cls, recent_projects: list[Path]) -> list[Path]:
|
|
62
|
+
"""Ensures that recent_project_directories contains unique entries."""
|
|
63
|
+
if len(recent_projects) != len(set(recent_projects)):
|
|
64
|
+
raise ValueError("recent_project_directories must contain unique entries")
|
|
65
|
+
return recent_projects
|
|
66
|
+
|
|
53
67
|
def obfuscate_secrets(self: Self) -> Self:
|
|
54
68
|
"""Returns a copy of the model with obfuscated secrets.
|
|
55
69
|
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
fmu/__init__.py,sha256=htx6HlMme77I6pZ8U256-2B2cMJuELsu3JN3YM2Efh4,144
|
|
2
2
|
fmu/settings/__init__.py,sha256=x96dVVR-2n2lYD84LGbL7W8l3-r7W_0reUTKZlE7S34,331
|
|
3
|
-
fmu/settings/_fmu_dir.py,sha256
|
|
3
|
+
fmu/settings/_fmu_dir.py,sha256=E8ULohZKwMixkuw9cXK20IxaHaRXmWQ1vbE02QAX_YU,10573
|
|
4
4
|
fmu/settings/_init.py,sha256=5CT7tV2XHz5wuLh97XozyLiKpwogrsfjpxm2dpn7KWE,4097
|
|
5
5
|
fmu/settings/_logging.py,sha256=nEdmZlNCBsB1GfDmFMKCjZmeuRp3CRlbz1EYUemc95Y,1104
|
|
6
|
-
fmu/settings/_version.py,sha256=
|
|
6
|
+
fmu/settings/_version.py,sha256=Dg8AmJomLVpjKL6prJylOONZAPRtB86LOce7dorQS_A,704
|
|
7
7
|
fmu/settings/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
8
|
fmu/settings/types.py,sha256=aeXEsznBTT1YRRY_LSRqK1j2gmMmyLYYTGYl3a9fweU,513
|
|
9
|
+
fmu/settings/_resources/__init__.py,sha256=LHYR_F7lNGdv8N6R3cEwds5CJQpkOthXFqsEs24vgF8,118
|
|
10
|
+
fmu/settings/_resources/config_managers.py,sha256=b8DUtRHti1n2pSuw5eCQko7e7NKOzP2BH6dNPJFd2ck,6869
|
|
11
|
+
fmu/settings/_resources/pydantic_resource_manager.py,sha256=t4Rp6MOSIq85iKfDHZLJxeGRj8S3SKanWHWri0p9wV8,3161
|
|
9
12
|
fmu/settings/models/__init__.py,sha256=lRlXgl55ba2upmDzdvzx8N30JMq2Osnm8aa_xxTZn8A,112
|
|
10
13
|
fmu/settings/models/_enums.py,sha256=SQUZ-2mQcTx4F0oefPFfuQzMKsKTSFSB-wq_CH7TBRE,734
|
|
11
14
|
fmu/settings/models/_mappings.py,sha256=Z4Ex7MtmajBr6FjaNzmwDRwtJlaZZ8YKh9NDmZHRKPI,2832
|
|
12
15
|
fmu/settings/models/project_config.py,sha256=K7y4PZMuq5wD-0Br60xfffBN6QQUV8viKGjjOcCB-7M,1098
|
|
13
|
-
fmu/settings/models/user_config.py,sha256=
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
fmu_settings-0.
|
|
17
|
-
fmu_settings-0.
|
|
18
|
-
fmu_settings-0.
|
|
19
|
-
fmu_settings-0.1.0.dist-info/top_level.txt,sha256=Z-FIY3pxn0UK2Wxi9IJ7fKoLSraaxuNGi1eokiE0ShM,4
|
|
20
|
-
fmu_settings-0.1.0.dist-info/RECORD,,
|
|
16
|
+
fmu/settings/models/user_config.py,sha256=UrRcbxJAGn1e7IeE0_v1oPWVOk-DGekRG49pXzDr83o,2701
|
|
17
|
+
fmu_settings-0.2.0.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
18
|
+
fmu_settings-0.2.0.dist-info/METADATA,sha256=Kjzn1O0vvAAYoYAoC-Jo8IzN0H-V7HWwwV3Io47N41w,2024
|
|
19
|
+
fmu_settings-0.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
20
|
+
fmu_settings-0.2.0.dist-info/top_level.txt,sha256=Z-FIY3pxn0UK2Wxi9IJ7fKoLSraaxuNGi1eokiE0ShM,4
|
|
21
|
+
fmu_settings-0.2.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|