TemporalioX
A helper library for Temporal.io that enables separation of activity declarations from their implementations.
Installation
pip install temporaliox
Usage
1. Declare Activities
In your activities.py file, declare activities with their Temporal configuration:
from temporaliox.activity import decl
from datetime import timedelta
@decl(task_queue="playwright", start_to_close_timeout=timedelta(seconds=60))
def generate_report(user_name: str, action: str) -> str:
pass
2. Define Activity Implementations
In your activities_def.py file, provide the actual implementations:
from .activities import generate_report
@generate_report.defn
def generate_report_def(user_name: str, action: str) -> str:
return f"{action}, {user_name}!"
3. Use Activities in Workflows
In your workflows.py file, call activities as normal async functions:
from temporalio import workflow
from .activities import generate_report
@workflow.defn()
class GenerateReport:
@workflow.run
async def run(self):
# This will call temporalio.workflow.execute_activity under the hood
report = await generate_report("Alice", "Hello")
# report will be "Hello, Alice!"
return report
Starting Activities
You can also start activities asynchronously using the .start() method:
# Start activity and get handle
handle = generate_report.start("Bob", "Goodbye")
# Wait for result later
result = await handle
4. Set Up Workers
Use activities_for_queue() to automatically collect all implemented activities for a specific task queue:
from temporalio.worker import Worker
from temporaliox.activity import activities_for_queue
async def main():
worker = Worker(
client,
task_queue="playwright",
workflows=[GenerateReport],
activities=activities_for_queue("playwright"), # Automatically gets all activities for this queue
)
await worker.run()
The activities_for_queue() function will:
- Return all implemented activities for the specified queue
- Raise a
ValueErrorif any declared activities are missing implementations - Return an empty list if no activities exist for the queue
Features
- Separation of Concerns: Declare activity signatures and Temporal configuration separately from implementations
- Type Safety: Full type hints support for better IDE experience
- Automatic Registration: Activities are automatically registered with Temporal using the
@ActivityDeclaration.defndecorator - Flexible Execution: Support for both
await(execute_activity) and.start()(start_activity) patterns - Queue-based Organization: Activities are organized by task queue for easy worker setup
How It Works
@decl()creates anActivityDeclarationthat holds the activity configuration and registers it as undefined@ActivityDeclaration.defndecorates the implementation, registers it with Temporal, and moves it to the implemented registry- When called in a workflow, the activity uses
workflow.execute_activityorworkflow.start_activitywith the configured options activities_for_queue()collects all implemented activities for a queue, ensuring no undefined activities remain
Development
Running Tests
# Install development dependencies
pip install -e ".[dev]"
# Start Temporal server (required for integration tests)
temporal server start-dev
# Run tests
pytest
Release files for temporaliox 0.4.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 | |
|---|---|---|---|
| temporaliox-0.4.0.tar.gz | 6.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| temporaliox-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.4 kB
Release files / temporaliox-0.4.0.tar.gz
| Download URL | temporaliox-0.4.0.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7e2aa5161914af0be2a7d66611b6a19d3e1ac45d1d9809de6958f7d4a7386551
|
|
BLAKE2b-256 checksum How to use checksums |
82755ab6ee6087fa94490675d29b723cc55700eb4fb9a9c6524dd8c41f4f6429
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 19, 2026.
Transparency logRelease files / temporaliox-0.4.0-py3-none-any.whl
| Download URL | temporaliox-0.4.0-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
19193501f1bcb8ff1c240e70ece0500b9b6310afd931c62da34febec799d8274
|
|
BLAKE2b-256 checksum How to use checksums |
6371056defd9d8bea4af78f2d1bec6460c4b7327a3c44ccdb278e0cb58745abc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 19, 2026.
Transparency log