Skip to main content

Edit variables and class instances live during runtime. CLI and web interfaces supported.

Project description

LiveConfig - v0.2.1-beta

LiveConfig is a Python package that allows developers to edit variables in real-time. All variables can be saved to a .json file and loaded automatically on startup. Function triggers can run a function from the interface and change behaviour during runtime. No more restarting your program every time you make a minor adjustment.

⚠️ This is a beta release (v0.2.1-beta). APIs and features may change in future updates.

Features

  • Class attribute editing - Edit attributes of class instances in real-time.
  • Private attributes - Prevent certain attributes being modified in real-time.
  • Variable editing - Edit the values of variables in real-time.
  • Function triggers - Trigger a function from the interface.
  • File-handling - Attributes and values are saved to a file and automatically loaded on startup.
  • Multiple interfaces* - Interact with LiveConfig through the command line or a web interface.
  • Easy to use - Adding an instance to LiveConfig only requires editing one line of code.

* Interface system is under development — currently supports CLI and basic web interface. More coming soon!

Installation

pip install liveconfig

Usage

Setup

from liveconfig import LiveConfig, start_interface

# Immediately after import, setup the path to the file where variables will be saved and loaded from
LiveConfig("./path/to/file.json")

# Start the interface of choice. "web" or "cli"
start_interface("web")
  • LiveConfig(path) - MUST be done before importing any live classes or instances, recommended to do right after importing LiveConfig.

Live instances

from liveconfig import liveclass, liveinstance

# Decorate your class to make it live-editable
@liveclass
class Config:
    def __init__(self):
        self.text = "Hello, World"
        self.width = 640
        self.height = 480
        self._private = "This will be hidden"


# Register an instance of the class for editing
config = liveinstance("config")(Config())
  • @liveclass - Marks a class so its instances can be tracked and edited.
  • liveinstance(<name>)(<Class()>) - Registers a specific instance for live editing, using the given name as its identifier.
  • Private attribute - Attributes beginning with _ cannot be modified through the interface and will not be shown.

Live variables

from liveconfig import livevar

var = livevar("example")("Example String")
  • livevar(<name>)(<value>) - Register a variable for live editing. The name must be unique to the program.

Function triggers

from liveconfig import trigger

@trigger
def example_function():
    print("This function can be triggered from the interface")
  • @trigger - A decorator for a function that can be triggered from the interface.

Future Features

  • Greater functionality for triggers.
  • Support for databases.
  • More interface options.
  • Allow users to create their own interface.
  • Ensure minimal overhead if LiveConfig is disabled.

About

LiveConfig is a lightweight Python package that lets you update variables at runtime—perfect for live-tuning values in long-running processes like computer vision pipelines, simulations, or game logic. No more restarting your program for every tweak. Create function triggers for use cases such as resetting, deleting, tweaking.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

liveconfig-0.2.1b0.tar.gz (20.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

liveconfig-0.2.1b0-py3-none-any.whl (25.0 kB view details)

Uploaded Python 3

File details

Details for the file liveconfig-0.2.1b0.tar.gz.

File metadata

  • Download URL: liveconfig-0.2.1b0.tar.gz
  • Upload date:
  • Size: 20.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for liveconfig-0.2.1b0.tar.gz
Algorithm Hash digest
SHA256 38dc609e003b074b906241f79d89122259502ea2673fa9f31fff936346ada9f3
MD5 ccf12d30d73cf0f0fc646af3f44ea2b3
BLAKE2b-256 a9deb01d7951b725a24ca14e40982bd90ebdfcc5dd2e70efe3f3572c09f3f9ba

See more details on using hashes here.

File details

Details for the file liveconfig-0.2.1b0-py3-none-any.whl.

File metadata

  • Download URL: liveconfig-0.2.1b0-py3-none-any.whl
  • Upload date:
  • Size: 25.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for liveconfig-0.2.1b0-py3-none-any.whl
Algorithm Hash digest
SHA256 7ac3eb91c5b9d63fb858bf07cccf908eb68532323502cca02d7ff137377e94ed
MD5 f99562d7f722aa1dbaa9e383b66364e1
BLAKE2b-256 e625e41454bb71815e6585ec0e812cf308147c48d1a1e5be5161c9f454e605b7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page