Skip to content

Latest commit

 

History

History
40 lines (40 loc) · 1.17 KB

README.md

File metadata and controls

40 lines (40 loc) · 1.17 KB

Python_disk_scope

Python module for storing variables in disk. Allows reuse pre-calculated data and keep intermediate processing steps, with no ram footpring

Usage:
import var_storage as pydisco
import cython, numba, numpy as np

variable_name = 'vv'
folder_storage = "my_project"
pydisco.Var_storage(variable_name, locals(), folder_name=folder_storage)


- Store variable on disk
vv.a = 3

- Recover variable from disk
print(vv.a)

- Store function / class as source
@vv.store_var
def test(num:int):
return vv.a + num

- Run function or instance class
vv.test(2) # 5

- Run all functions whose name matches a Regex pattern
vv.run_all(r"test.*")

- Launch a function as a separate process, compiled with Cython (Useful for Jupyter)
@vv.launch
def long_function():
print("Long computation")

- Automatically solve disk variable dependencies (Careful, this relaunches the function every time it finds a missing variable!)
@vv.solve_vars
def lazy_func():
return test(a)

lazy_func() # 6