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
Connect with host/port (select database with db, default 0):
import keepvariable_core as kv
import pandas as pd
kv_redis = kv.KeepVariableRedisServer(host="127.0.0.1", port=6379, db=1)
Or connect with a Redis URL (database number is the path suffix, e.g. /1):
import keepvariable_core as kv
import pandas as pd
kv_redis = kv.KeepVariableRedisServer.from_url("redis://127.0.0.1:6379/1")
# equivalent:
kv_redis = kv.KeepVariableRedisServer(url="redis://127.0.0.1:6379/1")
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)
kv_redis.set("test_array", array)
result = kv_redis.get("test_array")
print(result)
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
Metadata
Release files for keepvariable 1.2.17
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| keepvariable-1.2.17.tar.gz | 13.9 kB | Without provenance | Details for keepvariable-1.2.17.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| keepvariable-1.2.17-py3-none-any.whl | Python 3 | none | any | Details for keepvariable-1.2.17-py3-none-any.whl |
Total release size: 27.5 kB
Release files / keepvariable-1.2.17.tar.gz
| Download URL | keepvariable-1.2.17.tar.gz |
|---|---|
| Size | 13.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
81edc057d41794ad05651b46dac15eda01a7f818092cf5027e3f15542e3bec2d
|
|
BLAKE2b-256 checksum How to use checksums |
34cae1b927ea85c9a288c5ee2919db82d431b2e74fc81cc9805fdc1b18beb757
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.7
|
Release files / keepvariable-1.2.17-py3-none-any.whl
| Download URL | keepvariable-1.2.17-py3-none-any.whl |
|---|---|
| Size | 13.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2d51225ef46fb238009b3837c14900ff3ec97286f93fd6c504812523f8431f31
|
|
BLAKE2b-256 checksum How to use checksums |
bb70f5e2d2f9f413e72a51d2c0fdf9d2672d26467e1eb4fd3e7757721136eeaa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.7
|
Security for keepvariable 1.2.17
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.