nestedutils 1.1.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.
@@ -0,0 +1,4 @@
1
+ # These are supported funding model platforms
2
+
3
+ github: ysskrishna
4
+ patreon: ysskrishna
@@ -0,0 +1,51 @@
1
+ name: Deploy Docs
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ push:
6
+ tags:
7
+ # Publish on any tag starting with a `v`, e.g., v0.1.0
8
+ - v*
9
+
10
+ permissions:
11
+ contents: read
12
+ pages: write
13
+ id-token: write
14
+
15
+ concurrency:
16
+ group: "pages"
17
+ cancel-in-progress: false
18
+
19
+ jobs:
20
+ deploy:
21
+ environment:
22
+ name: github-pages
23
+ url: ${{ steps.deployment.outputs.page_url }}
24
+ runs-on: ubuntu-latest
25
+ steps:
26
+ - name: Checkout
27
+ uses: actions/checkout@v5
28
+
29
+ - name: Install uv
30
+ uses: astral-sh/setup-uv@v6
31
+
32
+ - name: Set up Python
33
+ run: uv python install 3.8
34
+
35
+ - name: Install dependencies
36
+ run: uv sync --group dev
37
+
38
+ - name: Setup Pages
39
+ uses: actions/configure-pages@v5
40
+
41
+ - name: Build with MkDocs
42
+ run: uv run mkdocs build
43
+
44
+ - name: Upload artifact
45
+ uses: actions/upload-pages-artifact@v3
46
+ with:
47
+ path: ./site
48
+
49
+ - name: Deploy to GitHub Pages
50
+ id: deployment
51
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,34 @@
1
+ name: "Publish"
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ # Publish on any tag starting with a `v`, e.g., v0.1.0
7
+ - v*
8
+
9
+ jobs:
10
+ run:
11
+ runs-on: ubuntu-latest
12
+ environment:
13
+ name: pypi
14
+ permissions:
15
+ id-token: write
16
+ contents: write
17
+ steps:
18
+ - name: Checkout
19
+ uses: actions/checkout@v5
20
+ - name: Install uv
21
+ uses: astral-sh/setup-uv@v6
22
+ - name: Install Python 3.8
23
+ run: uv python install 3.8
24
+ - name: Build
25
+ run: uv build
26
+ - name: Publish
27
+ run: uv publish
28
+ - name: Create GitHub Release
29
+ uses: softprops/action-gh-release@v2
30
+ with:
31
+ tag_name: ${{ github.ref_name }}
32
+ name: Release ${{ github.ref_name }}
33
+ env:
34
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,30 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
15
+
16
+ steps:
17
+ - name: Checkout
18
+ uses: actions/checkout@v5
19
+
20
+ - name: Install uv
21
+ uses: astral-sh/setup-uv@v6
22
+
23
+ - name: Set up Python ${{ matrix.python-version }}
24
+ run: uv python install ${{ matrix.python-version }}
25
+
26
+ - name: Install dependencies
27
+ run: uv sync --group dev
28
+
29
+ - name: Run tests
30
+ run: uv run pytest
@@ -0,0 +1,11 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
11
+ workspace/
@@ -0,0 +1,83 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.1.1]
9
+
10
+ ### Changed
11
+
12
+ - Updated documentation badge in README to include `/nestedutils` path
13
+
14
+ ## [1.1.0]
15
+
16
+ ### Added
17
+
18
+ - `exists_at()` function to check if a path exists in nested data structures
19
+ - Safety limits: Maximum path depth (100 levels) and maximum list index (10,000) to prevent resource exhaustion
20
+ - Comprehensive MkDocs documentation with Material theme
21
+ - CONTRIBUTING.md guide for contributors
22
+ - GitHub Actions workflow for automated documentation deployment
23
+
24
+ ### Changed
25
+
26
+ - **BREAKING**: Renamed API functions for consistency:
27
+ - `get_path()` → `get_at()`
28
+ - `set_path()` → `set_at()`
29
+ - `del_path()` → `delete_at()`
30
+ - Improved docstrings across all functions with detailed examples and parameter descriptions
31
+ - Enhanced path validation with better error messages for edge cases
32
+ - Refactored fill strategy handling using enums for better type safety
33
+ - Updated README with improved documentation and examples
34
+
35
+ ### Fixed
36
+
37
+ - Fixed bugs with negative index handling in `get_at()`, `set_at()`, and `delete_at()` methods
38
+ - Improved validation in path normalization function
39
+ - Fixed edge cases with empty paths and empty keys
40
+
41
+ ## [1.0.1]
42
+
43
+ ### Added
44
+
45
+ - GitHub Actions workflow enhancement to automatically create releases on publish
46
+
47
+ ### Changed
48
+
49
+ - Updated package description for better clarity and discoverability
50
+ - Expanded keywords in `pyproject.toml` for improved PyPI searchability
51
+ - Updated README with enhanced description and OG image
52
+
53
+ ## [1.0.0]
54
+
55
+ ### Added
56
+
57
+ - Initial release of nestedutils
58
+ - `get_path()` function for accessing nested values in dictionaries, lists
59
+ - `set_path()` function for setting nested values with automatic container creation
60
+ - `del_path()` function for deleting nested values
61
+ - Support for dot-notation string paths (`"a.b.c"`) and list paths (`["a", "b", "c"]`)
62
+ - List index support with positive and negative indices
63
+ - Multiple fill strategies for `set_path()`:
64
+ - `"auto"`: Intelligently creates containers based on next key type
65
+ - `"none"`: Fills missing list items with `None`
66
+ - `"dict"`: Always creates dictionaries
67
+ - `"list"`: Always creates lists
68
+ - Comprehensive error handling with `PathError` exception and `PathErrorCode` enum
69
+ - Support for navigating through `None` values (replaces with appropriate containers)
70
+ - Sparse list creation when setting values at high indices
71
+ - Full test coverage with comprehensive test suite
72
+
73
+ ### Features
74
+
75
+ - Zero external dependencies
76
+ - Python 3.8+ compatibility
77
+ - Immutable container protection (tuples cannot be modified)
78
+ - Safe list deletion (requires explicit `allow_list_mutation=True` flag)
79
+
80
+ [1.1.1]: https://github.com/ysskrishna/nestedutils/releases/tag/v1.1.1
81
+ [1.1.0]: https://github.com/ysskrishna/nestedutils/releases/tag/v1.1.0
82
+ [1.0.1]: https://github.com/ysskrishna/nestedutils/releases/tag/v1.0.1
83
+ [1.0.0]: https://github.com/ysskrishna/nestedutils/releases/tag/v1.0.0
@@ -0,0 +1,244 @@
1
+ # Contributing Guide
2
+
3
+ Thank you for your interest in contributing to `nestedutils`! This guide will help you get started with development and understand how to contribute effectively.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Code of Conduct](#code-of-conduct)
8
+ - [Getting Started](#getting-started)
9
+ - [Development Setup](#development-setup)
10
+ - [Making Changes](#making-changes)
11
+ - [Testing](#testing)
12
+ - [Submitting Changes](#submitting-changes)
13
+ - [Code Style](#code-style)
14
+ - [Building the Package](#building-the-package)
15
+ - [Documentation](#documentation)
16
+ - [Additional Resources](#additional-resources)
17
+
18
+ ## Code of Conduct
19
+
20
+ This project adheres to a code of conduct that all contributors are expected to follow. Please be respectful, inclusive, and constructive in all interactions.
21
+
22
+ ## Getting Started
23
+
24
+ Before you begin, make sure you have:
25
+
26
+ - Python 3.8 or higher
27
+ - [uv](https://github.com/astral-sh/uv) - A fast Python package installer and resolver
28
+ - Git installed and configured
29
+
30
+ ## Development Setup
31
+
32
+ ### Installing uv
33
+
34
+ If you don't have `uv` installed, you can install it using [UV Getting Started](https://docs.astral.sh/uv/getting-started/installation/)
35
+
36
+ ### Setting Up the Development Environment
37
+
38
+ 1. Fork the repository on GitHub
39
+
40
+ 2. Clone your fork locally:
41
+
42
+ ```bash
43
+ git clone https://github.com/YOUR_USERNAME/nestedutils.git
44
+ cd nestedutils
45
+ ```
46
+
47
+ 3. Add the upstream repository:
48
+
49
+ ```bash
50
+ git remote add upstream https://github.com/ysskrishna/nestedutils.git
51
+ ```
52
+
53
+ 4. Install the project and development dependencies using `uv`:
54
+
55
+ ```bash
56
+ uv sync --dev
57
+ ```
58
+
59
+ This will:
60
+ - Create a virtual environment (if it doesn't exist)
61
+ - Install the project in editable mode
62
+ - Install all development dependencies (including `pytest` and documentation tools)
63
+
64
+ ## Making Changes
65
+
66
+ 1. Create a new branch for your changes:
67
+
68
+ ```bash
69
+ git checkout -b feature/your-feature-name
70
+ # or
71
+ git checkout -b fix/your-bug-fix-name
72
+ ```
73
+
74
+ 2. Make your changes following the [Code Style](#code-style) guidelines
75
+
76
+ 3. Write or update tests for your changes (see [Testing](#testing))
77
+
78
+ 4. Ensure all tests pass and the code is properly formatted
79
+
80
+ ## Testing
81
+
82
+ ### Running Tests
83
+
84
+ Run all tests using pytest:
85
+
86
+ ```bash
87
+ uv run pytest
88
+ ```
89
+
90
+ ### Running Specific Test Files
91
+
92
+ ```bash
93
+ uv run pytest tests/test_get.py
94
+ ```
95
+
96
+ ### Running Specific Test Functions
97
+
98
+ ```bash
99
+ uv run pytest tests/test_get.py::test_get_at_basic
100
+ ```
101
+
102
+ ### Test Coverage
103
+
104
+ Make sure your changes include appropriate test coverage. All new features should have corresponding tests.
105
+
106
+ ### Writing Tests
107
+
108
+ - Place tests in the `tests/` directory
109
+ - Follow the existing test file naming convention (`test_*.py`)
110
+ - Test both success cases and error cases
111
+ - Include edge cases when relevant
112
+
113
+ ## Submitting Changes
114
+
115
+ 1. **Update Documentation**: If you've added new features or changed behavior, update the relevant documentation:
116
+ - Update `README.md` if the API or usage has changed
117
+ - Update `CHANGELOG.md` with a description of your changes
118
+ - Update docstrings if you've modified functions
119
+
120
+ 2. **Commit Your Changes**: Write clear, descriptive commit messages:
121
+
122
+ ```bash
123
+ git add .
124
+ git commit -m "Add feature: description of what you added"
125
+ ```
126
+
127
+ Good commit messages:
128
+ - Start with a verb in imperative mood (e.g., "Add", "Fix", "Update")
129
+ - Be concise but descriptive
130
+ - Reference issue numbers if applicable (e.g., "Fix #123: description")
131
+
132
+ 3. **Push to Your Fork**:
133
+
134
+ ```bash
135
+ git push origin feature/your-feature-name
136
+ ```
137
+
138
+ 4. **Create a Pull Request**:
139
+ - Go to the original repository on GitHub
140
+ - Click "New Pull Request"
141
+ - Select your fork and branch
142
+ - Fill out the PR template with:
143
+ - Description of changes
144
+ - Related issues (if any)
145
+ - Testing performed
146
+ - Any breaking changes
147
+
148
+ 5. **Respond to Feedback**: Be open to feedback and ready to make changes if requested
149
+
150
+ ## Code Style
151
+
152
+ ### General Guidelines
153
+
154
+ - Follow PEP 8 style guidelines
155
+ - Use meaningful variable and function names
156
+ - Keep functions focused and single-purpose
157
+ - Add docstrings to all public functions and classes
158
+ - Keep lines under 100 characters when possible
159
+
160
+ ### Type Hints
161
+
162
+ - Use type hints for function parameters and return values
163
+ - The project includes a `py.typed` marker file, so type hints are important
164
+
165
+ ### Documentation
166
+
167
+ - Use clear, concise docstrings
168
+ - Follow the existing docstring format in the codebase
169
+ - Include parameter descriptions and return value descriptions
170
+ - Add examples for complex functions
171
+
172
+ ### Import Organization
173
+
174
+ - Group imports: standard library, third-party, local
175
+ - Use absolute imports
176
+ - Keep imports at the top of the file
177
+
178
+ ## Building the Package
179
+
180
+ To build the package locally:
181
+
182
+ ```bash
183
+ uv build
184
+ ```
185
+
186
+ This will create distribution files in the `dist/` directory:
187
+ - `nestedutils-<version>-py3-none-any.whl` (wheel)
188
+ - `nestedutils-<version>.tar.gz` (source distribution)
189
+
190
+ ### Installing the Local Package
191
+
192
+ To test the package installation locally:
193
+
194
+ ```bash
195
+ # Install from the built wheel
196
+ uv pip install dist/nestedutils-*.whl
197
+
198
+ # Or install in editable mode for development
199
+ uv pip install -e .
200
+ ```
201
+
202
+ ## Documentation
203
+
204
+ This project uses [MkDocs](https://www.mkdocs.org/) with the [Material theme](https://github.com/squidfunk/mkdocs-material) for documentation.
205
+
206
+ ### Serving Documentation Locally
207
+
208
+ To preview the documentation locally with live reload:
209
+
210
+ ```bash
211
+ uv run mkdocs serve
212
+ ```
213
+
214
+ This will start a local development server (usually at `http://127.0.0.1:8000`) that automatically reloads when you make changes to the documentation files.
215
+
216
+ ### Building Documentation
217
+
218
+ To build the documentation as static HTML files:
219
+
220
+ ```bash
221
+ uv run mkdocs build
222
+ ```
223
+
224
+ This will create a `site/` directory containing the static HTML files ready for deployment.
225
+
226
+ ## Additional Resources
227
+
228
+ - [uv Documentation](https://docs.astral.sh/uv/)
229
+ - [pytest Documentation](https://docs.pytest.org/)
230
+ - [Python Packaging Guide](https://packaging.python.org/)
231
+ - [PEP 8 Style Guide](https://pep8.org/)
232
+ - [Type Hints Documentation](https://docs.python.org/3/library/typing.html)
233
+ - [MkDocs Documentation](https://www.mkdocs.org/)
234
+ - [Material for MkDocs](https://github.com/squidfunk/mkdocs-material)
235
+
236
+ ## Questions?
237
+
238
+ If you have questions or need help, feel free to:
239
+ - Open an issue on GitHub
240
+ - Check existing issues and discussions
241
+ - Review the codebase and documentation
242
+
243
+ Thank you for contributing to `nestedutils`! 🎉
244
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Y. Siva Sai Krishna
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.