Skip to content

Commit 8807d19

Browse files
Prepare for v2.0.4
1 parent 0eb8115 commit 8807d19

File tree

8 files changed

+40
-33
lines changed

8 files changed

+40
-33
lines changed

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[flake8]
2-
exclude = __pycache__,built,build,venv
2+
exclude = __pycache__,built,build,venv,venv312,dist
33
ignore = E203, E266, W503
44
max-line-length = 88
55
max-complexity = 18

.github/workflows/build.yml

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
strategy:
2121
fail-fast: false
2222
matrix:
23-
python-version: [3.8, 3.9, "3.10", "3.11"]
23+
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
2424

2525
steps:
2626
- uses: actions/checkout@v1
@@ -33,20 +33,9 @@ jobs:
3333
with:
3434
python-version: ${{ matrix.python-version }}
3535

36-
- uses: actions/cache@v1
37-
id: depcache
38-
with:
39-
path: deps
40-
key: requirements-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
41-
42-
- name: Download dependencies
43-
if: steps.depcache.outputs.cache-hit != 'true'
44-
run: |
45-
pip download --dest=deps -r requirements.txt
46-
4736
- name: Install dependencies
4837
run: |
49-
pip install -U --no-index --find-links=deps deps/*
38+
pip install -r requirements.txt
5039
5140
- name: Run tests
5241
run: |

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [2.0.4] - 2023-12-28 :snowman_with_snow:
9+
- Improves the library to deep-merge dictionaries of values instead of replacing
10+
objects entirely (fix [#10](https://github.com/Neoteroi/essentials-configuration/issues/10)), by @StummeJ.
11+
- Adds Python 3.12 to the build matrix, upgrades dev dependencies and fix tests
12+
to support Python 3.12.
13+
814
## [2.0.3] - 2023-04-15 :crown:
915
- Adopts `Rich`, through `rich-click` for the project CLI.
1016
- Renames the recently added `secrets` feature to `settings`.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ check-flake8:
4343

4444
check-isort:
4545
@echo "$(BOLD)Checking isort$(RESET)"
46-
@isort --check-only . 2>&1
46+
@isort --check-only config 2>&1
4747

4848

4949
check-black:

config/common/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def apply_key_value(obj: Mapping[str, Any], key: str, value: Any) -> Mapping[str
4949
sub_property, abc.MutableSequence
5050
):
5151
raise ConfigurationOverrideError(
52-
f"The key `{key}` cannot be used "
52+
f"The key '{key}' cannot be used "
5353
f"because it overrides another "
5454
f"variable with shorter key! ({part}, {sub_property})"
5555
)
@@ -67,7 +67,7 @@ def apply_key_value(obj: Mapping[str, Any], key: str, value: Any) -> Mapping[str
6767
sub_property[index] = merger.merge(sub_property[index], value)
6868
except IndexError:
6969
raise ConfigurationOverrideError(
70-
f"Invalid override for mutable sequence {key}; "
70+
f"Invalid override for mutable sequence {key}, "
7171
f"assignment index out of range"
7272
)
7373
else:
@@ -81,7 +81,7 @@ def apply_key_value(obj: Mapping[str, Any], key: str, value: Any) -> Mapping[str
8181
sub_property[last_part] = value
8282
except TypeError as type_error:
8383
raise ConfigurationOverrideError(
84-
f"Invalid assignment {key} -> {value}; {str(type_error)}"
84+
f"Invalid assignment {key} -> {value}, {str(type_error)}"
8585
)
8686

8787
return obj

pyproject.toml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "essentials-configuration"
7-
version = "2.0.3"
7+
version = "2.0.4"
88
authors = [{ name = "Roberto Prevato", email = "roberto.prevato@gmail.com" }]
99
description = "Implementation of key-value pair based configuration for Python applications."
1010
readme = "README.md"
@@ -17,11 +17,16 @@ classifiers = [
1717
"Programming Language :: Python :: 3.9",
1818
"Programming Language :: Python :: 3.10",
1919
"Programming Language :: Python :: 3.11",
20+
"Programming Language :: Python :: 3.12",
2021
"Operating System :: OS Independent",
2122
]
2223
keywords = ["configuration", "root", "management", "strategy", "settings"]
2324

24-
dependencies = ["deepmerge~=1.1.0", "tomli; python_version < '3.11'", "python-dotenv~=1.0.0"]
25+
dependencies = [
26+
"deepmerge~=1.1.0",
27+
"tomli; python_version < '3.11'",
28+
"python-dotenv~=1.0.0",
29+
]
2530

2631
[project.optional-dependencies]
2732
yaml = ["PyYAML"]

requirements.txt

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
appdirs==1.4.4
22
attrs==22.1.0
3-
black==22.10.0
3+
black==22.12.0
44
build==0.10.0
5-
click==8.1.3
6-
coverage==6.5.0
5+
click==8.1.7
6+
coverage==7.4.0
77
deepmerge==1.1.0
88
flake8==5.0.4
99
iniconfig==1.1.1
@@ -24,14 +24,13 @@ pyflakes==2.5.0
2424
Pygments==2.15.0
2525
pyparsing==3.0.9
2626
pyproject_hooks==1.0.0
27-
pytest==7.2.0
28-
pytest-cov==4.0.0
27+
pytest==7.4.3
28+
pytest-cov==4.1.0
2929
python-dotenv==1.0.0
30-
PyYAML==6.0
30+
PyYAML==6.0.1
3131
regex==2022.10.31
3232
rich==13.3.4
3333
rich-click==1.6.1
3434
toml==0.10.2
3535
tomli==2.0.1
36-
typed-ast==1.5.4
37-
typing_extensions==4.5.0
36+
typing_extensions==4.9.0

tests/test_configuration.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from typing import Any, Dict
33
from uuid import uuid4
44

5-
import pkg_resources
65
import pytest
76

87
from config.common import (
@@ -18,16 +17,25 @@
1817
from config.toml import TOMLFile
1918
from config.yaml import YAMLFile
2019

20+
try:
21+
from importlib.resources import files
22+
23+
def _get_file_path(file_name: str) -> str:
24+
return str(files("tests") / file_name)
25+
26+
except ImportError:
27+
# Python 3.8
28+
import pkg_resources
29+
30+
def _get_file_path(file_name: str) -> str:
31+
return pkg_resources.resource_filename(__name__, f"./{file_name}")
32+
2133

2234
class FooSource(ConfigurationSource):
2335
def get_values(self) -> Dict[str, Any]:
2436
return {}
2537

2638

27-
def _get_file_path(file_name: str) -> str:
28-
return pkg_resources.resource_filename(__name__, f"./{file_name}")
29-
30-
3139
def test_builder():
3240
builder = ConfigurationBuilder()
3341

0 commit comments

Comments
 (0)