S3Dict - Access S3 buckets as dictionaries
Install
pip install s3dict
Usage
import boto3
import s3dict
s3dict.enable()
# create a boto3 bucket resource
bucket = boto3.resource("s3").Bucket('s3dict-test')
# S3 object with key 'hello' is created, with content 'world' (pickled)
bucket['hello'] = 'world'
bucket['hola'] = 'mundo'
for k, v in bucket.items():
print(f'{k} -> {v}')
del bucket['hello']
Why oh why?
Just for curiosity. bucket[k] = v is easier than bucket.put_object(Key=k, Body=pickle.dumps(v)) right? :)
Please let us know if you found a real use case.
Limitations
- Buckets are not ordered like Python dictionaries are ordered (by insertion order).
len(bucket)runs O(N) - it lists bucket objects and counts.popitem()returns an arbitrary item (since unordered).keys()andvalues()are iterators, not views.- Dictionary keys must be
str. They cannot be too long (underlying S3 key may not be >1024 chars). - Dictionary values must be serializable (Pickle by default, you can bring your own serialization / "codec").
Contributions
They are welcome. TODOs offers some ideas.
Metadata
Release files for s3dict 0.1.0
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 |
|---|---|---|---|---|
| s3dict-0.1.0.tar.gz | 3.3 kB | Without provenance | Details for s3dict-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| s3dict-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for s3dict-0.1.0-py3-none-any.whl |
Total release size: 6.9 kB
Release files / s3dict-0.1.0.tar.gz
| Download URL | s3dict-0.1.0.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e6c80744a77ed837884e14cefbb173f1e8994c5051b03af918c28642f8e1bb4d
|
|
BLAKE2b-256 checksum How to use checksums |
3678ee784674157b058df927f2cff9f26708af7dfe424c13c7f0d4e26b0d1224
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.4 Darwin/23.5.0
|
Release files / s3dict-0.1.0-py3-none-any.whl
| Download URL | s3dict-0.1.0-py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8c5eb8aa670cfe6450f6c6b65836b9549c7a382997687c3b387eb056d60a9cca
|
|
BLAKE2b-256 checksum How to use checksums |
511db8d24a77d8efeb36bb33d3191b2e847a551d10612cd53bb2d95c12e616cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.4 Darwin/23.5.0
|
Security for s3dict 0.1.0
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.