Weavelet
A library for managing function calls in specific order, to avoid code repeating. Similar to Apache Hamilton but simpler without 3rd party dependencies if not needed.
Features
- Simple DAG orchestration: Build execution graphs based on function signatures
- Decorator-based: Register functions as nodes using the
@node()decorator - Cross-module support: Nodes can be spread across multiple files
- Parameter injection: Automatic dependency resolution and parameter passing
- Result caching: Avoid recomputing expensive operations
- Pure Python: No external dependencies for core functionality
Quick Start
Installation
pip install weavelet
Basic Usage
Create nodes in any Python file:
# a_nodes.py
from weavelet import node
@node()
def auth_token(api_key: str) -> str:
return f"Bearer {api_key}"
@node()
def user_profile(auth_token: str, user_id: int) -> dict:
return {"id": user_id, "name": "Ala"}
@node()
def make_greeting(user_profile: dict) -> str:
return f"Hello, {user_profile['name']}!"
Execute the DAG:
# main.py
from weavelet import Weave
import a_nodes
weave = Weave()
weave.include(a_nodes)
weave.params.add("api_key", "xyz")
weave.params.add("user_id", 128)
result = weave.run("make_greeting") # -> "Hello, Ala!"
print(result)
How it Works
Weavelet automatically builds a DAG based on function signatures:
- Function parameters that match other node names become dependencies
- Parameters not matching node names are injected from
weave.params - Execution order is determined through topological sorting
- Results are cached to avoid redundant computation
Requirements
- Python >=3.12
- No external dependencies for core functionality
Development
Uses uv as package manager with TDD approach.
Metadata
Release files for weavelet 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| weavelet-0.0.1.tar.gz | 22.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| weavelet-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.4 kB
Release files / weavelet-0.0.1.tar.gz
| Download URL | weavelet-0.0.1.tar.gz |
|---|---|
| Size | 22.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
76f7c8a939332a8bc50c637047e82f7a14b1ec3fd949ab437ca2332cbed029f3
|
|
BLAKE2b-256 checksum How to use checksums |
63d0fc46139e034822f856a8fe45f9226f69dee2eed185185693cdd227a1ada1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.19
|
Release files / weavelet-0.0.1-py3-none-any.whl
| Download URL | weavelet-0.0.1-py3-none-any.whl |
|---|---|
| Size | 4.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ed0d59e5d50d33d102d415d0b5d4da950eac23f71aec5c428d088acd54723df6
|
|
BLAKE2b-256 checksum How to use checksums |
ca89ad023b06c74d00342edafda4bb4f2e69b9c34193762f508925e70a0ebca5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.19
|