Skip to main content

pyStorages

Simple data storages written in Python

Currently supported storage types:

  • JSON
  • Pickle
  • Redis

Installation

pip install pyStorages
# or
pip install git+https://github.com/Cub11k/pyStorages.git

For RedisStorage use extras:

pip install pyStorages[redis]
# or, for async version
pip install pyStorages[aioredis]

Getting started

pyStorages is the simplest way to interact with different types of storages, where data is stored and treated as a dictionary, in terms of python - dict.

Storage class interface is pretty convenient and is described below:

Set data

[async] def set_data(**kwargs)

This method allows you to update data according to key-value pairs. Existing key-values pairs not covered by passed keys won't be affected.

Parameters

kwargs - key-value pairs, according to which, the data will be updated

Returns - None

Delete data

[async] def delete_data(*keys)

This method allows you to delete values by keys.

Parameters

keys - list of keys, which will be deleted, if present

Raises KeyError - in case of receiving a non-existing key

Returns - None

Reset data

[async] def reset_data()

This method allows you to delete all data.

Returns - None

Get data

[async] def get_data(*keys)

This method allows you to get values by keys. For nested keys use list.

Note: if no keys are passed, all data will be returned.

>>> get_data('key1', 'key2', 'key3')
(data['key1'], data['key2'], data['key3'])

>>> get_data(['key1', 'key2'])
(data['key1']['key2'],)

>>> get_data([])
(data,)

>>> get_data()
(data,)

Parameters

keys - list of keys, which values will be returned, if present

Raises KeyError - in case of non-existing key

Returns - tuple

Examples

Coming soon...

Metadata

Release files for pyStorages 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyStorages 0.0.6
File Size Uploaded
pyStorages-0.0.6.tar.gz 17.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyStorages 0.0.6
File Interpreter ABI Platform
pyStorages-0.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 38.5 kB

Release files / pyStorages-0.0.6.tar.gz

Download URL pyStorages-0.0.6.tar.gz
Size 17.1 kB
Tags Source
SHA-256 checksum
How to use checksums
351f7344f5c072066e30c11ee25154f665e8003a88cb880d0eca013769d516fa
BLAKE2b-256 checksum
How to use checksums
711053e7a3da86040f0339d46bac2891973d69370c73efc193e99dbc097f26da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release files / pyStorages-0.0.6-py3-none-any.whl

Download URL pyStorages-0.0.6-py3-none-any.whl
Size 21.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
338783a46ae64836f7a90cba02707adab5f51f69eb44a390205ca8137e0aadf1
BLAKE2b-256 checksum
How to use checksums
a3a4c17a1c3c63566d830e1c93785b4db9978e5b01c94d867e7f0e2e5c518330
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release history Release notifications | RSS feed

This release

0.0.6 This release

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page