Virtuals
Virtual Python collections over any storage.
Dict, list, set, indexed dict, tree — they look and feel like native Python, but they don't physically exist as in-memory collections. They're virtual: lazy views that compose data structure logic over flat tuple-key storage. Any backend that implements the storage protocol gets every data structure for free.
Like SQLAlchemy for Python collections. No SQL, no specific backend. Define your structure, plug in a store.
PyPI: virtuals-py | Import: virtuals
What It Does
from virtuals import View, Container
from virtuals.storages.mem import InMemoryStorage
from virtuals.codecs import NoOpCodec
storage = InMemoryStorage(codec=NoOpCodec())
storage.open()
with storage.transaction() as tx:
users = DictView.open_root(tx)
users["alice"] = {"name": "Alice", "age": 30}
users["bob"] = {"name": "Bob", "age": 25}
# Navigate naturally
for user_id, profile in users.items():
print(f"{user_id}: {profile['name']}")
# Under the hood: flat KV pairs with tuple keys
# ("users", "alice", "name") -> "Alice"
# ("users", "alice", "age") -> 30
Three Layers
Layer 1: Storage
Generic tuple-key KV store with lexicographic ordering.
storage.put(("users", "alice", "name"), "Alice")
value = storage.get(("users", "alice", "name"))
Layer 2: Container
Hierarchy and parent-child relationships over flat keys.
container = Container(storage, ("users", "alice"))
container.create()
children = container.children() # ["name", "age"]
Layer 3: View
Data structure abstractions (dict, list, set) over containers.
users = DictView.open_root(tx)
users["alice"] = "data"
Installation
pip install virtuals-py
pip install virtuals-py[rocksdb] # with RocksDB backend
Features
- Virtual collections: Work with dicts, lists, sets over any KV backend
- Tuple keys: Natural hierarchical addressing with lexicographic ordering
- Backend agnostic: Works with any ordered KV store (RocksDB, LMDB, in-memory)
- Observable: Watch for changes at any level of the hierarchy
- Transactional: Full ACID support when the backend provides it
- Lazy: Nothing materializes until accessed
License
Apache-2.0
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file virtuals_py-0.1.3.tar.gz.
File metadata
- Download URL: virtuals_py-0.1.3.tar.gz
- Upload date:
- Size: 167.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2d6f60782f0a4a3a4b5d76da6f78540c673ef4b633759eb88ca2db28fbc8fbc
|
|
| MD5 |
5477dd3454aa8a069cd5d583aff04c70
|
|
| BLAKE2b-256 |
19b2bfce5063a5ea5efe6736dd28dde900f6d628e3bc690521f748c5bdcb436f
|
Provenance
The following attestation bundles were made for virtuals_py-0.1.3.tar.gz:
Publisher:
publish-py.yml on nustackdev/virtuals
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
virtuals_py-0.1.3.tar.gz -
Subject digest:
b2d6f60782f0a4a3a4b5d76da6f78540c673ef4b633759eb88ca2db28fbc8fbc - Sigstore transparency entry: 2360390231
- Sigstore integration time:
-
Permalink:
nustackdev/virtuals@60d6c881ab2df079fe7890c7f352ae1a75a16c44 -
Branch / Tag:
refs/tags/py-v0.1.3 - Owner: https://github.com/nustackdev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-py.yml@60d6c881ab2df079fe7890c7f352ae1a75a16c44 -
Trigger Event:
push
-
Statement type:
File details
Details for the file virtuals_py-0.1.3-py3-none-any.whl.
File metadata
- Download URL: virtuals_py-0.1.3-py3-none-any.whl
- Upload date:
- Size: 239.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3f3a3343e72d7dd3c3160fb4e564cbf619105d7184f7ef51640da54032a61e8
|
|
| MD5 |
c1469c42d5a6b73de4552ee74e89fde2
|
|
| BLAKE2b-256 |
bbd5ead0e5bfaa9423f39d1555b66349cdfdb5c9ac983fd88e0753e95815e5ee
|
Provenance
The following attestation bundles were made for virtuals_py-0.1.3-py3-none-any.whl:
Publisher:
publish-py.yml on nustackdev/virtuals
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
virtuals_py-0.1.3-py3-none-any.whl -
Subject digest:
c3f3a3343e72d7dd3c3160fb4e564cbf619105d7184f7ef51640da54032a61e8 - Sigstore transparency entry: 2360390313
- Sigstore integration time:
-
Permalink:
nustackdev/virtuals@60d6c881ab2df079fe7890c7f352ae1a75a16c44 -
Branch / Tag:
refs/tags/py-v0.1.3 - Owner: https://github.com/nustackdev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-py.yml@60d6c881ab2df079fe7890c7f352ae1a75a16c44 -
Trigger Event:
push
-
Statement type: