Skip to main content

Introduction

A Python module for managing Cloud Variables.

IMPORTANT NOTES

Since this module is built upon the package upstash-redis, you MUST visit the website right here to create tokens and the link that are nessecary for the following examples.

Examples:

Example 1 for the CloudVar class.

import cloud_variables as cv


cloudvar = cv.CloudVar("https://apparent-gopher-******.upstash.io", "******") # Use the actual values here.

# Basic assignment
cloudvar["string"] = "Hello, World!"

# Retrieving values
print(cloudvar["string"]) # 'Hello, World!'

# Advanced mutable objects
cloudvar["list"] = [1, 2, 3]
cloudvar["list"].append(4)

print(cloudvar["list"]) # [1, 2, 3, 4]

# Deleting and popping items
cloudvar["key1"] = "value1"
cloudvar["key2"] = "value2"

del cloudvar["key1"] # Deleting keys.
value = cloudvar.pop("key2") # Popping keys
print(value) # 'value2'

# Some more methods

# Retrieving Python key-value pairs as dictionaries
print(cloudvar.items()) # {'string': 'Hello, World!', 'list': [1, 2, 3, 4]}

# Clearing everything
cloudvar.clear()
print(cloudvar.items()) # {}

Example 2 for the class AsyncCloudVar.

import cloud_variables as cv
import asyncio


async def main(): # Use asynchronous functions for full functionality access.
    async_cloudvar = cv.AsyncCloudVar("https://apparent-gopher-******.upstash.io", "******") # Use your actual values again.
    async_cloudvar.start()

    # Basic assignment
    async_cloudvar["string"] = "Hello, World!"

    # Retrieving values
    print(async_cloudvar["string"]) # 'Hello, World!'

    # Advanced mutable objects
    async_cloudvar["list"] = [1, 2, 3]
    async_cloudvar["list"].append(4)

    print(async_cloudvar["list"]) # [1, 2, 3, 4]

    # Deleting and popping items
    async_cloudvar["key1"] = "value1"
    async_cloudvar["key2"] = "value2"

    del async_cloudvar["key1"] # Deleting keys.
    value = await async_cloudvar.pop("key2") # Popping keys
    print(value) # 'value2'

    # Some more methods

    # Retrieving Python key-value pairs as dictionaries
    print(await async_cloudvar.items()) # {'string': 'Hello, World!', 'list': [1, 2, 3, 4]}

    # Clearing everything
    await async_cloudvar.clear()
    print(await async_cloudvar.items()) # {}

asyncio.run(main())

Installation

You can easily install the module by typing the command:

pip install cloud-python-vars

Metadata

Release files for cloud-python-vars 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cloud-python-vars 0.1.1
File Size Uploaded
cloud_python_vars-0.1.1.tar.gz 16.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cloud-python-vars 0.1.1
File Interpreter ABI Platform
cloud_python_vars-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 34.0 kB

Release files / cloud_python_vars-0.1.1.tar.gz

Download URL cloud_python_vars-0.1.1.tar.gz
Size 16.8 kB
Tags Source
SHA-256 checksum
How to use checksums
66c72f858ef415a8ac22363bd40a1680961eaa3e0016125251051a515e257f0e
BLAKE2b-256 checksum
How to use checksums
d7aad2610f13b316ec4bfbe780371b067690bf774084ed416f1c44e69f6d9775
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release files / cloud_python_vars-0.1.1-py3-none-any.whl

Download URL cloud_python_vars-0.1.1-py3-none-any.whl
Size 17.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dd44ecb73e48b2c51bfc920ede13fd2077cacdcae7952ab46a9669358bf9efc7
BLAKE2b-256 checksum
How to use checksums
07829d7f4ea4d42062e39af2b15cc7eebb30a2a5e17869fb46caaf247dac0559
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release history Release notifications | RSS feed

This release

0.1.1 This release

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