Skip to content

Argmaster/magic-storage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Magic Storage cooler than you think!


PyPI - Python Version isort Test Status Docs Status Docs Status PyPI - Downloads GitHub issues GitHub pull requests GitHub GitHub tag (latest SemVer)

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.

About

Python 3 library which provides shortcuts for accessing file stored resources. It was designed to be used in tests for locally cached resources.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages