RecursiveNamespaceV2 0.0.2__tar.gz → 0.0.3__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.
- recursivenamespacev2-0.0.3/.gitignore +172 -0
- recursivenamespacev2-0.0.3/PKG-INFO +157 -0
- recursivenamespacev2-0.0.3/README.md +114 -0
- recursivenamespacev2-0.0.3/pyproject.toml +96 -0
- recursivenamespacev2-0.0.3/src/recursivenamespace/__init__.py +23 -0
- recursivenamespacev2-0.0.3/src/recursivenamespace/errors.py +27 -0
- recursivenamespacev2-0.0.3/src/recursivenamespace/main.py +895 -0
- {recursivenamespacev2-0.0.2 → recursivenamespacev2-0.0.3}/src/recursivenamespace/utils.py +31 -21
- recursivenamespacev2-0.0.2/PKG-INFO +0 -196
- recursivenamespacev2-0.0.2/README.md +0 -158
- recursivenamespacev2-0.0.2/pyproject.toml +0 -88
- recursivenamespacev2-0.0.2/src/recursivenamespace/__init__.py +0 -16
- recursivenamespacev2-0.0.2/src/recursivenamespace/_version.py +0 -729
- recursivenamespacev2-0.0.2/src/recursivenamespace/_version_pdm.py +0 -1
- recursivenamespacev2-0.0.2/src/recursivenamespace/main.py +0 -501
- recursivenamespacev2-0.0.2/tests/test_recursive_namespace.py +0 -57
- recursivenamespacev2-0.0.2/tests/test_rns_v2.py +0 -138
- recursivenamespacev2-0.0.2/tests/test_utils.py +0 -89
- {recursivenamespacev2-0.0.2 → recursivenamespacev2-0.0.3}/LICENSE +0 -0
- /recursivenamespacev2-0.0.2/tests/__init__.py → /recursivenamespacev2-0.0.3/src/recursivenamespace/py.typed +0 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
coverage*/
|
|
54
|
+
|
|
55
|
+
# Translations
|
|
56
|
+
*.mo
|
|
57
|
+
*.pot
|
|
58
|
+
|
|
59
|
+
# Django stuff:
|
|
60
|
+
*.log
|
|
61
|
+
local_settings.py
|
|
62
|
+
db.sqlite3
|
|
63
|
+
db.sqlite3-journal
|
|
64
|
+
|
|
65
|
+
# Flask stuff:
|
|
66
|
+
instance/
|
|
67
|
+
.webassets-cache
|
|
68
|
+
|
|
69
|
+
# Scrapy stuff:
|
|
70
|
+
.scrapy
|
|
71
|
+
|
|
72
|
+
# Sphinx documentation
|
|
73
|
+
docs/_build/
|
|
74
|
+
|
|
75
|
+
# PyBuilder
|
|
76
|
+
.pybuilder/
|
|
77
|
+
target/
|
|
78
|
+
|
|
79
|
+
# Jupyter Notebook
|
|
80
|
+
.ipynb_checkpoints
|
|
81
|
+
|
|
82
|
+
# IPython
|
|
83
|
+
profile_default/
|
|
84
|
+
ipython_config.py
|
|
85
|
+
|
|
86
|
+
# pyenv
|
|
87
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
88
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
89
|
+
# .python-version
|
|
90
|
+
|
|
91
|
+
# pipenv
|
|
92
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
93
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
94
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
95
|
+
# install all needed dependencies.
|
|
96
|
+
#Pipfile.lock
|
|
97
|
+
|
|
98
|
+
# UV
|
|
99
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
100
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
101
|
+
# commonly ignored for libraries.
|
|
102
|
+
#uv.lock
|
|
103
|
+
|
|
104
|
+
# poetry
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
106
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
107
|
+
# commonly ignored for libraries.
|
|
108
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
109
|
+
#poetry.lock
|
|
110
|
+
|
|
111
|
+
# uv
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
113
|
+
# This ensures reproducibility in CI and development environments.
|
|
114
|
+
uv.lock
|
|
115
|
+
|
|
116
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
117
|
+
__pypackages__/
|
|
118
|
+
|
|
119
|
+
# Celery stuff
|
|
120
|
+
celerybeat-schedule
|
|
121
|
+
celerybeat.pid
|
|
122
|
+
|
|
123
|
+
# SageMath parsed files
|
|
124
|
+
*.sage.py
|
|
125
|
+
|
|
126
|
+
# Environments
|
|
127
|
+
.env
|
|
128
|
+
.venv
|
|
129
|
+
env/
|
|
130
|
+
venv/
|
|
131
|
+
ENV/
|
|
132
|
+
env.bak/
|
|
133
|
+
venv.bak/
|
|
134
|
+
|
|
135
|
+
# Spyder project settings
|
|
136
|
+
.spyderproject
|
|
137
|
+
.spyproject
|
|
138
|
+
|
|
139
|
+
# Rope project settings
|
|
140
|
+
.ropeproject
|
|
141
|
+
|
|
142
|
+
# mkdocs documentation
|
|
143
|
+
/site
|
|
144
|
+
|
|
145
|
+
# mypy
|
|
146
|
+
.mypy_cache/
|
|
147
|
+
.dmypy.json
|
|
148
|
+
dmypy.json
|
|
149
|
+
|
|
150
|
+
# Pyre type checker
|
|
151
|
+
.pyre/
|
|
152
|
+
|
|
153
|
+
# pytype static type analyzer
|
|
154
|
+
.pytype/
|
|
155
|
+
|
|
156
|
+
# Cython debug symbols
|
|
157
|
+
cython_debug/
|
|
158
|
+
|
|
159
|
+
# PyCharm
|
|
160
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
161
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
162
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
163
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
164
|
+
#.idea/
|
|
165
|
+
|
|
166
|
+
# Ruff stuff:
|
|
167
|
+
.ruff_cache/
|
|
168
|
+
|
|
169
|
+
# PyPI configuration file
|
|
170
|
+
.pypirc
|
|
171
|
+
|
|
172
|
+
out/
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: RecursiveNamespaceV2
|
|
3
|
+
Version: 0.0.3
|
|
4
|
+
Summary: Recursive Namespace. An extension of SimpleNamespace. Enhance get/set and parse from JSON
|
|
5
|
+
Project-URL: homepage, https://github.com/pasxd245/RecursiveNamespaceV2
|
|
6
|
+
Project-URL: repository, https://github.com/pasxd245/RecursiveNamespaceV2
|
|
7
|
+
Author-email: VienPQ <pasxd245@gmail.com>
|
|
8
|
+
License: MIT License
|
|
9
|
+
|
|
10
|
+
Copyright (c) Jan.2025 VienPQ
|
|
11
|
+
|
|
12
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
in the Software without restriction, including without limitation the rights
|
|
15
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
furnished to do so, subject to the following conditions:
|
|
18
|
+
|
|
19
|
+
The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
copies or substantial portions of the Software.
|
|
21
|
+
|
|
22
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
SOFTWARE.
|
|
29
|
+
License-File: LICENSE
|
|
30
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
31
|
+
Classifier: Operating System :: OS Independent
|
|
32
|
+
Classifier: Programming Language :: Python :: 3
|
|
33
|
+
Requires-Python: >=3.8
|
|
34
|
+
Provides-Extra: dev
|
|
35
|
+
Requires-Dist: pre-commit>=3.0; extra == 'dev'
|
|
36
|
+
Provides-Extra: docs
|
|
37
|
+
Requires-Dist: sphinx-rtd-theme>=2.0; extra == 'docs'
|
|
38
|
+
Requires-Dist: sphinx>=7.0; extra == 'docs'
|
|
39
|
+
Provides-Extra: test
|
|
40
|
+
Requires-Dist: coverage>=7.0; extra == 'test'
|
|
41
|
+
Requires-Dist: pytest>=6.0; extra == 'test'
|
|
42
|
+
Description-Content-Type: text/markdown
|
|
43
|
+
|
|
44
|
+
# RecursiveNamespaceV2
|
|
45
|
+
|
|
46
|
+
[](https://github.com/pasxd245/RecursiveNamespaceV2/actions/workflows/ci.yml)
|
|
47
|
+
[](https://github.com/pasxd245/RecursiveNamespaceV2/actions/workflows/type-check.yml)
|
|
48
|
+
[](https://codecov.io/gh/pasxd245/RecursiveNamespaceV2)
|
|
49
|
+
[](https://pypi.org/project/RecursiveNamespaceV2/)
|
|
50
|
+
[](https://badge.fury.io/py/RecursiveNamespaceV2)
|
|
51
|
+
[](https://github.com/pasxd245/RecursiveNamespaceV2/blob/main/LICENSE)
|
|
52
|
+
[](https://github.com/astral-sh/ruff)
|
|
53
|
+
|
|
54
|
+
## Description
|
|
55
|
+
|
|
56
|
+
**RecursiveNamespaceV2** extends Python's **SimpleNamespace** to make nested dicts easy to work with using attribute access, dict access, and chain-keys.
|
|
57
|
+
|
|
58
|
+
Full documentation: [https://recursivenamespacev2.readthedocs.io/](https://recursivenamespacev2.readthedocs.io/)
|
|
59
|
+
|
|
60
|
+
Key features:
|
|
61
|
+
|
|
62
|
+
- Recursive conversion of nested dicts/lists
|
|
63
|
+
- Attribute and dict access (`rn.a` and `rn["a"]`)
|
|
64
|
+
- Chain-key access (`rn.val_get("a.b.c")`)
|
|
65
|
+
- Array indexing and append syntax (`items[].0`, `items[].#`)
|
|
66
|
+
- Typed, zero-dependency, pure Python
|
|
67
|
+
|
|
68
|
+
## Installation
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
pip install RecursiveNamespaceV2
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Or with [uv](https://docs.astral.sh/uv/):
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
uv add RecursiveNamespaceV2
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
For development from source:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
git clone https://github.com/pasxd245/RecursiveNamespaceV2.git
|
|
84
|
+
cd RecursiveNamespaceV2
|
|
85
|
+
uv venv
|
|
86
|
+
source .venv/bin/activate # On Windows: .venv\Scripts\activate
|
|
87
|
+
uv pip install -e ".[test]"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Quick Start
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
from recursivenamespace import RNS # or RecursiveNamespace
|
|
94
|
+
|
|
95
|
+
data = {
|
|
96
|
+
'name': 'John',
|
|
97
|
+
'age': 30,
|
|
98
|
+
'address': {
|
|
99
|
+
'street': '123 Main St',
|
|
100
|
+
'city': 'Anytown'
|
|
101
|
+
},
|
|
102
|
+
'friends': ['Jane', 'Tom']
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
rn = RNS(data)
|
|
106
|
+
print(rn.address.city) # Anytown
|
|
107
|
+
print(rn["friends"][1]) # Tom
|
|
108
|
+
|
|
109
|
+
# Chain-key access
|
|
110
|
+
rn.val_set("address.zip", "12345")
|
|
111
|
+
print(rn.val_get("address.zip")) # 12345
|
|
112
|
+
|
|
113
|
+
# Convert back to dict
|
|
114
|
+
data2 = rn.to_dict()
|
|
115
|
+
print(data2["address"]["city"]) # Anytown
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Examples
|
|
119
|
+
|
|
120
|
+
See the `examples/` directory for 15 runnable examples organized by difficulty (basic, intermediate, advanced, real-world).
|
|
121
|
+
|
|
122
|
+
## Testing
|
|
123
|
+
|
|
124
|
+
To run tests, navigate to the project's root directory and execute:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
uv run pytest -s
|
|
128
|
+
# or with coverage:
|
|
129
|
+
uv run coverage run -m pytest
|
|
130
|
+
# to generate html report:
|
|
131
|
+
uv run coverage html
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Release
|
|
135
|
+
|
|
136
|
+
Versions are derived automatically from **git tags** (via [hatch-vcs](https://github.com/ofek/hatch-vcs)):
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
git tag -a v1.2.3 -m "v1.2.3"
|
|
140
|
+
git push --tags
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
CI automatically builds, publishes to PyPI (OIDC trusted publishing), and creates a GitHub Release with auto-generated notes.
|
|
144
|
+
|
|
145
|
+
## Contributing
|
|
146
|
+
|
|
147
|
+
Contributions to the **RecursiveNamespace** project are welcome! Please ensure that any pull requests include tests covering new features or fixes. See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
|
|
148
|
+
|
|
149
|
+
## License
|
|
150
|
+
|
|
151
|
+
This project is licensed under the MIT License - see the `LICENSE` file for details.
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Transparency
|
|
156
|
+
|
|
157
|
+
AI-assisted development (e.g., Claude Code, Copilot) was used for scaffolding and iteration.
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# RecursiveNamespaceV2
|
|
2
|
+
|
|
3
|
+
[](https://github.com/pasxd245/RecursiveNamespaceV2/actions/workflows/ci.yml)
|
|
4
|
+
[](https://github.com/pasxd245/RecursiveNamespaceV2/actions/workflows/type-check.yml)
|
|
5
|
+
[](https://codecov.io/gh/pasxd245/RecursiveNamespaceV2)
|
|
6
|
+
[](https://pypi.org/project/RecursiveNamespaceV2/)
|
|
7
|
+
[](https://badge.fury.io/py/RecursiveNamespaceV2)
|
|
8
|
+
[](https://github.com/pasxd245/RecursiveNamespaceV2/blob/main/LICENSE)
|
|
9
|
+
[](https://github.com/astral-sh/ruff)
|
|
10
|
+
|
|
11
|
+
## Description
|
|
12
|
+
|
|
13
|
+
**RecursiveNamespaceV2** extends Python's **SimpleNamespace** to make nested dicts easy to work with using attribute access, dict access, and chain-keys.
|
|
14
|
+
|
|
15
|
+
Full documentation: [https://recursivenamespacev2.readthedocs.io/](https://recursivenamespacev2.readthedocs.io/)
|
|
16
|
+
|
|
17
|
+
Key features:
|
|
18
|
+
|
|
19
|
+
- Recursive conversion of nested dicts/lists
|
|
20
|
+
- Attribute and dict access (`rn.a` and `rn["a"]`)
|
|
21
|
+
- Chain-key access (`rn.val_get("a.b.c")`)
|
|
22
|
+
- Array indexing and append syntax (`items[].0`, `items[].#`)
|
|
23
|
+
- Typed, zero-dependency, pure Python
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install RecursiveNamespaceV2
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Or with [uv](https://docs.astral.sh/uv/):
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
uv add RecursiveNamespaceV2
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
For development from source:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
git clone https://github.com/pasxd245/RecursiveNamespaceV2.git
|
|
41
|
+
cd RecursiveNamespaceV2
|
|
42
|
+
uv venv
|
|
43
|
+
source .venv/bin/activate # On Windows: .venv\Scripts\activate
|
|
44
|
+
uv pip install -e ".[test]"
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Quick Start
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
from recursivenamespace import RNS # or RecursiveNamespace
|
|
51
|
+
|
|
52
|
+
data = {
|
|
53
|
+
'name': 'John',
|
|
54
|
+
'age': 30,
|
|
55
|
+
'address': {
|
|
56
|
+
'street': '123 Main St',
|
|
57
|
+
'city': 'Anytown'
|
|
58
|
+
},
|
|
59
|
+
'friends': ['Jane', 'Tom']
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
rn = RNS(data)
|
|
63
|
+
print(rn.address.city) # Anytown
|
|
64
|
+
print(rn["friends"][1]) # Tom
|
|
65
|
+
|
|
66
|
+
# Chain-key access
|
|
67
|
+
rn.val_set("address.zip", "12345")
|
|
68
|
+
print(rn.val_get("address.zip")) # 12345
|
|
69
|
+
|
|
70
|
+
# Convert back to dict
|
|
71
|
+
data2 = rn.to_dict()
|
|
72
|
+
print(data2["address"]["city"]) # Anytown
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Examples
|
|
76
|
+
|
|
77
|
+
See the `examples/` directory for 15 runnable examples organized by difficulty (basic, intermediate, advanced, real-world).
|
|
78
|
+
|
|
79
|
+
## Testing
|
|
80
|
+
|
|
81
|
+
To run tests, navigate to the project's root directory and execute:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
uv run pytest -s
|
|
85
|
+
# or with coverage:
|
|
86
|
+
uv run coverage run -m pytest
|
|
87
|
+
# to generate html report:
|
|
88
|
+
uv run coverage html
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Release
|
|
92
|
+
|
|
93
|
+
Versions are derived automatically from **git tags** (via [hatch-vcs](https://github.com/ofek/hatch-vcs)):
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
git tag -a v1.2.3 -m "v1.2.3"
|
|
97
|
+
git push --tags
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
CI automatically builds, publishes to PyPI (OIDC trusted publishing), and creates a GitHub Release with auto-generated notes.
|
|
101
|
+
|
|
102
|
+
## Contributing
|
|
103
|
+
|
|
104
|
+
Contributions to the **RecursiveNamespace** project are welcome! Please ensure that any pull requests include tests covering new features or fixes. See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
|
|
105
|
+
|
|
106
|
+
## License
|
|
107
|
+
|
|
108
|
+
This project is licensed under the MIT License - see the `LICENSE` file for details.
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Transparency
|
|
113
|
+
|
|
114
|
+
AI-assisted development (e.g., Claude Code, Copilot) was used for scaffolding and iteration.
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling", "hatch-vcs"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = 'RecursiveNamespaceV2'
|
|
7
|
+
dynamic = ['version']
|
|
8
|
+
description = 'Recursive Namespace. An extension of SimpleNamespace. Enhance get/set and parse from JSON'
|
|
9
|
+
readme = 'README.md'
|
|
10
|
+
authors = [{ name = 'VienPQ', email = 'pasxd245@gmail.com' }]
|
|
11
|
+
license = { file = 'LICENSE' }
|
|
12
|
+
requires-python = '>=3.8'
|
|
13
|
+
dependencies = []
|
|
14
|
+
classifiers = [
|
|
15
|
+
'Programming Language :: Python :: 3',
|
|
16
|
+
'License :: OSI Approved :: MIT License',
|
|
17
|
+
'Operating System :: OS Independent',
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
[project.urls]
|
|
21
|
+
homepage = 'https://github.com/pasxd245/RecursiveNamespaceV2'
|
|
22
|
+
repository = 'https://github.com/pasxd245/RecursiveNamespaceV2'
|
|
23
|
+
|
|
24
|
+
[project.optional-dependencies]
|
|
25
|
+
dev = ['pre-commit>=3.0']
|
|
26
|
+
test = ['pytest>=6.0', 'coverage>=7.0']
|
|
27
|
+
docs = ['sphinx>=7.0', 'sphinx-rtd-theme>=2.0']
|
|
28
|
+
|
|
29
|
+
[tool.hatch.version]
|
|
30
|
+
source = "vcs"
|
|
31
|
+
|
|
32
|
+
[tool.hatch.version.raw-options]
|
|
33
|
+
version_scheme = "guess-next-dev"
|
|
34
|
+
local_scheme = "no-local-version"
|
|
35
|
+
|
|
36
|
+
[tool.hatch.build.targets.sdist]
|
|
37
|
+
include = ["src/recursivenamespace"]
|
|
38
|
+
|
|
39
|
+
[tool.hatch.build.targets.wheel]
|
|
40
|
+
packages = ["src/recursivenamespace"]
|
|
41
|
+
|
|
42
|
+
[tool.ruff]
|
|
43
|
+
line-length = 80
|
|
44
|
+
target-version = "py310"
|
|
45
|
+
fix = true
|
|
46
|
+
|
|
47
|
+
[tool.pytest.ini_options]
|
|
48
|
+
minversion = "6.0"
|
|
49
|
+
addopts = "--strict-markers --strict-config --capture=no --durations=30 --junitxml=out/test-data.xml"
|
|
50
|
+
testpaths = ["tests"]
|
|
51
|
+
junit_family = "xunit2"
|
|
52
|
+
|
|
53
|
+
[tool.coverage.run]
|
|
54
|
+
branch = true
|
|
55
|
+
|
|
56
|
+
[tool.coverage.report]
|
|
57
|
+
ignore_errors = false
|
|
58
|
+
show_missing = true
|
|
59
|
+
exclude_lines = [
|
|
60
|
+
# Have to re-enable the standard pragma
|
|
61
|
+
"pragma: no cover",
|
|
62
|
+
# Don't complain about missing debug-only code:s
|
|
63
|
+
"def __repr__",
|
|
64
|
+
"if self.debug",
|
|
65
|
+
# Don't complain if tests don't hit defensive assertion code:
|
|
66
|
+
"raise AssertionError",
|
|
67
|
+
"raise NotImplementedError",
|
|
68
|
+
"AbstractMethodError",
|
|
69
|
+
# Don't complain if non-runnable code isn't run:
|
|
70
|
+
"if 0:",
|
|
71
|
+
"if __name__ == .__main__.:",
|
|
72
|
+
"if TYPE_CHECKING:",
|
|
73
|
+
]
|
|
74
|
+
|
|
75
|
+
[tool.coverage.html]
|
|
76
|
+
directory = "coverage_html_report"
|
|
77
|
+
|
|
78
|
+
[tool.codespell]
|
|
79
|
+
ignore-words-list = "rns"
|
|
80
|
+
ignore-regex = 'https://([\w/\.])+'
|
|
81
|
+
|
|
82
|
+
[tool.mypy]
|
|
83
|
+
python_version = "3.9"
|
|
84
|
+
warn_return_any = true
|
|
85
|
+
warn_unused_configs = true
|
|
86
|
+
disallow_untyped_defs = true
|
|
87
|
+
disallow_incomplete_defs = true
|
|
88
|
+
check_untyped_defs = true
|
|
89
|
+
disallow_untyped_decorators = false
|
|
90
|
+
no_implicit_optional = true
|
|
91
|
+
warn_redundant_casts = true
|
|
92
|
+
warn_unused_ignores = true
|
|
93
|
+
warn_no_return = true
|
|
94
|
+
follow_imports = "normal"
|
|
95
|
+
strict_equality = true
|
|
96
|
+
strict = true
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from .main import recursivenamespace
|
|
4
|
+
from .main import recursivenamespace as RecursiveNamespace
|
|
5
|
+
from .main import recursivenamespace as RNS
|
|
6
|
+
from . import main as rns
|
|
7
|
+
from .errors import GetChainKeyError, SerializationError, SetChainKeyError
|
|
8
|
+
|
|
9
|
+
from importlib.metadata import version as _get_version
|
|
10
|
+
|
|
11
|
+
__version__: str = _get_version("RecursiveNamespaceV2")
|
|
12
|
+
del _get_version
|
|
13
|
+
|
|
14
|
+
__all__ = [
|
|
15
|
+
"recursivenamespace",
|
|
16
|
+
"RecursiveNamespace",
|
|
17
|
+
"RNS",
|
|
18
|
+
"rns",
|
|
19
|
+
"GetChainKeyError",
|
|
20
|
+
"SerializationError",
|
|
21
|
+
"SetChainKeyError",
|
|
22
|
+
"__version__",
|
|
23
|
+
]
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"""Custom exception classes for RecursiveNamespaceV2."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class SetChainKeyError(KeyError):
|
|
9
|
+
def __init__(self, obj: Any, key: str, sub_key: str) -> None:
|
|
10
|
+
super().__init__(
|
|
11
|
+
f"The object '{key}' typeof({type(obj)}) does not support"
|
|
12
|
+
f" set[] operator on chain-key '{sub_key}'."
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class GetChainKeyError(KeyError):
|
|
17
|
+
def __init__(self, obj: Any, key: str, sub_key: str) -> None:
|
|
18
|
+
super().__init__(
|
|
19
|
+
f"The object '{key}' typeof({type(obj)}) does not support"
|
|
20
|
+
f" get[] operator on chain-key '{sub_key}'."
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class SerializationError(Exception):
|
|
25
|
+
"""Raised when serialization or deserialization fails."""
|
|
26
|
+
|
|
27
|
+
pass
|