# ๐ข Snaplit - Rust-powered Data Structures in Python.
[](LICENSE)
[](https://www.python.org/downloads/)
[](https://pypi.org/)
---
## โ What is Snaplit?
**Snaplit** is a Python library providing **mid- to high-level data structures** that leverage an extensive, high-performance **Rust backend**.
The library is designed to **maximize type safety, runtime speed & memory efficiency**, offering Python developers the ability to work with performant data structures without leaving the Python ecosystem.
Snaplit seamlessly exposes Rust-native structures through Python bindings, allowing users to achieve near-native performance for memory-intensive and computationally demanding operations.
## ๐ Core Philosophy
Snaplit is built upon 3 primary guiding principles:
1. **Rust efficiency in Python** - All core algorithms are implemented in Rust, ensuring predictable memory layout, zero-cost abstractions and low-level safety guarantees.
2. **Type safety & Reliability** - Rust's strict type system reduces runtime errors, while Python bindings provide a user-friendly interface.
3. **Performance without compromise** - Snaplit targets both **high-throughput perations** and **memory-constrained environments**, making it suitable for large-scale or high-frequency workloads.
## ๐ญ Why use Snaplit Data Structure?
- **Predictable performance**: Algorithms like 'Robin Hood Hashing' or custom tree structures provide near-constant-time lookups and insertions.
- **Memory efficiency**: Rust's ownership model and precise memory layout minimize overhead compared to native Python implementations.
- **Pythonic API**: Fully idiomatic Python interface without compromising speed.
- **Extensibility**: New Rust-based data structures can be exposed to Python without major refactoring.
## </> Installation
Utilise any Python-related package manager to add Snaplit to virtual environment:
```python
# Pip
pip install snaplit
# Conda
conda install snaplit
# Poetry
poetry add snaplit
```
## ๐ Linear Data Structures
```python
# Import statement
from snaplit.linear import (
LinkedList, Stack, ArrayStack, Queue,
PriorityQueue, CircularBuffer, RingBuffer
)
```
| Structure | Description |
|---------------------|--------------------------------------------------------------------------------------------------------------------------|
| **Linked List** | A dynamic, sequential data structure composed of nodes vis pointers, supporting efficient insertion and deletion. |
| **Stack** | A linear data structure that operates on the Last-In-First-Out (LIFO) principle. |
| **Array Stack** | A stack implementation backed by a fixed-size array, offering constant-time access and updates. |
| **Queue** | A linear data structure that operates on the First-In-First-Out (FIFO) principle. |
| **Priority Queue** | An abstract data type where elements are dequeued based on priority, typically implemented using a min-heap or max-heap. |
| **Circular Buffer** | A fixed-size buffer that connects its ends, allowing efficient reuse of space for streaming data. |
| **Ring Buffer** | A type of circular buffer that continuously overwrites the oldest data when full. |
## ๐ณ Tree Data Structures
```python
# Import statement
from snaplit.trees import AVLTree, BinarySearchTree, Trie
```
| Structure | Description |
|------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|
| **AVL Tree** | A self-balancing binary search tree that maintains height balance using rotation operations after insertions and deletions. |
| **Binary Search Tree** | A hierarchical data structure where each node has up to two children, with left child keys smaller and right child keys larger than the parent. |
| **Trie** | A tree-based data structure that stores strings by their prefixes, enabling efficient retrieval in dictionary and autocomplete applications. |
## ๐ถ Graph Data Structures
```python
# Import statement
from snaplit.graph import (
BaseGraph, Digraph, WeightedGraph, WeightedDigraph, Hypergraph
)
```
| Structure | Description |
|----------------------|---------------------------------------------------------------------------------------------------------------------|
| **Base Graph** | A fundamental graph structure consisting of vertices connected by unweighted edges, representing general relations. |
| **Digraph** | A graph where edges have a defined direction, representing one-way relationships between vertices. |
| **Weighted Graph** | A graph where edges carry numerical weights, typically representing cost, distance, or capacity between vertices. |
| **Weighted Digraph** | A directed graph with weighted edges, modeling asymmetric relationships with associated costs or values. |
| **Hypergraph** | A general graph structure where an edge can connect any number of vertices for modelling complex relationships. |
## ๏ผ
Probability Data Structures
```python
# Import statement
from snaplit.probability import BloomFilter, CuckooFilter, Flatlist
```
| Structure | Description |
|-------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
| **Bloom Filter** | A probabilistic data structure that tests set membership with space efficiency, allowing false positives but no false negatives. |
| **Cuckoo Filter** | A probabilistic data structure similar to a Bloom filter but supporting deletions through cuckoo hashing. |
| **Flatlist** | A simplified skip list structure that provides sorted storage with efficient search, insertion, and deletion using flattened index layers.
## #๏ธโฃ Hashing Data Structures
```python
# Import statement
from snaplit.hashing import SnapMap, RhoodMap
```
| Structures | Descriptions |
|--------------|--------------------------------------------------------------------------------------------------------------------------------------------|
| **SnapMap** | A hash map that resolves collisions using cuckoo hashing, relocating existing keys to alternate buckets to maintain constant-time lookups. |
| **RhoodMap** | A hash map that minimizes variance in probe sequence lengths by โstealingโ slots from entries with shorter probe distances. |
---
## ๐ฎ Future Roadmap
A short roadmap of additional advanced data structures to be added in the future.
* **Perfect LinkedList** - A Doubly-Linked Circular List structure.
* **XOR Filter** - Probabilistic data structure for membership checks.
* **HyperLogLog (HLL)** - Probabilistic data structure for estimating unique values.
* **Red-Black Tree** - Self-balanncing Binary Search Tree structure.
* **B+ Tree** - Self-balancing Binary Search Tree structure.
* **DAG** - Doubly-linked Acyclical Graph structure (similar to Digraph).
* **Suffix Tree** - Character-based search tree structure.
* **Adjacency Array** - Linked List strucutre utilising array-based backend.
* **Quadratic HashMap** - Ordinary HashMap implementation with Quadratic Probing.
* **Quadratic HashSet** - Ordinary Set structure with Quadratic Probing.
## ๐ค Contribution
Snaplit is open to contributions from both Python and Rust communities!
If you'd like to report a bug, suggest an additional feature or contribute code:
* Open an **issue** or **pull request** on Github
* Contact developers directly via the listed e-mail
## ๐ Licensing
Snaplit project is distributed under the **MIT License** - free for both commercial & personal use.
Raw data
{
"_id": null,
"home_page": null,
"name": "snaplit",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "rust, py03, python-extensions, data-structures, graphs, linear, probability, trees, hashing, algorithm, performance, library, ffi",
"author": null,
"author_email": "HysingerDev <HysingerDev@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/ac/bc/d73a4f609780aa2dd362b9dd985dded2baa82176551ff95a7ee8bbf73bb4/snaplit-0.1.0.tar.gz",
"platform": null,
"description": "# \ud83d\udd22 Snaplit - Rust-powered Data Structures in Python. \n\n[](LICENSE)\n[](https://www.python.org/downloads/)\n[](https://pypi.org/)\n\n---\n\n## \u2753 What is Snaplit?\n\n**Snaplit** is a Python library providing **mid- to high-level data structures** that leverage an extensive, high-performance **Rust backend**.\n\nThe library is designed to **maximize type safety, runtime speed & memory efficiency**, offering Python developers the ability to work with performant data structures without leaving the Python ecosystem.\nSnaplit seamlessly exposes Rust-native structures through Python bindings, allowing users to achieve near-native performance for memory-intensive and computationally demanding operations.\n\n## \ud83d\udcda Core Philosophy\n\nSnaplit is built upon 3 primary guiding principles:\n1. **Rust efficiency in Python** - All core algorithms are implemented in Rust, ensuring predictable memory layout, zero-cost abstractions and low-level safety guarantees.\n2. **Type safety & Reliability** - Rust's strict type system reduces runtime errors, while Python bindings provide a user-friendly interface.\n3. **Performance without compromise** - Snaplit targets both **high-throughput perations** and **memory-constrained environments**, making it suitable for large-scale or high-frequency workloads.\n\n## \ud83d\udcad Why use Snaplit Data Structure?\n\n- **Predictable performance**: Algorithms like 'Robin Hood Hashing' or custom tree structures provide near-constant-time lookups and insertions.\n- **Memory efficiency**: Rust's ownership model and precise memory layout minimize overhead compared to native Python implementations.\n- **Pythonic API**: Fully idiomatic Python interface without compromising speed.\n- **Extensibility**: New Rust-based data structures can be exposed to Python without major refactoring.\n\n## </> Installation\nUtilise any Python-related package manager to add Snaplit to virtual environment:\n\n```python\n# Pip \npip install snaplit\n# Conda\nconda install snaplit\n# Poetry\npoetry add snaplit\n```\n\n## \ud83d\udcc8 Linear Data Structures\n\n```python\n# Import statement\nfrom snaplit.linear import (\n LinkedList, Stack, ArrayStack, Queue,\n PriorityQueue, CircularBuffer, RingBuffer\n)\n```\n\n| Structure | Description |\n|---------------------|--------------------------------------------------------------------------------------------------------------------------|\n| **Linked List** | A dynamic, sequential data structure composed of nodes vis pointers, supporting efficient insertion and deletion. |\n| **Stack** | A linear data structure that operates on the Last-In-First-Out (LIFO) principle. |\n| **Array Stack** | A stack implementation backed by a fixed-size array, offering constant-time access and updates. |\n| **Queue** | A linear data structure that operates on the First-In-First-Out (FIFO) principle. |\n| **Priority Queue** | An abstract data type where elements are dequeued based on priority, typically implemented using a min-heap or max-heap. |\n| **Circular Buffer** | A fixed-size buffer that connects its ends, allowing efficient reuse of space for streaming data. |\n| **Ring Buffer** | A type of circular buffer that continuously overwrites the oldest data when full. |\n\n## \ud83c\udf33 Tree Data Structures\n\n```python\n# Import statement\nfrom snaplit.trees import AVLTree, BinarySearchTree, Trie\n```\n\n| Structure | Description |\n|------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|\n| **AVL Tree** | A self-balancing binary search tree that maintains height balance using rotation operations after insertions and deletions. |\n| **Binary Search Tree** | A hierarchical data structure where each node has up to two children, with left child keys smaller and right child keys larger than the parent. |\n| **Trie** | A tree-based data structure that stores strings by their prefixes, enabling efficient retrieval in dictionary and autocomplete applications. |\n\n## \ud83d\udcf6 Graph Data Structures\n\n```python\n# Import statement\nfrom snaplit.graph import (\n BaseGraph, Digraph, WeightedGraph, WeightedDigraph, Hypergraph\n)\n```\n\n| Structure | Description |\n|----------------------|---------------------------------------------------------------------------------------------------------------------|\n| **Base Graph** | A fundamental graph structure consisting of vertices connected by unweighted edges, representing general relations. |\n| **Digraph** | A graph where edges have a defined direction, representing one-way relationships between vertices. |\n| **Weighted Graph** | A graph where edges carry numerical weights, typically representing cost, distance, or capacity between vertices. |\n| **Weighted Digraph** | A directed graph with weighted edges, modeling asymmetric relationships with associated costs or values. |\n| **Hypergraph** | A general graph structure where an edge can connect any number of vertices for modelling complex relationships. |\n\n## \uff05 Probability Data Structures\n\n```python\n# Import statement\nfrom snaplit.probability import BloomFilter, CuckooFilter, Flatlist\n```\n\n| Structure | Description |\n|-------------------|--------------------------------------------------------------------------------------------------------------------------------------------|\n| **Bloom Filter** | A probabilistic data structure that tests set membership with space efficiency, allowing false positives but no false negatives. |\n| **Cuckoo Filter** | A probabilistic data structure similar to a Bloom filter but supporting deletions through cuckoo hashing. |\n| **Flatlist** | A simplified skip list structure that provides sorted storage with efficient search, insertion, and deletion using flattened index layers. \n\n## #\ufe0f\u20e3 Hashing Data Structures\n\n```python\n# Import statement\nfrom snaplit.hashing import SnapMap, RhoodMap\n```\n\n| Structures | Descriptions |\n|--------------|--------------------------------------------------------------------------------------------------------------------------------------------|\n| **SnapMap** | A hash map that resolves collisions using cuckoo hashing, relocating existing keys to alternate buckets to maintain constant-time lookups. |\n| **RhoodMap** | A hash map that minimizes variance in probe sequence lengths by \u201cstealing\u201d slots from entries with shorter probe distances. |\n\n---\n\n## \ud83d\udd2e Future Roadmap\nA short roadmap of additional advanced data structures to be added in the future.\n* **Perfect LinkedList** - A Doubly-Linked Circular List structure. \n* **XOR Filter** - Probabilistic data structure for membership checks.\n* **HyperLogLog (HLL)** - Probabilistic data structure for estimating unique values.\n* **Red-Black Tree** - Self-balanncing Binary Search Tree structure.\n* **B+ Tree** - Self-balancing Binary Search Tree structure.\n* **DAG** - Doubly-linked Acyclical Graph structure (similar to Digraph).\n* **Suffix Tree** - Character-based search tree structure.\n* **Adjacency Array** - Linked List strucutre utilising array-based backend. \n* **Quadratic HashMap** - Ordinary HashMap implementation with Quadratic Probing.\n* **Quadratic HashSet** - Ordinary Set structure with Quadratic Probing. \n\n## \ud83e\udd1d Contribution\nSnaplit is open to contributions from both Python and Rust communities!\n\nIf you'd like to report a bug, suggest an additional feature or contribute code:\n* Open an **issue** or **pull request** on Github\n* Contact developers directly via the listed e-mail\n\n## \ud83d\udcdd Licensing\nSnaplit project is distributed under the **MIT License** - free for both commercial & personal use.\n",
"bugtrack_url": null,
"license": null,
"summary": "Snaplit \u2014 a Rust-powered Python package",
"version": "0.1.0",
"project_urls": null,
"split_keywords": [
"rust",
" py03",
" python-extensions",
" data-structures",
" graphs",
" linear",
" probability",
" trees",
" hashing",
" algorithm",
" performance",
" library",
" ffi"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "8283a8a09bba1c06a1fdbea890dc58fb01c2cad9a3ca4bfea760b4fd85df4831",
"md5": "65e9bf286e935908332c8ed12af14efe",
"sha256": "b9d84d6c6991b3005e3b14e2cf4b1c9297ca8a01e760b5cbefa42c0fd1dfe9f7"
},
"downloads": -1,
"filename": "snaplit-0.1.0-cp311-cp311-macosx_10_12_x86_64.whl",
"has_sig": false,
"md5_digest": "65e9bf286e935908332c8ed12af14efe",
"packagetype": "bdist_wheel",
"python_version": "cp311",
"requires_python": ">=3.8",
"size": 487930,
"upload_time": "2025-11-05T16:35:22",
"upload_time_iso_8601": "2025-11-05T16:35:22.238992Z",
"url": "https://files.pythonhosted.org/packages/82/83/a8a09bba1c06a1fdbea890dc58fb01c2cad9a3ca4bfea760b4fd85df4831/snaplit-0.1.0-cp311-cp311-macosx_10_12_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "acbcd73a4f609780aa2dd362b9dd985dded2baa82176551ff95a7ee8bbf73bb4",
"md5": "47de4362996a998125d8cbe7ed4ed3fc",
"sha256": "ca142b44044b01d8af5d68e0386e669bef5bb112675d7a22dc97ada80ef2e402"
},
"downloads": -1,
"filename": "snaplit-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "47de4362996a998125d8cbe7ed4ed3fc",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 51180,
"upload_time": "2025-11-05T16:35:24",
"upload_time_iso_8601": "2025-11-05T16:35:24.380837Z",
"url": "https://files.pythonhosted.org/packages/ac/bc/d73a4f609780aa2dd362b9dd985dded2baa82176551ff95a7ee8bbf73bb4/snaplit-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-11-05 16:35:24",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "snaplit"
}