Magic Storage cooler than you think!
Magic storage is a Python library that provides tools to easily write, read and delete resources for testing. This applies, of course, to resources that are difficult to obtain but not very expensive to store locally and, in addition, do not change. A good example are responses from REST APIs or at least those of them that are not live data.
The library consists of a set of classes that implement storage using the file system and temporary storage in RAM. All tools can be accessed through the MagicStorage class.
Installing
Install and update using pip:
$ pip install -U magic_storage
Example
from typing import Any
from magic_storage import MagicStorage
def very_expensive_get() -> Any:
...
response = (
MagicStorage()
.filesystem(__file__)
.cache_if_missing("Nice thing", lambda: very_expensive_get())
)
Documentation
Online documentation is available on Github pages.
Release files for magic-storage 1.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 | |
|---|---|---|---|
| magic_storage-1.1.0.tar.gz | 13.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| magic_storage-1.1.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 30.0 kB
Release files / magic_storage-1.1.0.tar.gz
| Download URL | magic_storage-1.1.0.tar.gz |
|---|---|
| Size | 13.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3c0a9a09d8a9f4b84f89744e9104fe78bfc35e56ac106433234cf07e4c5be106
|
|
BLAKE2b-256 checksum How to use checksums |
6681b102b4e2dc73dfc7b06e4c69d0b41edb29f94e18b3b1a6c7182a994b548f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Release files / magic_storage-1.1.0-py2.py3-none-any.whl
| Download URL | magic_storage-1.1.0-py2.py3-none-any.whl |
|---|---|
| Size | 16.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
1ca1e6fd3804bbeafbb41e2e04c87b405f35976ea685c4a0a5f0c81d3e2fe107
|
|
BLAKE2b-256 checksum How to use checksums |
ac5aecb8919fb6fcfc9bc7bb4da24beb29945a466577b62fa20b329017b5552e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|