Skip to content

Commit 2601ec0

Browse files
0.4.1
1 parent bc16d39 commit 2601ec0

26 files changed

+355
-78
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ repos:
1313
- id: trailing-whitespace
1414

1515
- repo: https://github.com/astral-sh/ruff-pre-commit
16-
rev: v0.8.2
16+
rev: v0.11.2
1717
hooks:
1818
- id: ruff
1919
name: ruff unused imports

.ruff.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ ignore = [
3434
"UP038", # Use X | Y in {} call instead of (X, Y)
3535

3636
# https://docs.astral.sh/ruff/rules/#flake8-annotations-ann
37-
"ANN101", # Missing type annotation for {name} in method
38-
"ANN102", # Missing type annotation for {name} in classmethod
3937
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed in {name}
4038

4139
# https://docs.astral.sh/ruff/rules/#flake8-blind-except-ble

docs/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Packages required to build the documentation
22
sphinx == 8.1.3
3-
sphinx-autodoc-typehints == 2.5.0
3+
sphinx-autodoc-typehints == 3.0.1
44
sphinx_rtd_theme == 3.0.2
5-
sphinx-exec-code == 0.14
5+
sphinx-exec-code == 0.16

docs/usage.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,11 @@ With the ``in_file`` argument it's possible to skip entries from appearing in th
8989
:language_output: yaml
9090
:caption_output: Generated yaml file
9191

92-
from pydantic import Field
9392
from easyconfig import AppBaseModel, create_app_config
9493

94+
# import Field from easyconfig to get the correct type hint for the in_file parameter
95+
from easyconfig import Field
96+
9597

9698
class MySimpleAppConfig(AppBaseModel):
9799
retries: int = Field(5, description='Amount of retries on error')

readme.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@ That way the users can have some guidance how to change the program behaviour.
4040
It's possible to use environment variable or files for expansion. Easyconfig will load all values
4141

4242
# Changelog
43-
#### 0.4.0 (2024-01-10)
43+
#### 0.4.1 (2025-04-01)
44+
- added easyconfig.Field to have proper type hint for the ``in_file`` parameter
45+
46+
47+
# Changelog
48+
#### 0.4.0 (2024-12-10)
4449
- Minimum required python version is now 3.10
4550
- Added preprocessor to so it's possible to move and deprecate configuration entries
4651
- Added property to get the loaded configuration file

requirements.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
-r requirements_setup.txt
33

44
# testing dependencies
5-
pre-commit == 4.0.1
6-
pytest == 8.3.4
5+
pre-commit == 4.2.0
6+
pytest == 8.3.5
77

88
# linter
9-
ruff == 0.8.2
10-
pur == 7.3.2
9+
ruff == 0.11.2
10+
pur == 7.3.3

src/easyconfig/__const__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from enum import Enum
2-
from typing import Final, Literal
2+
from typing import Final, Literal, TypeAlias
33

44

55
class _MissingType(Enum):
@@ -10,7 +10,7 @@ def __str__(self) -> str:
1010

1111

1212
MISSING: Final = _MissingType.MISSING_OBJ
13-
MISSING_TYPE: Final = Literal[_MissingType.MISSING_OBJ]
13+
MISSING_TYPE: TypeAlias = Literal[_MissingType.MISSING_OBJ]
1414

1515

1616
ARG_NAME_IN_FILE: Final = 'in_file'

src/easyconfig/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# isort: split
66

7-
from easyconfig.models import AppBaseModel, AppBaseSettings, AppConfigMixin, BaseModel, BaseSettings, ConfigMixin
7+
from easyconfig.models import AppBaseModel, AppBaseSettings, AppConfigMixin, BaseModel, BaseSettings, ConfigMixin, Field
88

99

1010
# isort: split

src/easyconfig/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.4.0'
1+
__version__ = '0.4.1'

src/easyconfig/config_objs/app_config.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def set_file_path(self, path: Path | str) -> None:
5656
if not self._file_path.suffix:
5757
self._file_path = self._file_path.with_suffix('.yml')
5858

59-
def load_config_dict(self, cfg: dict, /, expansion: bool = True) -> Self:
59+
def load_config_dict(self, cfg: dict, *, expansion: bool = True) -> Self:
6060
"""Load the configuration from a dictionary
6161
6262
:param cfg: config dict which will be loaded
@@ -112,3 +112,6 @@ def generate_default_yaml(self) -> str:
112112
c_map = cmap_from_model(self._file_defaults)
113113
write_aligned_yaml(c_map, buffer, extra_indent=1)
114114
return buffer.getvalue()
115+
116+
def __repr__(self) -> str:
117+
return f'<{self.__class__.__name__} {self._file_path} at {id(self)}>'

0 commit comments

Comments
 (0)