TemporalLoop
TemporalLoop is an open-source project that helps you run and manage Temporal.io workers. It Inspired from how uvicorn works for ASGI applications. With a simple configuration, you can define multiple workers with their own activities, workflows, queue and settings. It aims to reduce boilerplate code, improve worker management, and increase interoperability between Temporal-based projects.
Features
- Easy configuration with YAML or JSON
- Unify and Simplified worker maintenance across all Temporal's python microservices
- Customizable logging
- Support for DataConverter and Interceptor classes
- Customizable Worker instance
- Launch multiple workers on a single process
- Signal handling (SIGINT, SIGTERM) with graceful shutdown
Prerequisites
- Python 3.10+
- Temporal.io server (self-hosted or cloud)
Installation
Install TemporalLoop using pip:
pip install temporalloop
Configuration
Here's a sample config.yaml for configuring TemporalLoop:
temporalio:
host: "127.0.0.1:7233"
namespace: "default"
logging:
level: "info"
use_colors: true
log_config: "path/to/your/log_config.ini"
workers:
- name: "worker1"
queue: "first-queue"
workflows:
- "your_package.workflows:YourWorkflow"
activities:
- "your_package.activities:your_activity_one"
- "your_package.activities:your_activity_two"
- name: "worker2"
queue: "another-queue"
workflows:
- "your_package.workflows:YourWorkflow"
activities:
- "your_package.activities:your_activity_one"
# Settings can be overrided per worker
namespace: "staging"
interceptors: [] # Skip interceptors for this worker
factory: "your_package.worker:WorkerFactory"
interceptors:
- "temporalloop.interceptors.sentry:SentryInterceptor"
This sample configuration file includes:
- Temporal settings, including the host and namespace
- Logging settings, such as the log level, color usage, and an optional log configuration file
- A list of workers, each with a unique name, task queue, and associated workflows and activities, namespace
- A list of interceptors to be used across all workers
Replace your_package with your actual package name and provide the appropriate paths for your workflows, activities, and interceptors.
Usage
Starting a Worker
You can start a worker either by writing a script or using the command-line interface.
Command-Line Example
tempoloop --config=config.yaml --host=localhost:7233 --log-level=debug
Script Example
# worker.py
from temporalloop.config import Config, WorkerConfig
from temporalloop.main import run
from your_package.workflows import YourWorkflow
from your_package.activities import your_activity_one, your_activity_two
if __name__ == "__main__":
run(Config(
host="localhost:7233",
workers=[
WorkerConfig(name="worker1",
queue="your-queue",
workflows=[YourWorkflow],
activities=[your_activity_one, your_activity_two],
),
WorkerConfig(name="worker2",
queue="another-queue",
workflows=[YourWorkflow],
activities=[your_activity_one, your_activity_two],
),
],
))
Run the script with
python worker.py
Metadata
Release files for temporalloop 0.2.2
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 | |
|---|---|---|---|---|
| temporalloop-0.2.2.tar.gz | 138.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| temporalloop-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 162.0 kB
Release files / temporalloop-0.2.2.tar.gz
| Download URL | temporalloop-0.2.2.tar.gz |
|---|---|
| Size | 138.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fd054a1e500008d98a37626fc0c3009c194d9d8f72cc57479425ef2c4f2b9dac
|
|
BLAKE2b-256 checksum How to use checksums |
799e472c9919bffe882cb2e9b318010db7a0c84712094b1247ed8201cb9881b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.28
|
Release files / temporalloop-0.2.2-py3-none-any.whl
| Download URL | temporalloop-0.2.2-py3-none-any.whl |
|---|---|
| Size | 23.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7f01d7f26b5e18e520bf3b2a98764f40a381796b4fc3e38098ffb7973a96b9b2
|
|
BLAKE2b-256 checksum How to use checksums |
fe80a5acccb81e8ae59d35b93c2cd3d6eb82f7c481370e1f24559290ac1cacde
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.28
|
Security for temporalloop 0.2.2
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.