CfgForge 0.1.0__py3-none-any.whl

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.
@@ -0,0 +1,161 @@
1
+ Metadata-Version: 2.4
2
+ Name: CfgForge
3
+ Version: 0.1.0
4
+ Summary: Multi-source configuration loader and merger for env / json / yaml / toml
5
+ Author: _COME_HERE_
6
+ License: MIT
7
+ Keywords: config,configuration,settings,env,yaml,toml
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.9
10
+ Classifier: Programming Language :: Python :: 3.10
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: OS Independent
15
+ Requires-Python: >=3.9
16
+ Description-Content-Type: text/markdown
17
+ Provides-Extra: yaml
18
+ Requires-Dist: pyyaml>=6.0; extra == "yaml"
19
+ Provides-Extra: toml
20
+ Requires-Dist: tomli>=2.0; python_version < "3.11" and extra == "toml"
21
+ Provides-Extra: all
22
+ Requires-Dist: pyyaml>=6.0; extra == "all"
23
+ Requires-Dist: tomli>=2.0; python_version < "3.11" and extra == "all"
24
+
25
+ # CfgForge
26
+
27
+ Multi-source configuration loader and merger for Python.
28
+ Supports `env`, `json`, `yaml`, and `toml` — with priority-based merging,
29
+ dot-path access, and type checking.
30
+
31
+ ## Features
32
+
33
+ - Load multiple config sources in order; later ones override earlier ones
34
+ - Dot-path access: `config.get("db.host")`
35
+ - Type validation: `config.expect("db.port", int)`
36
+ - Required keys: `config.get("api.key", required=True)`
37
+ - Optional dependencies: install only what you need
38
+ - Clear error messages for missing keys, wrong types, and parse failures
39
+
40
+ ## Installation
41
+
42
+ ```bash
43
+ pip install CfgForge
44
+ ```
45
+
46
+ With YAML support:
47
+
48
+ ```bash
49
+ pip install CfgForge[yaml]
50
+ ```
51
+
52
+ With all optional formats:
53
+
54
+ ```bash
55
+ pip install CfgForge[all]
56
+ ```
57
+
58
+ ## Quick Start
59
+
60
+ ```python
61
+ from CfgForge import config
62
+
63
+ # Load sources (later overrides earlier)
64
+ config.load(".env", "config.yaml", defaults={"db.host": "localhost"})
65
+
66
+ # Read by dot-path
67
+ host = config.get("db.host") # "localhost"
68
+ port = config.get("db.port", 5432) # with default
69
+ key = config.get("api.key", required=True) # raises if missing
70
+
71
+ # Type check
72
+ port = config.expect("db.port", int)
73
+ ```
74
+
75
+ ## Supported Formats
76
+
77
+ | Format | Extension | Dependency |
78
+ |--------|------------------|-------------------------------|
79
+ | env | `.env` | none |
80
+ | JSON | `.json` | none |
81
+ | YAML | `.yaml` / `.yml` | `pyyaml` |
82
+ | TOML | `.toml` | `tomllib` (3.11+) or `tomli` |
83
+
84
+ ## API Reference
85
+
86
+ ### `config.load(*paths, defaults=None)`
87
+
88
+ Load one or more config files. Later sources override earlier ones.
89
+ `defaults` has the lowest priority.
90
+
91
+ ```python
92
+ config.load(".env", "config.yaml", defaults={"db.host": "localhost"})
93
+ ```
94
+
95
+ ### `config.get(key, default=None, required=False)`
96
+
97
+ Read a value by dot-path.
98
+
99
+ ```python
100
+ config.get("db.host") # None if missing
101
+ config.get("db.host", "localhost") # fallback value
102
+ config.get("db.host", required=True) # raises if missing
103
+ ```
104
+
105
+ ### `config.expect(key, type_)`
106
+
107
+ Read a value and validate its type.
108
+
109
+ ```python
110
+ port = config.expect("db.port", int) # raises ConfigTypeError if not int
111
+ ```
112
+
113
+ ### `config.has(key)`
114
+
115
+ Check whether a key exists.
116
+
117
+ ```python
118
+ if config.has("db.password"):
119
+ ...
120
+ ```
121
+
122
+ ### `config.update(data)`
123
+
124
+ Inject config manually (useful for tests or runtime overrides).
125
+
126
+ ```python
127
+ config.update({"db": {"host": "localhost"}})
128
+ ```
129
+
130
+ ### `config.all()`
131
+
132
+ Return a shallow copy of all config data.
133
+
134
+ ```python
135
+ data = config.all()
136
+ ```
137
+
138
+ ## Exception Hierarchy
139
+
140
+ ```
141
+ CfgForgeError
142
+ ├── ConfigNotFoundError
143
+ ├── ConfigTypeError
144
+ └── ConfigFileError
145
+ ```
146
+
147
+ Catch all at once:
148
+
149
+ ```python
150
+ from CfgForge import CfgForgeError
151
+
152
+ try:
153
+ config.load("config.yaml")
154
+ config.get("db.host", required=True)
155
+ except CfgForgeError as e:
156
+ print(f"Config error: {e}")
157
+ ```
158
+
159
+ ## License
160
+
161
+ MIT
@@ -0,0 +1,4 @@
1
+ cfgforge-0.1.0.dist-info/METADATA,sha256=72e2rWu5Rc5Pfsi_4WOFAnlD5asmh1DdRw3wneaUlE0,4008
2
+ cfgforge-0.1.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
3
+ cfgforge-0.1.0.dist-info/top_level.txt,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
4
+ cfgforge-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+