CfgForge 0.1.0__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.
@@ -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,7 @@
1
+ README.md
2
+ pyproject.toml
3
+ CfgForge.egg-info/PKG-INFO
4
+ CfgForge.egg-info/SOURCES.txt
5
+ CfgForge.egg-info/dependency_links.txt
6
+ CfgForge.egg-info/requires.txt
7
+ CfgForge.egg-info/top_level.txt
@@ -0,0 +1,14 @@
1
+
2
+ [all]
3
+ pyyaml>=6.0
4
+
5
+ [all:python_version < "3.11"]
6
+ tomli>=2.0
7
+
8
+ [toml]
9
+
10
+ [toml:python_version < "3.11"]
11
+ tomli>=2.0
12
+
13
+ [yaml]
14
+ pyyaml>=6.0
@@ -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,137 @@
1
+ # CfgForge
2
+
3
+ Multi-source configuration loader and merger for Python.
4
+ Supports `env`, `json`, `yaml`, and `toml` — with priority-based merging,
5
+ dot-path access, and type checking.
6
+
7
+ ## Features
8
+
9
+ - Load multiple config sources in order; later ones override earlier ones
10
+ - Dot-path access: `config.get("db.host")`
11
+ - Type validation: `config.expect("db.port", int)`
12
+ - Required keys: `config.get("api.key", required=True)`
13
+ - Optional dependencies: install only what you need
14
+ - Clear error messages for missing keys, wrong types, and parse failures
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ pip install CfgForge
20
+ ```
21
+
22
+ With YAML support:
23
+
24
+ ```bash
25
+ pip install CfgForge[yaml]
26
+ ```
27
+
28
+ With all optional formats:
29
+
30
+ ```bash
31
+ pip install CfgForge[all]
32
+ ```
33
+
34
+ ## Quick Start
35
+
36
+ ```python
37
+ from CfgForge import config
38
+
39
+ # Load sources (later overrides earlier)
40
+ config.load(".env", "config.yaml", defaults={"db.host": "localhost"})
41
+
42
+ # Read by dot-path
43
+ host = config.get("db.host") # "localhost"
44
+ port = config.get("db.port", 5432) # with default
45
+ key = config.get("api.key", required=True) # raises if missing
46
+
47
+ # Type check
48
+ port = config.expect("db.port", int)
49
+ ```
50
+
51
+ ## Supported Formats
52
+
53
+ | Format | Extension | Dependency |
54
+ |--------|------------------|-------------------------------|
55
+ | env | `.env` | none |
56
+ | JSON | `.json` | none |
57
+ | YAML | `.yaml` / `.yml` | `pyyaml` |
58
+ | TOML | `.toml` | `tomllib` (3.11+) or `tomli` |
59
+
60
+ ## API Reference
61
+
62
+ ### `config.load(*paths, defaults=None)`
63
+
64
+ Load one or more config files. Later sources override earlier ones.
65
+ `defaults` has the lowest priority.
66
+
67
+ ```python
68
+ config.load(".env", "config.yaml", defaults={"db.host": "localhost"})
69
+ ```
70
+
71
+ ### `config.get(key, default=None, required=False)`
72
+
73
+ Read a value by dot-path.
74
+
75
+ ```python
76
+ config.get("db.host") # None if missing
77
+ config.get("db.host", "localhost") # fallback value
78
+ config.get("db.host", required=True) # raises if missing
79
+ ```
80
+
81
+ ### `config.expect(key, type_)`
82
+
83
+ Read a value and validate its type.
84
+
85
+ ```python
86
+ port = config.expect("db.port", int) # raises ConfigTypeError if not int
87
+ ```
88
+
89
+ ### `config.has(key)`
90
+
91
+ Check whether a key exists.
92
+
93
+ ```python
94
+ if config.has("db.password"):
95
+ ...
96
+ ```
97
+
98
+ ### `config.update(data)`
99
+
100
+ Inject config manually (useful for tests or runtime overrides).
101
+
102
+ ```python
103
+ config.update({"db": {"host": "localhost"}})
104
+ ```
105
+
106
+ ### `config.all()`
107
+
108
+ Return a shallow copy of all config data.
109
+
110
+ ```python
111
+ data = config.all()
112
+ ```
113
+
114
+ ## Exception Hierarchy
115
+
116
+ ```
117
+ CfgForgeError
118
+ ├── ConfigNotFoundError
119
+ ├── ConfigTypeError
120
+ └── ConfigFileError
121
+ ```
122
+
123
+ Catch all at once:
124
+
125
+ ```python
126
+ from CfgForge import CfgForgeError
127
+
128
+ try:
129
+ config.load("config.yaml")
130
+ config.get("db.host", required=True)
131
+ except CfgForgeError as e:
132
+ print(f"Config error: {e}")
133
+ ```
134
+
135
+ ## License
136
+
137
+ MIT
@@ -0,0 +1,32 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "CfgForge"
7
+ version = "0.1.0"
8
+ description = "Multi-source configuration loader and merger for env / json / yaml / toml"
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = { text = "MIT" }
12
+ authors = [
13
+ { name = "_COME_HERE_" }
14
+ ]
15
+ keywords = ["config", "configuration", "settings", "env", "yaml", "toml"]
16
+ classifiers = [
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3.9",
19
+ "Programming Language :: Python :: 3.10",
20
+ "Programming Language :: Python :: 3.11",
21
+ "Programming Language :: Python :: 3.12",
22
+ "License :: OSI Approved :: MIT License",
23
+ "Operating System :: OS Independent",
24
+ ]
25
+
26
+ [project.optional-dependencies]
27
+ yaml = ["pyyaml>=6.0"]
28
+ toml = ["tomli>=2.0; python_version < '3.11'"]
29
+ all = ["pyyaml>=6.0", "tomli>=2.0; python_version < '3.11'"]
30
+
31
+ [tool.setuptools.packages.find]
32
+ include = ["CfgForge*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+