Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/argmaster/magic-storage
Python 3 library which provides shortcuts for accessing file stored resources. It was designed to be used in tests for locally cached resources.
https://github.com/argmaster/magic-storage
python
Last synced: 26 days ago
JSON representation
Python 3 library which provides shortcuts for accessing file stored resources. It was designed to be used in tests for locally cached resources.
- Host: GitHub
- URL: https://github.com/argmaster/magic-storage
- Owner: Argmaster
- License: mit
- Created: 2022-07-29T13:29:24.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-09-01T23:31:46.000Z (about 2 years ago)
- Last Synced: 2024-09-14T07:29:36.980Z (about 2 months ago)
- Topics: python
- Language: Python
- Homepage:
- Size: 584 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
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
```python
from typing import Any
from magic_storage import MagicStoragedef 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](https://argmaster.github.io/magic-storage/).