casconf 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 (47) hide show
  1. casconf-0.1.2/.github/workflows/release.yaml +147 -0
  2. casconf-0.1.2/.github/workflows/test.yaml +80 -0
  3. casconf-0.1.2/API.md +399 -0
  4. casconf-0.1.2/ARCHITECTURE.md +403 -0
  5. casconf-0.1.2/AUTHORS +1 -0
  6. casconf-0.1.2/CONTRIBUTING.md +334 -0
  7. casconf-0.1.2/ChangeLog +7 -0
  8. casconf-0.1.2/DESIGN.md +182 -0
  9. casconf-0.1.2/LICENSE +690 -0
  10. casconf-0.1.2/PKG-INFO +188 -0
  11. casconf-0.1.2/Pipfile +29 -0
  12. casconf-0.1.2/README.md +135 -0
  13. casconf-0.1.2/USAGE.md +554 -0
  14. casconf-0.1.2/casconf/__init__.py +30 -0
  15. casconf-0.1.2/casconf/__main__.py +10 -0
  16. casconf-0.1.2/casconf/api.py +84 -0
  17. casconf-0.1.2/casconf/cli.py +162 -0
  18. casconf-0.1.2/casconf/discovery.py +224 -0
  19. casconf-0.1.2/casconf/exceptions.py +54 -0
  20. casconf-0.1.2/casconf/merger.py +129 -0
  21. casconf-0.1.2/casconf/parser.py +83 -0
  22. casconf-0.1.2/casconf/py.typed +1 -0
  23. casconf-0.1.2/casconf/registry.py +218 -0
  24. casconf-0.1.2/casconf/writer.py +60 -0
  25. casconf-0.1.2/casconf.egg-info/PKG-INFO +188 -0
  26. casconf-0.1.2/casconf.egg-info/SOURCES.txt +46 -0
  27. casconf-0.1.2/casconf.egg-info/dependency_links.txt +1 -0
  28. casconf-0.1.2/casconf.egg-info/entry_points.txt +2 -0
  29. casconf-0.1.2/casconf.egg-info/not-zip-safe +1 -0
  30. casconf-0.1.2/casconf.egg-info/pbr.json +1 -0
  31. casconf-0.1.2/casconf.egg-info/requires.txt +21 -0
  32. casconf-0.1.2/casconf.egg-info/top_level.txt +1 -0
  33. casconf-0.1.2/pyproject.toml +156 -0
  34. casconf-0.1.2/setup.cfg +37 -0
  35. casconf-0.1.2/setup.py +13 -0
  36. casconf-0.1.2/tests/__init__.py +1 -0
  37. casconf-0.1.2/tests/fixtures/base/config.json +19 -0
  38. casconf-0.1.2/tests/fixtures/extra/config.ini +5 -0
  39. casconf-0.1.2/tests/fixtures/override/config.yaml +8 -0
  40. casconf-0.1.2/tests/test_api.py +116 -0
  41. casconf-0.1.2/tests/test_cli.py +242 -0
  42. casconf-0.1.2/tests/test_discovery.py +292 -0
  43. casconf-0.1.2/tests/test_exceptions.py +55 -0
  44. casconf-0.1.2/tests/test_merger.py +196 -0
  45. casconf-0.1.2/tests/test_parser.py +121 -0
  46. casconf-0.1.2/tests/test_registry.py +54 -0
  47. casconf-0.1.2/tests/test_writer.py +91 -0
@@ -0,0 +1,147 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*.*.*"
7
+
8
+ # Default to read-only. Each job overrides only what it needs.
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ # ──────────────────────────────────────────────────────────────────
14
+ # 1. Build a source distribution + pure-Python wheel.
15
+ # The wheel is "highly portable" because casconf is pure Python
16
+ # (no C extensions), so one wheel runs on any OS/arch/Python.
17
+ # ──────────────────────────────────────────────────────────────────
18
+ build:
19
+ name: Build distribution
20
+ runs-on: ubuntu-latest
21
+
22
+ steps:
23
+ - name: Harden runner
24
+ uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
25
+ with:
26
+ egress-policy: block
27
+ allowed-endpoints: >
28
+ files.pythonhosted.org:443
29
+ github.com:443
30
+ pypi.org:443
31
+
32
+ - name: Checkout
33
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
34
+
35
+ - name: Set up Python
36
+ uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
37
+ with:
38
+ python-version: "3.12"
39
+
40
+ - name: Install build tooling
41
+ run: python -m pip install --upgrade pip build
42
+
43
+ - name: Build sdist and wheel
44
+ run: python -m build
45
+
46
+ - name: Verify the wheel is pure-Python (no platform tag)
47
+ run: |
48
+ ls dist/
49
+ # A portable wheel's filename ends in -none-any.whl
50
+ if ! ls dist/*.whl | grep -q "none-any.whl"; then
51
+ echo "ERROR: wheel is not pure-Python / universal!"
52
+ exit 1
53
+ fi
54
+
55
+ # Upload as a workflow artifact so publish jobs can download it
56
+ # without re-building from source. Both publish jobs consume the
57
+ # same artifact, guaranteeing they publish identical bytes.
58
+ - name: Upload dist artifact
59
+ uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
60
+ with:
61
+ name: dist
62
+ path: dist/
63
+ if-no-files-found: error
64
+ retention-days: 1
65
+
66
+ # ──────────────────────────────────────────────────────────────────
67
+ # 2. Publish to test.pypi.org for smoke-testing before going live.
68
+ # ──────────────────────────────────────────────────────────────────
69
+ publish-test-pypi:
70
+ name: Publish → Test PyPI
71
+ needs: build
72
+ runs-on: ubuntu-latest
73
+
74
+ # Scoped environment lets you require manual approval in GitHub
75
+ # before this job runs (Settings → Environments → test-pypi).
76
+ environment:
77
+ name: test-pypi
78
+ url: https://test.pypi.org/project/casconf/
79
+
80
+ # Trusted Publisher (OIDC) — no long-lived API token stored in secrets.
81
+ # PyPI mints a short-lived token for this exact workflow run only.
82
+ permissions:
83
+ contents: read
84
+ id-token: write # Required for OIDC token exchange
85
+
86
+ steps:
87
+ - name: Harden runner
88
+ uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
89
+ with:
90
+ egress-policy: block
91
+ allowed-endpoints: >
92
+ fulcio.sigstore.dev:443
93
+ ghcr.io:443
94
+ pkg-containers.githubusercontent.com:443
95
+ rekor.sigstore.dev:443
96
+ test.pypi.org:443
97
+ tuf-repo-cdn.sigstore.dev:443
98
+
99
+ - name: Download dist artifact
100
+ uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
101
+ with:
102
+ name: dist
103
+ path: dist/
104
+
105
+ - name: Publish to Test PyPI
106
+ uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
107
+ with:
108
+ repository-url: https://test.pypi.org/legacy/
109
+
110
+ # ──────────────────────────────────────────────────────────────────
111
+ # 3. Publish to pypi.org only after test.pypi.org succeeds.
112
+ # ──────────────────────────────────────────────────────────────────
113
+ publish-pypi:
114
+ name: Publish → PyPI
115
+ needs: publish-test-pypi
116
+ runs-on: ubuntu-latest
117
+
118
+ environment:
119
+ name: pypi
120
+ url: https://pypi.org/project/casconf/
121
+
122
+ permissions:
123
+ contents: read
124
+ id-token: write
125
+
126
+ steps:
127
+ - name: Harden runner
128
+ uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
129
+ with:
130
+ egress-policy: block
131
+ allowed-endpoints: >
132
+ fulcio.sigstore.dev:443
133
+ ghcr.io:443
134
+ pkg-containers.githubusercontent.com:443
135
+ pypi.org:443
136
+ rekor.sigstore.dev:443
137
+ tuf-repo-cdn.sigstore.dev:443
138
+ upload.pypi.org:443
139
+
140
+ - name: Download dist artifact
141
+ uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
142
+ with:
143
+ name: dist
144
+ path: dist/
145
+
146
+ - name: Publish to PyPI
147
+ uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
@@ -0,0 +1,80 @@
1
+ name: Test
2
+
3
+ on:
4
+ push:
5
+ branches: ["main"]
6
+ pull_request:
7
+ branches: ["main"]
8
+
9
+ # Minimal permissions — GITHUB_TOKEN can only read repo contents.
10
+ # Write access is not needed for running tests.
11
+ permissions:
12
+ contents: read
13
+
14
+ jobs:
15
+ test:
16
+ name: Test (Python ${{ matrix.python-version }})
17
+ runs-on: ubuntu-latest
18
+
19
+ strategy:
20
+ fail-fast: false
21
+ matrix:
22
+ python-version:
23
+ - "3.10"
24
+ - "3.11"
25
+ - "3.12"
26
+ - "3.13"
27
+ - "3.14"
28
+
29
+ steps:
30
+ # Harden the runner: restrict egress to known-good domains only.
31
+ # This blocks any unexpected outbound calls (e.g. curl | bash payloads)
32
+ # even if a dependency or action is compromised.
33
+ - name: Harden runner
34
+ uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
35
+ with:
36
+ egress-policy: block
37
+ allowed-endpoints: >
38
+ github.com:443
39
+ api.github.com:443
40
+ objects.githubusercontent.com:443
41
+ files.pythonhosted.org:443
42
+ pypi.org:443
43
+
44
+ # Pin to a full commit SHA — not a mutable tag like @v4.
45
+ # Mutable tags can be silently poisoned (see: xygeni-action incident).
46
+ - name: Checkout
47
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
48
+
49
+ - name: Set up Python ${{ matrix.python-version }}
50
+ uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
51
+ with:
52
+ python-version: ${{ matrix.python-version }}
53
+
54
+ - name: Install pipenv and dependencies
55
+ run: |
56
+ python -m pip install --upgrade pip pipenv
57
+ pipenv install --dev --deploy
58
+
59
+ # Lint, format, import-order, and type checks are style/correctness
60
+ # checks that don't vary by Python version — run them once on the
61
+ # latest version only to avoid redundant failures across the matrix.
62
+ - name: Lint
63
+ if: matrix.python-version == '3.14'
64
+ run: pipenv run lint
65
+
66
+ - name: Check formatting
67
+ if: matrix.python-version == '3.14'
68
+ run: pipenv run format-check
69
+
70
+ - name: Check import sorting
71
+ if: matrix.python-version == '3.14'
72
+ run: pipenv run sort-imports-check
73
+
74
+ - name: Type check
75
+ if: matrix.python-version == '3.14'
76
+ run: pipenv run typecheck
77
+
78
+ # Tests with coverage run on every Python version in the matrix.
79
+ - name: Test with coverage
80
+ run: pipenv run test-cov
casconf-0.1.2/API.md ADDED
@@ -0,0 +1,399 @@
1
+ # CasConf API Reference
2
+
3
+ This document describes the public Python library API for CasConf.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install casconf
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```python
14
+ from casconf import merge_configs
15
+
16
+ # Merge configurations and return as a dict
17
+ config = merge_configs(discovery_config='./casconf.yaml')
18
+ print(config['database']['host'])
19
+
20
+ # Merge configurations and write to a file
21
+ merge_configs(
22
+ discovery_config='./casconf.yaml',
23
+ output='./merged.json',
24
+ output_format='json',
25
+ )
26
+ ```
27
+
28
+ ---
29
+
30
+ ## Public API
31
+
32
+ ### `merge_configs()`
33
+
34
+ Discover, parse, and deep-merge configuration files.
35
+
36
+ ```python
37
+ def merge_configs(
38
+ discovery_config: str | Path | DiscoveryConfig = 'casconf.yaml',
39
+ output: str | Path | None = None,
40
+ output_format: str = 'json',
41
+ log_level: int = logging.WARNING,
42
+ ) -> dict[str, Any] | None:
43
+ ...
44
+ ```
45
+
46
+ #### Parameters
47
+
48
+ | Parameter | Type | Default | Description |
49
+ |-----------|------|---------|-------------|
50
+ | `discovery_config` | `str`, `Path`, or `DiscoveryConfig` | `'casconf.yaml'` | Path to the discovery configuration file, or a `DiscoveryConfig` object. |
51
+ | `output` | `str`, `Path`, or `None` | `None` | Path to the output file. If `None`, returns the merged dict. |
52
+ | `output_format` | `str` | `'json'` | Output format when writing to a file. One of `'json'`, `'yaml'`, `'toml'`. |
53
+ | `log_level` | `int` | `logging.WARNING` | Logging level for merge operations. Use `logging.DEBUG` for verbose output. |
54
+
55
+ #### Returns
56
+
57
+ - `dict[str, Any]`: The merged configuration, if `output` is `None`.
58
+ - `None`: If `output` is specified (the result is written to the file).
59
+
60
+ #### Raises
61
+
62
+ - `CasConfConfigError`: If the discovery configuration is invalid.
63
+ - `CasConfParseError`: If a configuration file cannot be parsed.
64
+ - `CasConfMergeError`: If configurations cannot be merged.
65
+ - `CasConfWriteError`: If the output file cannot be written.
66
+
67
+ #### Examples
68
+
69
+ ```python
70
+ from casconf import merge_configs
71
+
72
+ # Return merged config as a dict
73
+ config = merge_configs()
74
+
75
+ # Use a custom discovery config path
76
+ config = merge_configs(discovery_config='/etc/myapp/casconf.yaml')
77
+
78
+ # Use a DiscoveryConfig object
79
+ from casconf import DiscoveryConfig
80
+ discovery = DiscoveryConfig(
81
+ directories=['/etc/myapp', '~/.config/myapp', './config'],
82
+ patterns=['config.json'],
83
+ )
84
+ config = merge_configs(discovery_config=discovery)
85
+
86
+ # Write to a JSON file
87
+ merge_configs(
88
+ discovery_config='./casconf.yaml',
89
+ output='./merged.json',
90
+ )
91
+
92
+ # Write to a YAML file
93
+ merge_configs(
94
+ discovery_config='./casconf.yaml',
95
+ output='./merged.yaml',
96
+ output_format='yaml',
97
+ )
98
+
99
+ # Enable debug logging
100
+ import logging
101
+ config = merge_configs(log_level=logging.DEBUG)
102
+ ```
103
+
104
+ ---
105
+
106
+ ### `DiscoveryConfig`
107
+
108
+ Configuration object for the CasConf discovery engine.
109
+
110
+ ```python
111
+ class DiscoveryConfig:
112
+ def __init__(
113
+ self,
114
+ directories: list[str | Path],
115
+ patterns: list[str],
116
+ merge_strategy: str = 'deep',
117
+ ) -> None:
118
+ ...
119
+
120
+ @classmethod
121
+ def from_file(cls, path: str | Path) -> DiscoveryConfig:
122
+ ...
123
+
124
+ @classmethod
125
+ def from_dict(cls, data: dict[str, Any]) -> DiscoveryConfig:
126
+ ...
127
+ ```
128
+
129
+ #### Constructor Parameters
130
+
131
+ | Parameter | Type | Default | Description |
132
+ |-----------|------|---------|-------------|
133
+ | `directories` | `list[str \| Path]` | required | Ordered list of directories to scan. Later entries take precedence. Supports `~` expansion and glob patterns. |
134
+ | `patterns` | `list[str]` | required | File name patterns to match within each directory. Supports glob wildcards. |
135
+ | `merge_strategy` | `str` | `'deep'` | Merge strategy. One of `'deep'` or `'shallow'`. |
136
+
137
+ #### Class Methods
138
+
139
+ **`DiscoveryConfig.from_file(path)`**
140
+
141
+ Load a `DiscoveryConfig` from a YAML, JSON, or TOML file.
142
+
143
+ ```python
144
+ discovery = DiscoveryConfig.from_file('./casconf.yaml')
145
+ ```
146
+
147
+ **`DiscoveryConfig.from_dict(data)`**
148
+
149
+ Create a `DiscoveryConfig` from a Python dict.
150
+
151
+ ```python
152
+ discovery = DiscoveryConfig.from_dict({
153
+ 'directories': ['/etc/myapp', '~/.config/myapp'],
154
+ 'patterns': ['config.json'],
155
+ 'merge_strategy': 'deep',
156
+ })
157
+ ```
158
+
159
+ #### Attributes
160
+
161
+ | Attribute | Type | Description |
162
+ |-----------|------|-------------|
163
+ | `directories` | `list[Path]` | Resolved directory paths. |
164
+ | `patterns` | `list[str]` | File name patterns. |
165
+ | `merge_strategy` | `str` | Active merge strategy. |
166
+
167
+ #### Example
168
+
169
+ ```python
170
+ from pathlib import Path
171
+ from casconf import DiscoveryConfig, merge_configs
172
+
173
+ discovery = DiscoveryConfig(
174
+ directories=[
175
+ '/etc/myapp',
176
+ Path.home() / '.config' / 'myapp',
177
+ './config',
178
+ ],
179
+ patterns=['config.json', 'config.yaml', '*.conf.json'],
180
+ merge_strategy='deep',
181
+ )
182
+
183
+ config = merge_configs(discovery_config=discovery)
184
+ ```
185
+
186
+ ---
187
+
188
+ ## Exceptions
189
+
190
+ All CasConf exceptions are importable from `casconf.exceptions`.
191
+
192
+ ```python
193
+ from casconf.exceptions import (
194
+ CasConfError,
195
+ CasConfConfigError,
196
+ CasConfParseError,
197
+ CasConfMergeError,
198
+ CasConfWriteError,
199
+ )
200
+ ```
201
+
202
+ ### Exception Hierarchy
203
+
204
+ ```
205
+ CasConfError (base)
206
+ ├── CasConfConfigError — Invalid discovery configuration
207
+ ├── CasConfParseError — Failed to parse a configuration file
208
+ ├── CasConfMergeError — Irreconcilable merge conflict
209
+ └── CasConfWriteError — Failed to write output
210
+ ```
211
+
212
+ ### `CasConfError`
213
+
214
+ Base class for all CasConf exceptions.
215
+
216
+ ```python
217
+ class CasConfError(Exception):
218
+ """Base exception for all CasConf errors."""
219
+ ```
220
+
221
+ ### `CasConfConfigError`
222
+
223
+ Raised when the discovery configuration is invalid (missing required keys, invalid values, unreadable file).
224
+
225
+ ```python
226
+ class CasConfConfigError(CasConfError):
227
+ """Raised when the discovery configuration is invalid."""
228
+ ```
229
+
230
+ ### `CasConfParseError`
231
+
232
+ Raised when a configuration file cannot be read or parsed.
233
+
234
+ ```python
235
+ class CasConfParseError(CasConfError):
236
+ """Raised when a configuration file cannot be parsed.
237
+
238
+ Attributes:
239
+ path: The path to the file that failed to parse.
240
+ """
241
+ path: Path
242
+ ```
243
+
244
+ ### `CasConfMergeError`
245
+
246
+ Raised when configurations cannot be merged due to an irreconcilable conflict.
247
+
248
+ ```python
249
+ class CasConfMergeError(CasConfError):
250
+ """Raised when configurations cannot be merged."""
251
+ ```
252
+
253
+ ### `CasConfWriteError`
254
+
255
+ Raised when the output file cannot be written (permission denied, invalid path, unsupported format).
256
+
257
+ ```python
258
+ class CasConfWriteError(CasConfError):
259
+ """Raised when the output cannot be written."""
260
+ ```
261
+
262
+ ---
263
+
264
+ ## Usage Examples
265
+
266
+ ### Handling Errors Gracefully
267
+
268
+ ```python
269
+ from casconf import merge_configs
270
+ from casconf.exceptions import CasConfError, CasConfParseError
271
+
272
+ try:
273
+ config = merge_configs(discovery_config='./casconf.yaml')
274
+ except CasConfParseError as e:
275
+ print(f"Could not parse {e.path}: {e}")
276
+ raise SystemExit(1)
277
+ except CasConfError as e:
278
+ print(f"CasConf error: {e}")
279
+ raise SystemExit(1)
280
+ ```
281
+
282
+ ### Application Configuration Loader
283
+
284
+ ```python
285
+ import logging
286
+ from functools import lru_cache
287
+ from casconf import merge_configs, DiscoveryConfig
288
+ from casconf.exceptions import CasConfError
289
+
290
+ logger = logging.getLogger(__name__)
291
+
292
+ _DISCOVERY = DiscoveryConfig(
293
+ directories=[
294
+ '/etc/myapp',
295
+ '~/.config/myapp',
296
+ './config',
297
+ ],
298
+ patterns=['config.json', 'config.yaml'],
299
+ )
300
+
301
+
302
+ @lru_cache(maxsize=1)
303
+ def get_config() -> dict:
304
+ """Load and cache the application configuration."""
305
+ try:
306
+ return merge_configs(
307
+ discovery_config=_DISCOVERY,
308
+ log_level=logging.DEBUG,
309
+ )
310
+ except CasConfError as e:
311
+ logger.critical("Failed to load configuration: %s", e)
312
+ raise
313
+ ```
314
+
315
+ ### Multi-Environment Configuration
316
+
317
+ ```python
318
+ import os
319
+ from casconf import DiscoveryConfig, merge_configs
320
+
321
+ ENV = os.getenv('APP_ENV', 'development')
322
+
323
+ discovery = DiscoveryConfig(
324
+ directories=[
325
+ '/etc/myapp',
326
+ f'./config/base',
327
+ f'./config/{ENV}',
328
+ ],
329
+ patterns=['config.json'],
330
+ )
331
+
332
+ config = merge_configs(discovery_config=discovery)
333
+ ```
334
+
335
+ ---
336
+
337
+ ## Environment Variables
338
+
339
+ | Variable | Description | Default |
340
+ |----------|-------------|---------|
341
+ | `CASCONF_DISCOVERY` | Default path to the discovery configuration file | `casconf.yaml` |
342
+ | `CASCONF_LOG_LEVEL` | Default log level (`DEBUG`, `INFO`, `WARNING`, `ERROR`) | `WARNING` |
343
+
344
+ ```python
345
+ import os
346
+ os.environ['CASCONF_DISCOVERY'] = '/etc/myapp/casconf.yaml'
347
+
348
+ from casconf import merge_configs
349
+ config = merge_configs() # Uses /etc/myapp/casconf.yaml
350
+ ```
351
+
352
+ ---
353
+
354
+ ## Type Hints
355
+
356
+ CasConf ships with a `py.typed` marker (PEP 561). Full type hints are available for all public API functions and classes. Type checkers such as `mypy` and `pyright` are fully supported.
357
+
358
+ ```python
359
+ from typing import Any
360
+ from casconf import merge_configs, DiscoveryConfig
361
+
362
+ def load(discovery: DiscoveryConfig) -> dict[str, Any]:
363
+ result = merge_configs(discovery_config=discovery)
364
+ assert result is not None # output=None returns a dict
365
+ return result
366
+ ```
367
+
368
+ ---
369
+
370
+ ## Logging
371
+
372
+ CasConf uses the standard `logging` module under the logger name `casconf`. To see detailed merge information, configure logging before calling `merge_configs()`:
373
+
374
+ ```python
375
+ import logging
376
+ logging.basicConfig(level=logging.DEBUG)
377
+
378
+ from casconf import merge_configs
379
+ config = merge_configs()
380
+ ```
381
+
382
+ Or pass `log_level` directly:
383
+
384
+ ```python
385
+ from casconf import merge_configs
386
+ config = merge_configs(log_level=logging.DEBUG)
387
+ ```
388
+
389
+ Log levels:
390
+ - `DEBUG`: Shows each file discovered, parsed, and merged.
391
+ - `INFO`: Shows summary counts (files found, merged).
392
+ - `WARNING`: Shows warnings (missing directories, type conflicts).
393
+ - `ERROR`: Shows errors only (see also exceptions).
394
+
395
+ ---
396
+
397
+ ## Thread Safety
398
+
399
+ `merge_configs()` is **thread-safe** as long as the underlying configuration files are not modified during the call. `DiscoveryConfig` objects are immutable after construction and safe to share across threads.