LightChat
LightChat is a lightweight, high-performance runtime and orchestration framework for managing multiple local processes, including AI/LLM models. It provides safe process execution, resource monitoring, structured logging, and real-time metrics collection. Designed for developers and researchers working with multiple local models or scripts, LightChat makes managing and observing processes simple and reliable.
Features
- Lightweight and efficient process management.
- Safe multi-process orchestration with graceful and hard termination.
- CPU, memory, and execution-time monitoring for each process.
- Structured logging with correlation IDs for easy tracing.
- Metrics collection and reporting for debugging and optimization.
- Compatible with Python 3.10+.
- Designed for testing local AI/ML/LLM models or any custom scripts safely.
Installation
# Clone the repository
git clone https://github.com/yourusername/lightchat.git
cd lightchat
# Optional: create a virtual environment
python -m venv venv
source venv/bin/activate # Linux/macOS
venv\Scripts\activate # Windows
# Install requirements
pip install -r requirements.txt
Quick Start
python
Copy code
import time
from lightchat.api.runtime import Runtime
from lightchat.config.core import ConfigLoader
# Load configuration
config_loader = ConfigLoader()
config = config_loader.get()
# Initialize runtime
runtime = Runtime(config=config)
# Create a process
proc = runtime.create_process(
name="hello_world",
command=["python", "-c", "print('Hello, LightChat!')"]
)
# Start and wait
proc.start()
proc.wait()
# Get metrics
print(proc.metrics())
print(proc.status())
API Overview
Runtime
Create, start, and manage multiple processes.
Query all process statuses and metrics.
Stop or kill processes individually.
ProcessHandle
Represents a single process with monitoring.
Methods:
start(), stop(), kill()
wait(timeout=None) – Waits for completion.
status() – Returns current process state.
metrics() – Returns CPU, memory usage, and process state.
LightChatLogger
Structured logging with correlation IDs.
Thread and multi-process safe.
MetricsCollector
Collects CPU, memory, execution-time metrics for processes.
Useful for optimization and monitoring experiments.
Use Case
LightChat is ideal for:
Testing multiple LLM or AI models locally.
Running resource-heavy scripts with monitoring.
Debugging and profiling Python processes.
Building experimental ML pipelines safely.
Example: Running multiple small LLM models locally and observing resource consumption in real-time.
Acknowledgements
This project leverages the following Python libraries and tools:
psutil – For process and system resource monitoring.
uuid – For generating unique correlation IDs.
Python logging module – Structured logging for observability.
contextvars – Context-aware correlation IDs for multi-process logging.
Contributing
Contributions are welcome! Please fork the repository and submit a pull request.
Bug reports, performance improvements, and new features are encouraged.
Follow PEP-8 and Python 3.10+ compatibility.
Metadata
Release files for lightchat 1.0.0
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 |
|---|---|---|---|---|
| lightchat-1.0.0.tar.gz | 22.2 kB | Without provenance | Details for lightchat-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lightchat-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for lightchat-1.0.0-py3-none-any.whl |
Total release size: 55.3 kB
Release files / lightchat-1.0.0.tar.gz
| Download URL | lightchat-1.0.0.tar.gz |
|---|---|
| Size | 22.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1d38f16d71dcd74d0337efc2e69dd3e678ccd8b104693ca404aa7fb323007966
|
|
BLAKE2b-256 checksum How to use checksums |
f9a0c46bb70fa80fc20c87ee22a5db1cf4ca68cccbfb3906159e69db7918d24b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.4
|
Release files / lightchat-1.0.0-py3-none-any.whl
| Download URL | lightchat-1.0.0-py3-none-any.whl |
|---|---|
| Size | 33.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7459927d0a8adfe472ac1707fd7eb0a051de965bc55b093d37f8eaac9154f2e3
|
|
BLAKE2b-256 checksum How to use checksums |
683dfdfae9df61c8ea6475b03b13aa3db0c9ce4d99cdf1dc5e905422907aa8d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.4
|
Security for lightchat 1.0.0
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.