Skip to main content

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)

obrazek

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

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)

Source distribution for keepvariable 1.2.17
File Size Uploaded
keepvariable-1.2.17.tar.gz 13.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for keepvariable 1.2.17
File Interpreter ABI Platform
keepvariable-1.2.17-py3-none-any.whl Python 3 none any Details

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

Release history Release notifications | RSS feed

This release

1.2.17 This release

2 release files

1.2.14

2 release files

1.2.11

2 release files

1.2.10

2 release files

1.2.9

2 release files

1.2.8

2 release files

1.2.7

2 release files

1.2.6

2 release files

1.2.5

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.2.2

2 release files

0.2.0

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page