appsettings2 2.1.0__tar.gz → 2.1.3__tar.gz
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.
- {appsettings2-2.1.0/src/appsettings2.egg-info → appsettings2-2.1.3}/PKG-INFO +3 -7
- {appsettings2-2.1.0 → appsettings2-2.1.3}/pyproject.toml +6 -26
- {appsettings2-2.1.0 → appsettings2-2.1.3}/src/appsettings2/ConfigurationBuilder.py +1 -1
- {appsettings2-2.1.0 → appsettings2-2.1.3}/src/appsettings2/ConfigurationWatcher.py +18 -18
- {appsettings2-2.1.0 → appsettings2-2.1.3}/src/appsettings2/SKILL.md +2 -0
- {appsettings2-2.1.0 → appsettings2-2.1.3}/src/appsettings2/__init__.py +2 -2
- {appsettings2-2.1.0 → appsettings2-2.1.3}/src/appsettings2/helpers.py +1 -1
- {appsettings2-2.1.0 → appsettings2-2.1.3}/src/appsettings2/providers/EnvironmentConfigurationProvider.py +7 -0
- {appsettings2-2.1.0 → appsettings2-2.1.3/src/appsettings2.egg-info}/PKG-INFO +3 -7
- appsettings2-2.1.3/src/appsettings2.egg-info/requires.txt +7 -0
- appsettings2-2.1.0/src/appsettings2.egg-info/requires.txt +0 -11
- {appsettings2-2.1.0 → appsettings2-2.1.3}/LICENSE +0 -0
- {appsettings2-2.1.0 → appsettings2-2.1.3}/README.md +0 -0
- {appsettings2-2.1.0 → appsettings2-2.1.3}/setup.cfg +0 -0
- {appsettings2-2.1.0 → appsettings2-2.1.3}/src/appsettings2/Configuration.py +0 -0
- {appsettings2-2.1.0 → appsettings2-2.1.3}/src/appsettings2/ConfigurationException.py +0 -0
- {appsettings2-2.1.0 → appsettings2-2.1.3}/src/appsettings2/providers/CommandLineConfigurationProvider.py +0 -0
- {appsettings2-2.1.0 → appsettings2-2.1.3}/src/appsettings2/providers/ConfigurationProvider.py +0 -0
- {appsettings2-2.1.0 → appsettings2-2.1.3}/src/appsettings2/providers/JsonConfigurationProvider.py +0 -0
- {appsettings2-2.1.0 → appsettings2-2.1.3}/src/appsettings2/providers/TomlConfigurationProvider.py +0 -0
- {appsettings2-2.1.0 → appsettings2-2.1.3}/src/appsettings2/providers/YamlConfigurationProvider.py +0 -0
- {appsettings2-2.1.0 → appsettings2-2.1.3}/src/appsettings2/providers/__init__.py +0 -0
- {appsettings2-2.1.0 → appsettings2-2.1.3}/src/appsettings2/py.typed +0 -0
- {appsettings2-2.1.0 → appsettings2-2.1.3}/src/appsettings2.egg-info/SOURCES.txt +0 -0
- {appsettings2-2.1.0 → appsettings2-2.1.3}/src/appsettings2.egg-info/dependency_links.txt +0 -0
- {appsettings2-2.1.0 → appsettings2-2.1.3}/src/appsettings2.egg-info/top_level.txt +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: appsettings2
|
|
3
|
-
Version: 2.1.
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 2.1.3
|
|
4
|
+
Summary: ..unify configuration sources into a `Configuration` object that can be bound to complex types, or accessed directly for configuration data.
|
|
5
5
|
Author-email: Shaun Wilson <mrshaunwilson@msn.com>
|
|
6
6
|
License-Expression: MIT
|
|
7
7
|
Project-URL: Documentation, https://appsettings2.readthedocs.io/
|
|
@@ -17,12 +17,8 @@ License-File: LICENSE
|
|
|
17
17
|
Requires-Dist: pyyaml>=6.0.3
|
|
18
18
|
Provides-Extra: dev
|
|
19
19
|
Requires-Dist: coverage; extra == "dev"
|
|
20
|
-
Requires-Dist: flake8; extra == "dev"
|
|
21
|
-
Requires-Dist: flake8-pyproject; extra == "dev"
|
|
22
20
|
Requires-Dist: mypy; extra == "dev"
|
|
23
|
-
Requires-Dist:
|
|
24
|
-
Requires-Dist: punit>=1.12.5; extra == "dev"
|
|
25
|
-
Requires-Dist: twine; extra == "dev"
|
|
21
|
+
Requires-Dist: punit>=1.14.2; extra == "dev"
|
|
26
22
|
Requires-Dist: types-PyYAML; extra == "dev"
|
|
27
23
|
Dynamic: license-file
|
|
28
24
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "appsettings2"
|
|
3
|
-
version = "2.1.
|
|
4
|
-
description = "
|
|
3
|
+
version = "2.1.3"
|
|
4
|
+
description = "..unify configuration sources into a `Configuration` object that can be bound to complex types, or accessed directly for configuration data."
|
|
5
5
|
keywords = ["appsettings", "configuration"]
|
|
6
6
|
authors = [
|
|
7
7
|
{ name="Shaun Wilson", email="mrshaunwilson@msn.com" }
|
|
@@ -15,18 +15,14 @@ classifiers = [
|
|
|
15
15
|
]
|
|
16
16
|
requires-python = ">=3.11"
|
|
17
17
|
dependencies = [
|
|
18
|
-
"pyyaml>=6.0.3"
|
|
18
|
+
"pyyaml (>=6.0.3)"
|
|
19
19
|
]
|
|
20
20
|
|
|
21
21
|
[project.optional-dependencies]
|
|
22
22
|
dev = [
|
|
23
23
|
"coverage",
|
|
24
|
-
"flake8",
|
|
25
|
-
"flake8-pyproject",
|
|
26
24
|
"mypy",
|
|
27
|
-
"
|
|
28
|
-
"punit (>=1.12.5)",
|
|
29
|
-
"twine",
|
|
25
|
+
"punit (>=1.14.2)",
|
|
30
26
|
"types-PyYAML"
|
|
31
27
|
]
|
|
32
28
|
|
|
@@ -35,24 +31,8 @@ Documentation = "https://appsettings2.readthedocs.io/"
|
|
|
35
31
|
Homepage = "https://github.com/wilson0x4d/appsettings2"
|
|
36
32
|
Repository = "https://github.com/wilson0x4d/appsettings2.git"
|
|
37
33
|
|
|
38
|
-
[build-system]
|
|
39
|
-
requires = ["setuptools"]
|
|
40
|
-
build-backend = "setuptools.build_meta"
|
|
41
|
-
|
|
42
|
-
[tool.setuptools.packages.find]
|
|
43
|
-
where = ["src"]
|
|
44
|
-
exclude = [
|
|
45
|
-
"docs",
|
|
46
|
-
"tests",
|
|
47
|
-
"tests.*"
|
|
48
|
-
]
|
|
49
|
-
|
|
50
34
|
[tool.setuptools.package-data]
|
|
51
35
|
"appsettings2" = ["py.typed", "SKILL.md"]
|
|
52
36
|
|
|
53
|
-
[tool.
|
|
54
|
-
|
|
55
|
-
ignore = ["D100","E501"]
|
|
56
|
-
per-file-ignores = [
|
|
57
|
-
"tests/*.py:D012,E306",
|
|
58
|
-
]
|
|
37
|
+
[tool.uv]
|
|
38
|
+
package = true
|
|
@@ -76,7 +76,7 @@ class ConfigurationBuilder:
|
|
|
76
76
|
"""
|
|
77
77
|
Add a :py:class:`~appsettings2.providers.EnvironmentConfigurationProvider`.
|
|
78
78
|
|
|
79
|
-
:param required_prefix: Optional prefix used to filter which environment variables are included. Only variables whose names start with this prefix (followed by ``_`` or ``__``) will be loaded. When ``None``, all environment variables are included. Defaults to None.
|
|
79
|
+
:param required_prefix: Optional prefix used to filter which environment variables are included. Only variables whose names start with this prefix (followed by ``_`` or ``__``) will be loaded. When ``None``, all environment variables are included. Defaults to None. Note that environment variables whose names begin with an underscore are unsupported and are always ignored, even when ``required_prefix`` matches them.
|
|
80
80
|
:return: Returns :py:class:`~appsettings2.ConfigurationBuilder` for method chaining.
|
|
81
81
|
"""
|
|
82
82
|
return self.add_provider(EnvironmentConfigurationProvider(required_prefix=required_prefix))
|
|
@@ -87,7 +87,7 @@ class ConfigurationWatcher:
|
|
|
87
87
|
self.__handler_lock = threading.Lock()
|
|
88
88
|
self.__logger = logging.getLogger(__name__)
|
|
89
89
|
|
|
90
|
-
def add_watch(self, filepath: str) ->
|
|
90
|
+
def add_watch(self, filepath: str) -> ConfigurationWatcher:
|
|
91
91
|
"""Add a file path to be watched for changes.
|
|
92
92
|
|
|
93
93
|
The path is normalised to a fully-qualified (canonical) path via
|
|
@@ -100,18 +100,18 @@ class ConfigurationWatcher:
|
|
|
100
100
|
resolved = os.path.realpath(filepath)
|
|
101
101
|
with self.__lock:
|
|
102
102
|
is_first_watch = len(self.__watches) == 0
|
|
103
|
-
if resolved in self.__watches:
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
def remove_watch(self, filepath: str) ->
|
|
103
|
+
if resolved not in self.__watches:
|
|
104
|
+
self.__watches[resolved] = {
|
|
105
|
+
'path': resolved,
|
|
106
|
+
'size': None,
|
|
107
|
+
'mtime': None,
|
|
108
|
+
'state': 'pending',
|
|
109
|
+
}
|
|
110
|
+
if is_first_watch:
|
|
111
|
+
self.__start_thread()
|
|
112
|
+
return self
|
|
113
|
+
|
|
114
|
+
def remove_watch(self, filepath: str) -> ConfigurationWatcher:
|
|
115
115
|
"""Remove a previously added watch.
|
|
116
116
|
|
|
117
117
|
Silently does nothing if the watch does not exist. The polling thread
|
|
@@ -122,11 +122,11 @@ class ConfigurationWatcher:
|
|
|
122
122
|
"""
|
|
123
123
|
resolved = os.path.realpath(filepath)
|
|
124
124
|
with self.__lock:
|
|
125
|
-
if resolved
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
125
|
+
if resolved in self.__watches:
|
|
126
|
+
del self.__watches[resolved]
|
|
127
|
+
if len(self.__watches) == 0 and self.__thread is not None:
|
|
128
|
+
self.__drain_thread()
|
|
129
|
+
return self
|
|
130
130
|
|
|
131
131
|
def list_watches(self) -> list[str]:
|
|
132
132
|
"""Return a fresh list of all currently watched file paths.
|
|
@@ -82,6 +82,8 @@ export MYAPP_DB_HOST=postgres://... # loaded as "DB_HOST"
|
|
|
82
82
|
export OTHER_KEY=value # ignored
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
+
Env vars whose names begin with an underscore (e.g. `_FOO`, `__FOO`) are unsupported and are always ignored, even when `required_prefix` is set to a matching value. This prevents double-underscore-prefixed variables from producing an unwanted empty (`''`) hierarchy key.
|
|
86
|
+
|
|
85
87
|
### `build()`
|
|
86
88
|
|
|
87
89
|
```python
|
|
@@ -30,7 +30,7 @@ def get_configuration(
|
|
|
30
30
|
:param cli: ``True`` to load configuration from Command-Line, defaults to True
|
|
31
31
|
:param environment: ``True`` to load configuration from process Environment, defaults to True
|
|
32
32
|
:param variations: A set of variations to apply to use with file-based Configuration Providers, defaults to ['', 'prod', 'production', 'stage', 'staging', 'qa', 'dev', 'development', 'local']
|
|
33
|
-
:param env_prefix: (OPTIONAL) When specified, only env vars having the specified prefix are bound as configuration settings, the prefix is stripped from the resulting setting name.
|
|
33
|
+
:param env_prefix: (OPTIONAL) When specified, only env vars having the specified prefix are bound as configuration settings, the prefix is stripped from the resulting setting name. Env vars whose names begin with an underscore are unsupported and are always ignored, even when they match ``env_prefix``.
|
|
34
34
|
:param disable_events: Option indicating whether change events should be emitted, defaults to False.
|
|
35
35
|
:return: An ``appsettings2.Configuration`` instance.
|
|
36
36
|
"""
|
|
@@ -33,8 +33,15 @@ class EnvironmentConfigurationProvider(ConfigurationProvider):
|
|
|
33
33
|
|
|
34
34
|
When ``required_prefix`` is set, only keys starting with that prefix are included,
|
|
35
35
|
and the prefix is stripped from each key in the output configuration.
|
|
36
|
+
|
|
37
|
+
Environment variable names starting with an underscore (e.g. ``_FOO``,
|
|
38
|
+
``__FOO``) are unsupported and are always ignored, even when they match
|
|
39
|
+
``required_prefix``. This prevents double-underscore-prefixed variables
|
|
40
|
+
from producing empty (``''``) hierarchy keys.
|
|
36
41
|
"""
|
|
37
42
|
for k in os.environ:
|
|
43
|
+
if k.startswith('_'):
|
|
44
|
+
continue
|
|
38
45
|
key = (
|
|
39
46
|
k
|
|
40
47
|
if self.__required_prefix is None
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: appsettings2
|
|
3
|
-
Version: 2.1.
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 2.1.3
|
|
4
|
+
Summary: ..unify configuration sources into a `Configuration` object that can be bound to complex types, or accessed directly for configuration data.
|
|
5
5
|
Author-email: Shaun Wilson <mrshaunwilson@msn.com>
|
|
6
6
|
License-Expression: MIT
|
|
7
7
|
Project-URL: Documentation, https://appsettings2.readthedocs.io/
|
|
@@ -17,12 +17,8 @@ License-File: LICENSE
|
|
|
17
17
|
Requires-Dist: pyyaml>=6.0.3
|
|
18
18
|
Provides-Extra: dev
|
|
19
19
|
Requires-Dist: coverage; extra == "dev"
|
|
20
|
-
Requires-Dist: flake8; extra == "dev"
|
|
21
|
-
Requires-Dist: flake8-pyproject; extra == "dev"
|
|
22
20
|
Requires-Dist: mypy; extra == "dev"
|
|
23
|
-
Requires-Dist:
|
|
24
|
-
Requires-Dist: punit>=1.12.5; extra == "dev"
|
|
25
|
-
Requires-Dist: twine; extra == "dev"
|
|
21
|
+
Requires-Dist: punit>=1.14.2; extra == "dev"
|
|
26
22
|
Requires-Dist: types-PyYAML; extra == "dev"
|
|
27
23
|
Dynamic: license-file
|
|
28
24
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{appsettings2-2.1.0 → appsettings2-2.1.3}/src/appsettings2/providers/ConfigurationProvider.py
RENAMED
|
File without changes
|
{appsettings2-2.1.0 → appsettings2-2.1.3}/src/appsettings2/providers/JsonConfigurationProvider.py
RENAMED
|
File without changes
|
{appsettings2-2.1.0 → appsettings2-2.1.3}/src/appsettings2/providers/TomlConfigurationProvider.py
RENAMED
|
File without changes
|
{appsettings2-2.1.0 → appsettings2-2.1.3}/src/appsettings2/providers/YamlConfigurationProvider.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|