wirio-settings 0.0.1__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 (60) hide show
  1. wirio_settings-0.0.1/.github/workflows/ci.yaml +272 -0
  2. wirio_settings-0.0.1/.gitignore +16 -0
  3. wirio_settings-0.0.1/Cargo.lock +133 -0
  4. wirio_settings-0.0.1/Cargo.toml +18 -0
  5. wirio_settings-0.0.1/LICENSE +21 -0
  6. wirio_settings-0.0.1/Makefile +15 -0
  7. wirio_settings-0.0.1/PKG-INFO +18 -0
  8. wirio_settings-0.0.1/README.md +185 -0
  9. wirio_settings-0.0.1/pyproject.toml +85 -0
  10. wirio_settings-0.0.1/python/wirio_settings/__init__.py +3 -0
  11. wirio_settings-0.0.1/python/wirio_settings/_json/__init__.py +0 -0
  12. wirio_settings-0.0.1/python/wirio_settings/_json/_json_settings_file_parser.py +89 -0
  13. wirio_settings-0.0.1/python/wirio_settings/aws_secrets_manager/__init__.py +0 -0
  14. wirio_settings-0.0.1/python/wirio_settings/aws_secrets_manager/aws_secrets_manager_settings_provider.py +43 -0
  15. wirio_settings-0.0.1/python/wirio_settings/aws_secrets_manager/aws_secrets_manager_settings_source.py +28 -0
  16. wirio_settings-0.0.1/python/wirio_settings/azure_key_vault/__init__.py +0 -0
  17. wirio_settings-0.0.1/python/wirio_settings/azure_key_vault/azure_key_vault_settings_provider.py +66 -0
  18. wirio_settings-0.0.1/python/wirio_settings/azure_key_vault/azure_key_vault_settings_source.py +28 -0
  19. wirio_settings-0.0.1/python/wirio_settings/core/__init__.py +19 -0
  20. wirio_settings-0.0.1/python/wirio_settings/core/_extra_dependencies.py +51 -0
  21. wirio_settings-0.0.1/python/wirio_settings/core/_typed_type.py +107 -0
  22. wirio_settings-0.0.1/python/wirio_settings/core/convention_changer.py +39 -0
  23. wirio_settings-0.0.1/python/wirio_settings/core/settings.py +56 -0
  24. wirio_settings-0.0.1/python/wirio_settings/core/settings_binder.py +294 -0
  25. wirio_settings-0.0.1/python/wirio_settings/core/settings_builder.py +11 -0
  26. wirio_settings-0.0.1/python/wirio_settings/core/settings_path.py +25 -0
  27. wirio_settings-0.0.1/python/wirio_settings/core/settings_provider.py +34 -0
  28. wirio_settings-0.0.1/python/wirio_settings/core/settings_root.py +36 -0
  29. wirio_settings-0.0.1/python/wirio_settings/core/settings_section.py +68 -0
  30. wirio_settings-0.0.1/python/wirio_settings/core/settings_source.py +14 -0
  31. wirio_settings-0.0.1/python/wirio_settings/core/wirio_undefined.py +11 -0
  32. wirio_settings-0.0.1/python/wirio_settings/environment_variables/__init__.py +0 -0
  33. wirio_settings-0.0.1/python/wirio_settings/environment_variables/environment_variables_settings_provider.py +23 -0
  34. wirio_settings-0.0.1/python/wirio_settings/environment_variables/environment_variables_settings_source.py +15 -0
  35. wirio_settings-0.0.1/python/wirio_settings/py.typed +0 -0
  36. wirio_settings-0.0.1/python/wirio_settings/settings_manager.py +263 -0
  37. wirio_settings-0.0.1/python/wirio_settings/yaml/__init__.py +0 -0
  38. wirio_settings-0.0.1/python/wirio_settings/yaml/yaml_settings_provider.py +46 -0
  39. wirio_settings-0.0.1/python/wirio_settings/yaml/yaml_settings_source.py +18 -0
  40. wirio_settings-0.0.1/src/lib.rs +4 -0
  41. wirio_settings-0.0.1/tests/__init__.py +0 -0
  42. wirio_settings-0.0.1/tests/aws_secrets_manager/__init__.py +0 -0
  43. wirio_settings-0.0.1/tests/aws_secrets_manager/test_aws_secrets_manager_settings_provider.py +141 -0
  44. wirio_settings-0.0.1/tests/aws_secrets_manager/test_aws_secrets_manager_settings_source.py +60 -0
  45. wirio_settings-0.0.1/tests/azure_key_vault/__init__.py +0 -0
  46. wirio_settings-0.0.1/tests/azure_key_vault/test_azure_key_vault_settings_provider.py +310 -0
  47. wirio_settings-0.0.1/tests/azure_key_vault/test_azure_key_vault_settings_source.py +60 -0
  48. wirio_settings-0.0.1/tests/core/__init__.py +0 -0
  49. wirio_settings-0.0.1/tests/core/test_convention_changer.py +42 -0
  50. wirio_settings-0.0.1/tests/core/test_settings_binder.py +401 -0
  51. wirio_settings-0.0.1/tests/core/test_settings_provider.py +14 -0
  52. wirio_settings-0.0.1/tests/core/test_settings_section.py +159 -0
  53. wirio_settings-0.0.1/tests/environment_variables/__init__.py +0 -0
  54. wirio_settings-0.0.1/tests/environment_variables/test_environment_variables_settings_provider.py +23 -0
  55. wirio_settings-0.0.1/tests/json/__init__.py +0 -0
  56. wirio_settings-0.0.1/tests/json/test_json_settings_file_parser.py +73 -0
  57. wirio_settings-0.0.1/tests/test_settings_manager.py +1212 -0
  58. wirio_settings-0.0.1/tests/yaml/__init__.py +0 -0
  59. wirio_settings-0.0.1/tests/yaml/test_yaml_settings_provider.py +146 -0
  60. wirio_settings-0.0.1/uv.lock +1358 -0
@@ -0,0 +1,272 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ tags:
8
+ - "*"
9
+ pull_request:
10
+ workflow_dispatch:
11
+
12
+ concurrency:
13
+ group: ${{ github.workflow }}-${{ github.ref }}
14
+ cancel-in-progress: false
15
+
16
+ permissions:
17
+ contents: read
18
+
19
+ jobs:
20
+ lint:
21
+ name: Lint
22
+ if: github.actor != 'dependabot[bot]'
23
+ runs-on: ubuntu-24.04
24
+ env:
25
+ UV_NO_SYNC: 1
26
+ steps:
27
+ - name: Checkout repository
28
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
29
+
30
+ - name: Install uv
31
+ uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
32
+ with:
33
+ version-file: pyproject.toml
34
+ resolution-strategy: highest
35
+
36
+ - name: Install Python packages
37
+ run: uv sync --locked --all-extras
38
+ shell: bash
39
+
40
+ - name: Check code
41
+ run: make check-code
42
+ shell: bash
43
+
44
+ test:
45
+ name: Test (Python=${{ matrix.python-version }}, Resolution=${{ matrix.resolution-strategy }}, Extra=${{ matrix.extra }})
46
+ runs-on: ubuntu-24.04
47
+ strategy:
48
+ matrix:
49
+ python-version: ["3.13", "3.14"]
50
+ resolution-strategy: ["lowest-direct", "highest"]
51
+ extra: ["no-extra", "azure-key-vault", "aws-secrets-manager"]
52
+ env:
53
+ UV_NO_SYNC: 1
54
+ steps:
55
+ - name: Checkout repository
56
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
57
+
58
+ - name: Install uv
59
+ uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
60
+ with:
61
+ version-file: pyproject.toml
62
+ resolution-strategy: highest
63
+ python-version: ${{ matrix.python-version }}
64
+
65
+ - name: Install Python packages
66
+ run: |
67
+ uv sync \
68
+ --resolution ${{ matrix.resolution-strategy }} \
69
+ ${{ matrix.extra != 'no-extra' && format('--extra {0}', matrix.extra) || '' }}
70
+ shell: bash
71
+
72
+ - name: Install crates
73
+ run: uv run -- maturin develop --uv
74
+ shell: bash
75
+
76
+ - name: Test
77
+ run: uv run -- pytest --cov=wirio_settings --cov-branch tests
78
+ shell: bash
79
+
80
+ linux:
81
+ runs-on: ${{ matrix.platform.runner }}
82
+ needs: test
83
+ strategy:
84
+ matrix:
85
+ platform:
86
+ - runner: ubuntu-22.04
87
+ target: x86_64
88
+ - runner: ubuntu-22.04
89
+ target: x86
90
+ - runner: ubuntu-22.04
91
+ target: aarch64
92
+ - runner: ubuntu-22.04
93
+ target: armv7
94
+ - runner: ubuntu-22.04
95
+ target: s390x
96
+ - runner: ubuntu-22.04
97
+ target: ppc64le
98
+ steps:
99
+ - name: Checkout repository
100
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
101
+
102
+ - name: Install Python
103
+ uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
104
+ with:
105
+ python-version: "3.13"
106
+
107
+ - name: Build wheels
108
+ uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
109
+ with:
110
+ target: ${{ matrix.platform.target }}
111
+ args: --release --out dist --find-interpreter
112
+ sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
113
+ manylinux: auto
114
+
115
+ - name: Upload wheels
116
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
117
+ with:
118
+ name: wheels-linux-${{ matrix.platform.target }}
119
+ path: dist
120
+
121
+ musllinux:
122
+ runs-on: ${{ matrix.platform.runner }}
123
+ needs: test
124
+ strategy:
125
+ matrix:
126
+ platform:
127
+ - runner: ubuntu-22.04
128
+ target: x86_64
129
+ - runner: ubuntu-22.04
130
+ target: x86
131
+ - runner: ubuntu-22.04
132
+ target: aarch64
133
+ - runner: ubuntu-22.04
134
+ target: armv7
135
+ steps:
136
+ - name: Checkout repository
137
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
138
+
139
+ - name: Install Python
140
+ uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
141
+ with:
142
+ python-version: "3.13"
143
+
144
+ - name: Build wheels
145
+ uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
146
+ with:
147
+ target: ${{ matrix.platform.target }}
148
+ args: --release --out dist --find-interpreter
149
+ sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
150
+ manylinux: musllinux_1_2
151
+
152
+ - name: Upload wheels
153
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
154
+ with:
155
+ name: wheels-musllinux-${{ matrix.platform.target }}
156
+ path: dist
157
+
158
+ windows:
159
+ runs-on: ${{ matrix.platform.runner }}
160
+ needs: test
161
+ strategy:
162
+ matrix:
163
+ platform:
164
+ - runner: windows-latest
165
+ target: x64
166
+ python_arch: x64
167
+ - runner: windows-latest
168
+ target: x86
169
+ python_arch: x86
170
+ - runner: windows-11-arm
171
+ target: aarch64
172
+ python_arch: arm64
173
+ steps:
174
+ - name: Checkout repository
175
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
176
+
177
+ - name: Install Python
178
+ uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
179
+ with:
180
+ python-version: "3.13"
181
+ architecture: ${{ matrix.platform.python_arch }}
182
+
183
+ - name: Build wheels
184
+ uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
185
+ with:
186
+ target: ${{ matrix.platform.target }}
187
+ args: --release --out dist --find-interpreter
188
+ sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
189
+
190
+ - name: Upload wheels
191
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
192
+ with:
193
+ name: wheels-windows-${{ matrix.platform.target }}
194
+ path: dist
195
+
196
+ macos:
197
+ runs-on: ${{ matrix.platform.runner }}
198
+ needs: test
199
+ strategy:
200
+ matrix:
201
+ platform:
202
+ - runner: macos-15-intel
203
+ target: x86_64
204
+ - runner: macos-latest
205
+ target: aarch64
206
+ steps:
207
+ - name: Checkout repository
208
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
209
+
210
+ - name: Install Python
211
+ uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
212
+ with:
213
+ python-version: "3.13"
214
+
215
+ - name: Build wheels
216
+ uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
217
+ with:
218
+ target: ${{ matrix.platform.target }}
219
+ args: --release --out dist --find-interpreter
220
+ sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
221
+
222
+ - name: Upload wheels
223
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
224
+ with:
225
+ name: wheels-macos-${{ matrix.platform.target }}
226
+ path: dist
227
+
228
+ sdist:
229
+ runs-on: ubuntu-latest
230
+ needs: test
231
+ steps:
232
+ - name: Checkout repository
233
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
234
+
235
+ - name: Build sdist
236
+ uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
237
+ with:
238
+ command: sdist
239
+ args: --out dist
240
+
241
+ - name: Upload sdist
242
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
243
+ with:
244
+ name: wheels-sdist
245
+ path: dist
246
+
247
+ release:
248
+ name: Release
249
+ runs-on: ubuntu-latest
250
+ if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
251
+ needs: [linux, musllinux, windows, macos, sdist]
252
+ environment: release
253
+ permissions:
254
+ # Use to sign the release artifacts
255
+ id-token: write
256
+ # Used to upload release artifacts
257
+ contents: write
258
+ steps:
259
+ - name: Checkout repository
260
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
261
+
262
+ - name: Download artifacts
263
+ uses: actions/download-artifact@v7
264
+
265
+ - name: Install uv
266
+ uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
267
+ with:
268
+ version-file: pyproject.toml
269
+ resolution-strategy: highest
270
+
271
+ - name: Publish to PyPI
272
+ run: uv publish 'wheels-*/*'
@@ -0,0 +1,16 @@
1
+ debug/
2
+ target/
3
+ **/*.rs.bk
4
+ *.pdb
5
+ *.so
6
+ *.pyc
7
+ __pycache__/
8
+ *.py[oc]
9
+ build/
10
+ dist/
11
+ wheels/
12
+ *.egg-info
13
+ .venv/
14
+ .ruff_cache/
15
+ .pytest_cache/
16
+ .coverage
@@ -0,0 +1,133 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 4
4
+
5
+ [[package]]
6
+ name = "heck"
7
+ version = "0.5.0"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
10
+
11
+ [[package]]
12
+ name = "libc"
13
+ version = "0.2.186"
14
+ source = "registry+https://github.com/rust-lang/crates.io-index"
15
+ checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
16
+
17
+ [[package]]
18
+ name = "once_cell"
19
+ version = "1.21.4"
20
+ source = "registry+https://github.com/rust-lang/crates.io-index"
21
+ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
22
+
23
+ [[package]]
24
+ name = "portable-atomic"
25
+ version = "1.13.1"
26
+ source = "registry+https://github.com/rust-lang/crates.io-index"
27
+ checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"
28
+
29
+ [[package]]
30
+ name = "proc-macro2"
31
+ version = "1.0.106"
32
+ source = "registry+https://github.com/rust-lang/crates.io-index"
33
+ checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
34
+ dependencies = [
35
+ "unicode-ident",
36
+ ]
37
+
38
+ [[package]]
39
+ name = "pyo3"
40
+ version = "0.28.3"
41
+ source = "registry+https://github.com/rust-lang/crates.io-index"
42
+ checksum = "91fd8e38a3b50ed1167fb981cd6fd60147e091784c427b8f7183a7ee32c31c12"
43
+ dependencies = [
44
+ "libc",
45
+ "once_cell",
46
+ "portable-atomic",
47
+ "pyo3-build-config",
48
+ "pyo3-ffi",
49
+ "pyo3-macros",
50
+ ]
51
+
52
+ [[package]]
53
+ name = "pyo3-build-config"
54
+ version = "0.28.3"
55
+ source = "registry+https://github.com/rust-lang/crates.io-index"
56
+ checksum = "e368e7ddfdeb98c9bca7f8383be1648fd84ab466bf2bc015e94008db6d35611e"
57
+ dependencies = [
58
+ "target-lexicon",
59
+ ]
60
+
61
+ [[package]]
62
+ name = "pyo3-ffi"
63
+ version = "0.28.3"
64
+ source = "registry+https://github.com/rust-lang/crates.io-index"
65
+ checksum = "7f29e10af80b1f7ccaf7f69eace800a03ecd13e883acfacc1e5d0988605f651e"
66
+ dependencies = [
67
+ "libc",
68
+ "pyo3-build-config",
69
+ ]
70
+
71
+ [[package]]
72
+ name = "pyo3-macros"
73
+ version = "0.28.3"
74
+ source = "registry+https://github.com/rust-lang/crates.io-index"
75
+ checksum = "df6e520eff47c45997d2fc7dd8214b25dd1310918bbb2642156ef66a67f29813"
76
+ dependencies = [
77
+ "proc-macro2",
78
+ "pyo3-macros-backend",
79
+ "quote",
80
+ "syn",
81
+ ]
82
+
83
+ [[package]]
84
+ name = "pyo3-macros-backend"
85
+ version = "0.28.3"
86
+ source = "registry+https://github.com/rust-lang/crates.io-index"
87
+ checksum = "c4cdc218d835738f81c2338f822078af45b4afdf8b2e33cbb5916f108b813acb"
88
+ dependencies = [
89
+ "heck",
90
+ "proc-macro2",
91
+ "pyo3-build-config",
92
+ "quote",
93
+ "syn",
94
+ ]
95
+
96
+ [[package]]
97
+ name = "quote"
98
+ version = "1.0.45"
99
+ source = "registry+https://github.com/rust-lang/crates.io-index"
100
+ checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
101
+ dependencies = [
102
+ "proc-macro2",
103
+ ]
104
+
105
+ [[package]]
106
+ name = "syn"
107
+ version = "2.0.117"
108
+ source = "registry+https://github.com/rust-lang/crates.io-index"
109
+ checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
110
+ dependencies = [
111
+ "proc-macro2",
112
+ "quote",
113
+ "unicode-ident",
114
+ ]
115
+
116
+ [[package]]
117
+ name = "target-lexicon"
118
+ version = "0.13.5"
119
+ source = "registry+https://github.com/rust-lang/crates.io-index"
120
+ checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
121
+
122
+ [[package]]
123
+ name = "unicode-ident"
124
+ version = "1.0.24"
125
+ source = "registry+https://github.com/rust-lang/crates.io-index"
126
+ checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
127
+
128
+ [[package]]
129
+ name = "wirio-settings"
130
+ version = "0.0.1"
131
+ dependencies = [
132
+ "pyo3",
133
+ ]
@@ -0,0 +1,18 @@
1
+ [package]
2
+ name = "wirio-settings"
3
+ version = "0.0.1"
4
+ edition = "2024"
5
+ readme = "README.md"
6
+
7
+ [lib]
8
+ name = "_wirio_settings"
9
+ crate-type = ["cdylib"]
10
+
11
+ [dependencies]
12
+ pyo3 = { version = "0.28.3", features = [
13
+ "experimental-inspect",
14
+ "experimental-async",
15
+ ] }
16
+
17
+ [package.metadata.maturin]
18
+ python-source = "python"
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Andreu Codina
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,15 @@
1
+ .PHONY: install
2
+ install:
3
+ uv sync --all-extras
4
+
5
+ .PHONY: check-code
6
+ check-code:
7
+ uv run -- ruff check
8
+ uv run -- ruff format --diff
9
+ uv run -- ty check
10
+
11
+ .PHONY: setup-development
12
+ setup-development:
13
+ uv run -- maturin develop --generate-stubs --uv
14
+ uv run -- maturin generate-stubs -o python/wirio_settings
15
+
@@ -0,0 +1,18 @@
1
+ Metadata-Version: 2.4
2
+ Name: wirio-settings
3
+ Version: 0.0.1
4
+ Classifier: Development Status :: 5 - Production/Stable
5
+ Classifier: Programming Language :: Python :: 3.14
6
+ Classifier: Programming Language :: Python :: 3.13
7
+ Classifier: Intended Audience :: Developers
8
+ Requires-Dist: pydantic>=2.13.4
9
+ Requires-Dist: pyyaml>=6.0.3
10
+ Requires-Dist: boto3[crt]>=1.42.71 ; extra == 'aws-secrets-manager'
11
+ Requires-Dist: aiohttp>=3.13.3 ; extra == 'azure-key-vault'
12
+ Requires-Dist: azure-identity>=1.25.2 ; extra == 'azure-key-vault'
13
+ Requires-Dist: azure-keyvault-secrets>=4.10.0 ; extra == 'azure-key-vault'
14
+ Provides-Extra: aws-secrets-manager
15
+ Provides-Extra: azure-key-vault
16
+ License-File: LICENSE
17
+ Keywords: settings,azure,Azure Key Vault,aws,AWS Secrets Manager
18
+ Requires-Python: >=3.13
@@ -0,0 +1,185 @@
1
+ ## Overview
2
+
3
+ Lightning-fast, strongly typed, and zero boilerplate settings library for Python:
4
+
5
+ - **Great defaults from day one:** It automatically looks for settings files and environment variables, with recommended configurations and zero boilerplate.
6
+ - **Rust-powered core:** Built with Rust under the hood for speed, reliability, and low runtime overhead.
7
+ - **Cloud secrets when we need them:** Azure Key Vault and AWS Secrets Manager integrations are available with one line of code, with safe authentication.
8
+ - **Works naturally with Pydantic models:** Load your app settings directly into models.
9
+ - **Async-ready by design:** Built to work smoothly with modern async Python apps and cloud SDKs.
10
+ - **A practical replacement:** Replace `pydantic-settings` and `python-dotenv` with one unified settings library.
11
+ - **Roadmap:** Planned capabilities include automatic reload on settings changes (events, time, sentinel, async), pluggable configuration stores, feature flags and lifetimes.
12
+
13
+ ## 📦 Installation
14
+
15
+ ```bash
16
+ uv add wirio-settings
17
+ ```
18
+
19
+ ## ✨ Quickstart with Pydantic models
20
+
21
+ ```python
22
+ from pydantic import BaseModel
23
+ from wirio_settings import SettingsManager
24
+
25
+
26
+ class ApplicationSettings(BaseModel):
27
+ database_password: str
28
+
29
+
30
+ application_settings = SettingsManager().get_model(ApplicationSettings)
31
+ ```
32
+
33
+ ## Source priority
34
+
35
+ `wirio-settings` supports multiple sources. When the same key exists in multiple sources, the last added sources have more priority.
36
+
37
+ The following sources are loaded, by default, in this order:
38
+
39
+ 1. `settings.yaml`
40
+ 2. `settings.{environment}.yaml`.
41
+ 3. Environment variables
42
+
43
+ Considerations:
44
+
45
+ - Files are optional. If a file is not found, it's skipped.
46
+ - `{environment}` is the value of the `WIRIO_ENVIRONMENT` environment variable. If the variable is not set, its value is `local`. This would load, for example, `settings.production.yaml` if `WIRIO_ENVIRONMENT=production`. It standardizes the environment detection and allows us to store all settings in code, with version control.
47
+ - In the default settings, environment variables have higher priority than YAML files because the source is added after them. This means that if a key exists in both `settings.yaml` and environment variables, the value from environment variables will be used.
48
+ - If we add more sources, those will have higher priority than the defaults. For example, if we add Azure Key Vault as a source, it will override the defaults.
49
+
50
+ ```python
51
+ SettingsManager().add_azure_key_vault("https://example.vault.azure.net/")
52
+ ```
53
+
54
+ ## Naming convention
55
+
56
+ Each source (environment variables, YAML, Azure Key Vault...) has its own naming convention for keys. `wirio-settings` uses snake case for settings keys. When loading from sources, keys are normalized to snake case. For example, the `APP_NAME` environment variable maps to `app_name`.
57
+
58
+ ## Recommended usage
59
+
60
+ It depends on your usage, but the recommended setup is having the following files:
61
+
62
+ - `settings.yaml` with the shared settings.
63
+ - `settings.{environment}.yaml` with the environment-specific settings. For example, `settings.production.yaml`, `settings.staging.yaml`, `settings.local.yaml`, etc.
64
+
65
+ Then, we declare the settings manager, loading the default sources:
66
+
67
+ ```python
68
+ settings_manager = SettingsManager()
69
+ ```
70
+
71
+ Now, `settings_manager` has settings loaded.
72
+
73
+ Let's say our API is deployed in production, so we have read the `key_vault_url` setting from `settings.production.yaml`. We can now add Azure Key Vault as a source and read the rest of the settings from there:
74
+
75
+ ```python
76
+ settings_manager.add_azure_key_vault(
77
+ settings_manager.get_required_value("key_vault_url")
78
+ )
79
+ ```
80
+
81
+ After that, we have all settings to construct our Pydantic model:
82
+
83
+ ```python
84
+ application_settings = settings_manager.get_model(ApplicationSettings)
85
+ ```
86
+
87
+ ## Read one value
88
+
89
+ - Use `get_required_value` when the key must exist.
90
+
91
+ ```python
92
+ openai_api_key = settings_manager.get_required_value("openai_api_key")
93
+ ```
94
+
95
+ By default, the settings system returns values as strings. To validate and convert to another type, pass the type as a second argument.
96
+
97
+ ```python
98
+ timeout_seconds = settings_manager.get_required_value("maximum_retries", int)
99
+ ```
100
+
101
+ - Use `get_value` for optional keys.
102
+
103
+ ```python
104
+ openai_api_key = settings_manager.get_value("openai_api_key")
105
+ timeout_seconds = settings_manager.get_value("maximum_retries", int)
106
+ ```
107
+
108
+ ## Defaults and required fields
109
+
110
+ If a model field has a default, that default is used when no value is found.
111
+
112
+ ```python
113
+ from pydantic import BaseModel
114
+
115
+
116
+ class ApplicationSettings(BaseModel):
117
+ app_name: str
118
+ port: int | None = None
119
+ ```
120
+
121
+ Here, `port` defaults to `None` when missing.
122
+ If a required field is missing, `get_model` raises `KeyError`.
123
+
124
+ ## Sections
125
+
126
+ Use `get_section` to read a section. For example, we can read the next YAML:
127
+
128
+ ```yaml
129
+ logging:
130
+ log_level: WARNING
131
+ ```
132
+
133
+ ```python
134
+ log_level = settings_manager.get_section("logging").get_required_value(
135
+ "log_level"
136
+ )
137
+ ```
138
+
139
+ `SettingsSection` supports:
140
+
141
+ - The section value itself with `section.get_required_value()` or `section.get_required_value(type)`.
142
+ - A child value with `section.get_required_value("child.key")` or `section.get_required_value("child.key", type)`.
143
+
144
+ If a section has only children and no value at its own path, `section.get_value()` returns `None`.
145
+
146
+ ## Nested keys
147
+
148
+ Nested keys use `.`:
149
+
150
+ - `database.host`
151
+ - `database.port`
152
+ - `logging.log_level.default`
153
+
154
+ ## Other sources
155
+
156
+ ### Azure Key Vault
157
+
158
+ ```bash
159
+ uv add wirio-settings[azure-key-vault]
160
+ ```
161
+
162
+ 1. Add Key Vault as a source:
163
+
164
+ ```python
165
+ settings_manager.add_azure_key_vault(
166
+ "https://example.vault.azure.net",
167
+ )
168
+ ```
169
+
170
+ If no credential is provided, `DefaultAzureCredential` is used.
171
+ We can also pass a custom async Azure credential with the `credential` parameter.
172
+
173
+ ## AWS Secrets Manager
174
+
175
+ ```bash
176
+ uv add wirio-settings[aws-secrets-manager]
177
+ ```
178
+
179
+ ```python
180
+ settings_manager.add_aws_secrets_manager(
181
+ "SecretName"
182
+ )
183
+ ```
184
+
185
+ The secret value must be a JSON object. `wirio-settings` reads and flattens that JSON into settings keys.