# deepset - Recursive Subset Comparison for Python
[](https://pypi.org/project/deepset/)
[](https://pypi.org/project/deepset/)
[](https://github.com/pjkundert/python-deepset/blob/master/LICENSE)
Recursive subset comparison for complex nested Python data structures. Express relationships like "this nested structure is contained within that one" naturally.
## Quick Start
```python
from deepset import deepset
# Set subsets
assert deepset({1, 2}) <= {1, 2, 3} # True
# Nested structures
assert deepset({('a', frozenset({2}))}) <= {('a', frozenset({2, 3}))} # True
# Sequential lists (order matters, gaps allowed)
assert deepset([1, 3]) <= [1, 2, 3, 4] # True
# Dictionary subsets
assert deepset({'a': 1}) <= {'a': 1, 'b': 2} # True
# Mixed nested
data1 = {'sets': {frozenset({1, 2})}, 'lists': [[1, 2]]}
data2 = {'sets': {frozenset({1, 2, 3})}, 'lists': [[1, 2, 3]]}
assert deepset(data1) <= data2 # True
```
## Installation
```bash
pip install deepset
```
## Comparison Types
**Sets**: Traditional subset semantics
```python
assert deepset({1, 2}) < {1, 2, 3} # True (strict subset)
assert deepset({frozenset({1, 2})}) <= {frozenset({1, 2, 3})} # Recursive
```
**Lists/Tuples**: Sequential subset (order preserved, gaps allowed)
```python
assert deepset([1, 3]) <= [1, 2, 3, 4] # True
assert not deepset([1, 3]) <= [3, 1] # False (wrong order)
```
**Dictionaries**: Key subset + recursive value comparison
```python
assert deepset({'a': 1}) <= {'a': 1, 'b': 2} # True (extra key)
assert deepset({'a': [1, 2]}) <= {'a': [1, 2, 3]} # True (recursive)
```
**All Operators**: `<`, `<=`, `==`, `>=`, `>` supported
## Development
```bash
git clone https://github.com/pjkundert/python-deepset.git
cd python-deepset
# Standard development (with user provided Python, package installation)
make install-dev # Install dev dependencies
make test # Run tests
make style # Format code (autopep8, black, isort)
make build # Build package
# Nix environment (recommended for reproducible builds)
make nix-venv # Enter Nix + venv environment
make nix-venv-test # Run tests in Nix environment
make nix-venv-unit-test_name # Run specific test class
# Multi-version testing
TARGET=py310 make nix-venv-test # Test with Python 3.10
TARGET=py312 make nix-venv-test # Test with Python 3.12
```
## License
MIT License - Perry Kundert <perry@dominionrnd.com>
Raw data
{
"_id": null,
"home_page": null,
"name": "deepset",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "comparison, subset, recursive, nested, data-structures",
"author": null,
"author_email": "Perry Kundert <perry@dominionrnd.com>",
"download_url": "https://files.pythonhosted.org/packages/6c/8f/b3c3719701d31d72f0f9cd65303e5c7fa3aa951a8b154782ef2b8729af3f/deepset-1.0.1.tar.gz",
"platform": null,
"description": "# deepset - Recursive Subset Comparison for Python\n\n[](https://pypi.org/project/deepset/)\n[](https://pypi.org/project/deepset/)\n[](https://github.com/pjkundert/python-deepset/blob/master/LICENSE)\n\nRecursive subset comparison for complex nested Python data structures. Express relationships like \"this nested structure is contained within that one\" naturally.\n\n## Quick Start\n\n```python\nfrom deepset import deepset\n\n# Set subsets\nassert deepset({1, 2}) <= {1, 2, 3} # True\n\n# Nested structures \nassert deepset({('a', frozenset({2}))}) <= {('a', frozenset({2, 3}))} # True\n\n# Sequential lists (order matters, gaps allowed)\nassert deepset([1, 3]) <= [1, 2, 3, 4] # True\n\n# Dictionary subsets\nassert deepset({'a': 1}) <= {'a': 1, 'b': 2} # True\n\n# Mixed nested\ndata1 = {'sets': {frozenset({1, 2})}, 'lists': [[1, 2]]}\ndata2 = {'sets': {frozenset({1, 2, 3})}, 'lists': [[1, 2, 3]]}\nassert deepset(data1) <= data2 # True\n```\n\n## Installation\n\n```bash\npip install deepset\n```\n\n## Comparison Types\n\n**Sets**: Traditional subset semantics\n```python\nassert deepset({1, 2}) < {1, 2, 3} # True (strict subset)\nassert deepset({frozenset({1, 2})}) <= {frozenset({1, 2, 3})} # Recursive\n```\n\n**Lists/Tuples**: Sequential subset (order preserved, gaps allowed)\n```python\nassert deepset([1, 3]) <= [1, 2, 3, 4] # True\nassert not deepset([1, 3]) <= [3, 1] # False (wrong order)\n```\n\n**Dictionaries**: Key subset + recursive value comparison\n```python\nassert deepset({'a': 1}) <= {'a': 1, 'b': 2} # True (extra key)\nassert deepset({'a': [1, 2]}) <= {'a': [1, 2, 3]} # True (recursive)\n```\n\n**All Operators**: `<`, `<=`, `==`, `>=`, `>` supported\n\n## Development\n\n```bash\ngit clone https://github.com/pjkundert/python-deepset.git\ncd python-deepset\n\n# Standard development (with user provided Python, package installation)\nmake install-dev # Install dev dependencies\nmake test # Run tests\nmake style # Format code (autopep8, black, isort)\nmake build # Build package\n\n# Nix environment (recommended for reproducible builds)\nmake nix-venv # Enter Nix + venv environment\nmake nix-venv-test # Run tests in Nix environment\nmake nix-venv-unit-test_name # Run specific test class\n\n# Multi-version testing\nTARGET=py310 make nix-venv-test # Test with Python 3.10\nTARGET=py312 make nix-venv-test # Test with Python 3.12\n```\n\n## License\n\nMIT License - Perry Kundert <perry@dominionrnd.com>\n",
"bugtrack_url": null,
"license": null,
"summary": "Recursive subset comparison for complex nested Python data structures",
"version": "1.0.1",
"project_urls": {
"Bug Reports": "https://github.com/pjkundert/python-deepset/issues",
"Homepage": "https://github.com/pjkundert/python-deepset",
"Source": "https://github.com/pjkundert/python-deepset"
},
"split_keywords": [
"comparison",
" subset",
" recursive",
" nested",
" data-structures"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "87f282a1e152927cea3a7ada99ecd75347c9f0f1bf862f11c999a8e48c7faa39",
"md5": "00f71059e53cf7955c7ba3cd4323d50c",
"sha256": "71c50b540fab374c21f4fe88ed6a3212f40f5f7bfb138a578049865efffac0bf"
},
"downloads": -1,
"filename": "deepset-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "00f71059e53cf7955c7ba3cd4323d50c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 5710,
"upload_time": "2025-07-27T14:10:54",
"upload_time_iso_8601": "2025-07-27T14:10:54.875468Z",
"url": "https://files.pythonhosted.org/packages/87/f2/82a1e152927cea3a7ada99ecd75347c9f0f1bf862f11c999a8e48c7faa39/deepset-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "6c8fb3c3719701d31d72f0f9cd65303e5c7fa3aa951a8b154782ef2b8729af3f",
"md5": "abbcc65572e6823a232ab47e9b961851",
"sha256": "a7e6b1542b57680e0eba7f0d50bd5a1809909405d6fac19b023dc57c421cbd93"
},
"downloads": -1,
"filename": "deepset-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "abbcc65572e6823a232ab47e9b961851",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 5729,
"upload_time": "2025-07-27T14:10:56",
"upload_time_iso_8601": "2025-07-27T14:10:56.020614Z",
"url": "https://files.pythonhosted.org/packages/6c/8f/b3c3719701d31d72f0f9cd65303e5c7fa3aa951a8b154782ef2b8729af3f/deepset-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-27 14:10:56",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pjkundert",
"github_project": "python-deepset",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "deepset"
}