ducks 🦆
Index your Python objects for fast lookup by their attributes.
Install
pip install ducks
Usage
The main container in ducks is called Dex.
from ducks import Dex
# make some objects
objects = [
{'x': 3, 'y': 'a'},
{'x': 6, 'y': 'b'},
{'x': 9, 'y': 'c'}
]
# Create a Dex containing the objects.
# Index on x and y.
dex = Dex(objects, ['x', 'y'])
# match objects
dex[{
'x': {'>': 5, '<': 10}, # where 5 < x < 10
'y': {'in': ['a', 'b']} # and y is 'a' or 'b'
}]
# result: [{'x': 6, 'y': 'b'}]
This is a Dex of dicts, but the objects can be any type.
Dex supports ==, !=, in, not in, <, <=, >, >=.
The indexes can be dict keys, object attributes, or custom functions.
Is Dex fast?
Yes. Here’s how Dex compares to other object-finders on an example task.
The closest thing to a Dex is an in-memory SQLite. While SQLite is a fantastic database, it requires more overhead. As such, Dex is generally faster.
Docs
There’s more to ducks than making a Dex of dicts. Continue in the docs.
Metadata
Release files for ducks 0.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ducks-0.5.1.tar.gz | 15.7 kB | Without provenance | Details for ducks-0.5.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ducks-0.5.1-py3-none-any.whl | Python 3 | none | any | Details for ducks-0.5.1-py3-none-any.whl |
Total release size: 36.4 kB
Release files / ducks-0.5.1.tar.gz
| Download URL | ducks-0.5.1.tar.gz |
|---|---|
| Size | 15.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5e86c8ba950a88deacb6fa890460b082138d6bde1c4ba44fb78173d7ef9e71ca
|
|
BLAKE2b-256 checksum How to use checksums |
8aa57a917a32a139967a420f95a430eccdc7cf6d997a2d4f6bbc83fdbc52b658
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.13 CPython/3.9.7 Linux/5.15.55-1-MANJARO
|
Release files / ducks-0.5.1-py3-none-any.whl
| Download URL | ducks-0.5.1-py3-none-any.whl |
|---|---|
| Size | 20.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a6b4ba4f720a4986ba4216e7b410a4ae840bc5114c1acad71650ac982921cc9d
|
|
BLAKE2b-256 checksum How to use checksums |
7b39777ea7c092a12bf8527f8ff9dc80cd0d679dffdd9fe8f3e3ee1646a6b499
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.13 CPython/3.9.7 Linux/5.15.55-1-MANJARO
|
Security for ducks 0.5.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.