Pyache
Python numpy caching library
This library caches numpy data that is generated from files and saves them in chunks to the disk. This is useful any time a computationally expensive task is done to files to transform them into a form needed in memory.
Usage
Create a Pycache object and call load with your filenames.
import numpy as np
from time import sleep
from pyache import Pyache
def load_file(filename) -> np.ndarray:
print('Processing {}...'.format(filename))
sleep(0.5)
return np.ones([100])
pyache = Pyache('.cache', load_file, 'ones-processor')
data = pyache.load(
['thing-1.png', 'thing-2.png', 'thing-3.png'],
on_gen=lambda x: print('Just reprocessed', x),
on_loop=lambda: print('Loaded one more...')
) # Takes 1.5 seconds
# ... Run a second time (or program re-run):
data = pyache.load(
['thing-1.png', 'thing-2.png', 'thing-3.png']
) # Takes 0.0 seconds
data = pyache.load(
['thing-1.png', 'thing-2.png', 'thing-3.png', 'thing-4.png']
) # Takes 0.5 seconds
Installation
pip install pyache
Release files for pyache 0.2.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 | |
|---|---|---|---|
| pyache-0.2.0.tar.gz | 3.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyache-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.9 kB
Release files / pyache-0.2.0.tar.gz
| Download URL | pyache-0.2.0.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8bff0e7fecd0332d09cdd4a795a02139143011302fd22608b07ff101a1b11ae2
|
|
BLAKE2b-256 checksum How to use checksums |
8fc0ef5fcdaed2d56f053cbe250f83000149cffec67fe8eebba7df94ab1b9954
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.6.9
|
Release files / pyache-0.2.0-py3-none-any.whl
| Download URL | pyache-0.2.0-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ea8df1959166b99ff9da0c8220f17202a23766d5c2f743da2fb1366489152e39
|
|
BLAKE2b-256 checksum How to use checksums |
4ce13f9ff31fce888bd46e6caa15e4c5b8277a44b8e69df98f11e5f650ea174a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.6.9
|