A Python package keeping the values of variables between separate runs in a seamless and effortless way.
Project description
keepvariable
A Python package keeping the values of variables between separate runs in a seamless and effortless way.
Installation
Use the package manager pip to install keepvariable.
pip install keepvariable
Usage with Redis
import keepvariable_core as kv
import pandas as pd
kv_redis=kv.KeepVariableRedisServer(host="127.0.0.1",port=6379)
kv_redis.set("test","abc123")
result=kv_redis.get("test")
print(result)
#abc123
#even pandas dataframes, and numpy arrays can be stored
df=pd.DataFrame([[1,2,3,4],[4,5,6,7]],columns=["a","b","c","d"])
array=df.values
kv_redis.set("test_df",df)
result=kv_redis.get("test_df")
print(result)
# a b c d
#0 1 2 3 4
#1 4 5 6 7
kv_redis.set("test_array",array)
result=kv_redis.get("test_array")
print(result)
# #[[1 2 3 4]
# # [4 5 6 7]]
Usage (locally)
from keepvariable_core import Var,kept_variables,save_variables,load_variable
a=Var("b")
b=Var("c")
c=a+b
print(c)
dict1=Var({1,2,3,4,5})
list1=Var(a)
print(kept_variables)
save_variables(kept_variables)
list1=load_variable()
b=load_variable()
c=Var(c)
print(list1)
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
keepvariable-1.2.14.tar.gz
(13.0 kB
view details)
Built Distribution
File details
Details for the file keepvariable-1.2.14.tar.gz
.
File metadata
- Download URL: keepvariable-1.2.14.tar.gz
- Upload date:
- Size: 13.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38f6ab99271c7687e793aa939b7b2e3eedc61bdd6667f46831d2c845079a64f3 |
|
MD5 | fc4e2f1a4ed5c5de9378d04e5ba1ee1b |
|
BLAKE2b-256 | 16b280fc4d03f41fe41a02f428e3f618d3ba19e36735989a08bc1f034e42c9db |
File details
Details for the file keepvariable-1.2.14-py3-none-any.whl
.
File metadata
- Download URL: keepvariable-1.2.14-py3-none-any.whl
- Upload date:
- Size: 12.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4150f40ed75d658af0d4affe8a519350936cd4944a0e211a451d26ee640c9e7 |
|
MD5 | 50e871ba0bc87cfe925d9269e39fc422 |
|
BLAKE2b-256 | 5c3a895563f5c5d90a332782f39bdcc68e2d164d59e2310a438845259b33a8ce |