configaroo 0.1.1__tar.gz → 0.1.2__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.
Files changed (23) hide show
  1. {configaroo-0.1.1 → configaroo-0.1.2}/PKG-INFO +1 -2
  2. {configaroo-0.1.1 → configaroo-0.1.2}/pyproject.toml +2 -2
  3. {configaroo-0.1.1 → configaroo-0.1.2}/src/configaroo/__init__.py +1 -1
  4. {configaroo-0.1.1 → configaroo-0.1.2}/src/configaroo/configuration.py +9 -16
  5. {configaroo-0.1.1 → configaroo-0.1.2}/src/configaroo.egg-info/PKG-INFO +1 -2
  6. {configaroo-0.1.1 → configaroo-0.1.2}/src/configaroo.egg-info/requires.txt +0 -1
  7. {configaroo-0.1.1 → configaroo-0.1.2}/LICENSE +0 -0
  8. {configaroo-0.1.1 → configaroo-0.1.2}/README.md +0 -0
  9. {configaroo-0.1.1 → configaroo-0.1.2}/setup.cfg +0 -0
  10. {configaroo-0.1.1 → configaroo-0.1.2}/src/configaroo/exceptions.py +0 -0
  11. {configaroo-0.1.1 → configaroo-0.1.2}/src/configaroo/loaders/__init__.py +0 -0
  12. {configaroo-0.1.1 → configaroo-0.1.2}/src/configaroo/loaders/json.py +0 -0
  13. {configaroo-0.1.1 → configaroo-0.1.2}/src/configaroo/loaders/toml.py +0 -0
  14. {configaroo-0.1.1 → configaroo-0.1.2}/src/configaroo/py.typed +0 -0
  15. {configaroo-0.1.1 → configaroo-0.1.2}/src/configaroo.egg-info/SOURCES.txt +0 -0
  16. {configaroo-0.1.1 → configaroo-0.1.2}/src/configaroo.egg-info/dependency_links.txt +0 -0
  17. {configaroo-0.1.1 → configaroo-0.1.2}/src/configaroo.egg-info/top_level.txt +0 -0
  18. {configaroo-0.1.1 → configaroo-0.1.2}/tests/test_configuration.py +0 -0
  19. {configaroo-0.1.1 → configaroo-0.1.2}/tests/test_environment.py +0 -0
  20. {configaroo-0.1.1 → configaroo-0.1.2}/tests/test_json.py +0 -0
  21. {configaroo-0.1.1 → configaroo-0.1.2}/tests/test_loaders.py +0 -0
  22. {configaroo-0.1.1 → configaroo-0.1.2}/tests/test_toml.py +0 -0
  23. {configaroo-0.1.1 → configaroo-0.1.2}/tests/test_validation.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: configaroo
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Bouncy handling of configuration files
5
5
  Author-email: Geir Arne Hjelle <geirarne@gmail.com>
6
6
  Maintainer-email: Geir Arne Hjelle <geirarne@gmail.com>
@@ -26,7 +26,6 @@ Description-Content-Type: text/markdown
26
26
  License-File: LICENSE
27
27
  Requires-Dist: pydantic>=2.0
28
28
  Requires-Dist: pyplugs>=0.4.0
29
- Requires-Dist: python-dotenv>=1.1.0
30
29
  Dynamic: license-file
31
30
 
32
31
  # Configaroo - Bouncy Configuration Handling
@@ -26,7 +26,7 @@ classifiers = [
26
26
  "Topic :: Software Development :: Libraries :: Python Modules",
27
27
  "Typing :: Typed",
28
28
  ]
29
- dependencies = ["pydantic>=2.0", "pyplugs>=0.4.0", "python-dotenv>=1.1.0"]
29
+ dependencies = ["pydantic>=2.0", "pyplugs>=0.4.0"]
30
30
  dynamic = ["version"]
31
31
 
32
32
  [project.urls]
@@ -50,7 +50,7 @@ dev = [
50
50
  version = { attr = "configaroo.__version__" }
51
51
 
52
52
  [tool.bumpver]
53
- current_version = "v0.1.1"
53
+ current_version = "v0.1.2"
54
54
  version_pattern = "vMAJOR.MINOR.PATCH"
55
55
  commit_message = "bump version {old_version} -> {new_version}"
56
56
  tag_message = "{new_version}"
@@ -7,4 +7,4 @@ from configaroo.exceptions import ( # noqa
7
7
  UnsupportedLoaderError,
8
8
  )
9
9
 
10
- __version__ = "0.1.1"
10
+ __version__ = "0.1.2"
@@ -7,7 +7,6 @@ from collections import UserDict
7
7
  from pathlib import Path
8
8
  from typing import Any, Self, Type
9
9
 
10
- import dotenv
11
10
  from pydantic import BaseModel
12
11
 
13
12
  from configaroo import loaders
@@ -92,27 +91,21 @@ class Configuration(UserDict):
92
91
  def add(self, key: str, value: Any) -> Self:
93
92
  """Add a value, allow dotted keys"""
94
93
  prefix, _, rest = key.partition(".")
95
- if rest:
96
- cls = type(self)
97
- return self | {prefix: cls(self.setdefault(prefix, {})).add(rest, value)}
98
- else:
94
+ if not rest:
99
95
  return self | {key: value}
96
+ cls = type(self)
97
+ return self | {prefix: cls(self.setdefault(prefix, {})).add(rest, value)}
100
98
 
101
- def add_envs(self, envs: dict[str, str], prefix: str = "", use_dotenv=True) -> Self:
99
+ def add_envs(self, envs: dict[str, str], prefix: str = "") -> Self:
102
100
  """Add environment variables to configuration"""
103
- if use_dotenv:
104
- dotenv.load_dotenv()
105
-
106
101
  for env, key in envs.items():
107
102
  env_key = f"{prefix}{env}"
108
- env_value = os.getenv(env_key)
109
- if env_value:
103
+ if env_value := os.getenv(env_key):
110
104
  self = self.add(key, env_value)
111
- else:
112
- if key not in self:
113
- raise MissingEnvironmentVariableError(
114
- f"required environment variable '{env_key}' not found"
115
- )
105
+ elif key not in self:
106
+ raise MissingEnvironmentVariableError(
107
+ f"required environment variable '{env_key}' not found"
108
+ )
116
109
  return self
117
110
 
118
111
  def parse_dynamic(self, extra: dict[str, Any] | None = None) -> Self:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: configaroo
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Bouncy handling of configuration files
5
5
  Author-email: Geir Arne Hjelle <geirarne@gmail.com>
6
6
  Maintainer-email: Geir Arne Hjelle <geirarne@gmail.com>
@@ -26,7 +26,6 @@ Description-Content-Type: text/markdown
26
26
  License-File: LICENSE
27
27
  Requires-Dist: pydantic>=2.0
28
28
  Requires-Dist: pyplugs>=0.4.0
29
- Requires-Dist: python-dotenv>=1.1.0
30
29
  Dynamic: license-file
31
30
 
32
31
  # Configaroo - Bouncy Configuration Handling
@@ -1,3 +1,2 @@
1
1
  pydantic>=2.0
2
2
  pyplugs>=0.4.0
3
- python-dotenv>=1.1.0
File without changes
File without changes
File without changes