weaveflow 1.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- weaveflow-1.1.0/.dockerignore +19 -0
- weaveflow-1.1.0/.github/CODEOWNERS +7 -0
- weaveflow-1.1.0/.github/pull_request_template.md +14 -0
- weaveflow-1.1.0/.github/workflows/ci.yml +66 -0
- weaveflow-1.1.0/.github/workflows/release.yml +50 -0
- weaveflow-1.1.0/.gitignore +15 -0
- weaveflow-1.1.0/CHANGELOG.md +75 -0
- weaveflow-1.1.0/CONTRIBUTING.md +68 -0
- weaveflow-1.1.0/Dockerfile +18 -0
- weaveflow-1.1.0/LICENSE +184 -0
- weaveflow-1.1.0/Makefile +83 -0
- weaveflow-1.1.0/PKG-INFO +202 -0
- weaveflow-1.1.0/README.md +156 -0
- weaveflow-1.1.0/RELEASE_READINESS.md +161 -0
- weaveflow-1.1.0/SECURITY.md +33 -0
- weaveflow-1.1.0/WEAVE_Framework_PRD_v1.0.md +306 -0
- weaveflow-1.1.0/docs/CATALOG.md +80 -0
- weaveflow-1.1.0/docs/architecture.html +381 -0
- weaveflow-1.1.0/docs/architecture.md +134 -0
- weaveflow-1.1.0/docs/assets/style.css +93 -0
- weaveflow-1.1.0/docs/build_site.py +359 -0
- weaveflow-1.1.0/docs/errors.md +77 -0
- weaveflow-1.1.0/docs/getting-started.md +97 -0
- weaveflow-1.1.0/docs/guide-agents.md +116 -0
- weaveflow-1.1.0/docs/guide-connections.md +161 -0
- weaveflow-1.1.0/docs/guide-guardrails.md +70 -0
- weaveflow-1.1.0/docs/guide-interop.md +78 -0
- weaveflow-1.1.0/docs/guide-llm.md +100 -0
- weaveflow-1.1.0/docs/guide-memory.md +100 -0
- weaveflow-1.1.0/docs/index.html +61 -0
- weaveflow-1.1.0/docs/index.md +54 -0
- weaveflow-1.1.0/docs/pages/CATALOG.html +69 -0
- weaveflow-1.1.0/docs/pages/errors.html +73 -0
- weaveflow-1.1.0/docs/pages/getting-started.html +101 -0
- weaveflow-1.1.0/docs/pages/guide-agents.html +109 -0
- weaveflow-1.1.0/docs/pages/guide-connections.html +133 -0
- weaveflow-1.1.0/docs/pages/guide-guardrails.html +87 -0
- weaveflow-1.1.0/docs/pages/guide-interop.html +79 -0
- weaveflow-1.1.0/docs/pages/guide-llm.html +90 -0
- weaveflow-1.1.0/docs/pages/guide-memory.html +93 -0
- weaveflow-1.1.0/docs/pages/reference-api.html +112 -0
- weaveflow-1.1.0/docs/pages/reference-cli.html +70 -0
- weaveflow-1.1.0/docs/reference-api.md +141 -0
- weaveflow-1.1.0/docs/reference-cli.md +61 -0
- weaveflow-1.1.0/example-agents/README.md +67 -0
- weaveflow-1.1.0/example-agents/connect.py +56 -0
- weaveflow-1.1.0/example-agents/extractor/README.md +33 -0
- weaveflow-1.1.0/example-agents/extractor/agent.py +43 -0
- weaveflow-1.1.0/example-agents/extractor/run.py +30 -0
- weaveflow-1.1.0/example-agents/reporter/README.md +32 -0
- weaveflow-1.1.0/example-agents/reporter/agent.py +39 -0
- weaveflow-1.1.0/example-agents/reporter/run.py +28 -0
- weaveflow-1.1.0/examples/quickstart.py +56 -0
- weaveflow-1.1.0/examples/two_agents_deepseek.py +105 -0
- weaveflow-1.1.0/mkdocs.yml +54 -0
- weaveflow-1.1.0/pyproject.toml +89 -0
- weaveflow-1.1.0/test-framwork/README.md +43 -0
- weaveflow-1.1.0/test-framwork/agents/__init__.py +5 -0
- weaveflow-1.1.0/test-framwork/agents/analysis.py +60 -0
- weaveflow-1.1.0/test-framwork/agents/llm.py +14 -0
- weaveflow-1.1.0/test-framwork/agents/text.py +38 -0
- weaveflow-1.1.0/test-framwork/fakes.py +35 -0
- weaveflow-1.1.0/test-framwork/run.py +309 -0
- weaveflow-1.1.0/tests/agent/test_base.py +34 -0
- weaveflow-1.1.0/tests/agent/test_context.py +25 -0
- weaveflow-1.1.0/tests/agent/test_decorators.py +91 -0
- weaveflow-1.1.0/tests/cli/test_commands.py +71 -0
- weaveflow-1.1.0/tests/cli/test_main.py +63 -0
- weaveflow-1.1.0/tests/conftest.py +40 -0
- weaveflow-1.1.0/tests/connection/test_matcher.py +34 -0
- weaveflow-1.1.0/tests/connection/test_protocol.py +69 -0
- weaveflow-1.1.0/tests/connection/test_transform.py +88 -0
- weaveflow-1.1.0/tests/e2e/conftest.py +73 -0
- weaveflow-1.1.0/tests/e2e/test_cli_e2e.py +106 -0
- weaveflow-1.1.0/tests/e2e/test_examples_e2e.py +30 -0
- weaveflow-1.1.0/tests/e2e/test_packaging_e2e.py +71 -0
- weaveflow-1.1.0/tests/e2e/test_pipeline_e2e.py +120 -0
- weaveflow-1.1.0/tests/guardrails/test_hooks.py +33 -0
- weaveflow-1.1.0/tests/interop/test_crewai.py +64 -0
- weaveflow-1.1.0/tests/interop/test_foreign.py +57 -0
- weaveflow-1.1.0/tests/interop/test_langchain.py +103 -0
- weaveflow-1.1.0/tests/llm/test_adapters.py +346 -0
- weaveflow-1.1.0/tests/llm/test_backoff.py +19 -0
- weaveflow-1.1.0/tests/llm/test_base.py +48 -0
- weaveflow-1.1.0/tests/llm/test_deps.py +34 -0
- weaveflow-1.1.0/tests/llm/test_factory.py +52 -0
- weaveflow-1.1.0/tests/llm/test_retry.py +69 -0
- weaveflow-1.1.0/tests/memory/test_memory.py +61 -0
- weaveflow-1.1.0/tests/runtime/test_parallel.py +227 -0
- weaveflow-1.1.0/tests/runtime/test_pipeline.py +81 -0
- weaveflow-1.1.0/tests/runtime/test_runner.py +33 -0
- weaveflow-1.1.0/tests/schema/test_registry.py +23 -0
- weaveflow-1.1.0/tests/schema/test_validator.py +50 -0
- weaveflow-1.1.0/tests/test_logger.py +90 -0
- weaveflow-1.1.0/tests/types/test_payload.py +34 -0
- weaveflow-1.1.0/tests/types/test_primitives.py +32 -0
- weaveflow-1.1.0/weave/__init__.py +63 -0
- weaveflow-1.1.0/weave/agent/__init__.py +7 -0
- weaveflow-1.1.0/weave/agent/base.py +90 -0
- weaveflow-1.1.0/weave/agent/context.py +43 -0
- weaveflow-1.1.0/weave/agent/decorators.py +69 -0
- weaveflow-1.1.0/weave/cli/__init__.py +5 -0
- weaveflow-1.1.0/weave/cli/commands.py +72 -0
- weaveflow-1.1.0/weave/cli/main.py +55 -0
- weaveflow-1.1.0/weave/cli/templates.py +21 -0
- weaveflow-1.1.0/weave/connection/__init__.py +13 -0
- weaveflow-1.1.0/weave/connection/matcher.py +51 -0
- weaveflow-1.1.0/weave/connection/protocol.py +61 -0
- weaveflow-1.1.0/weave/connection/transform.py +108 -0
- weaveflow-1.1.0/weave/errors.py +75 -0
- weaveflow-1.1.0/weave/guardrails/__init__.py +10 -0
- weaveflow-1.1.0/weave/guardrails/hooks.py +62 -0
- weaveflow-1.1.0/weave/interop/__init__.py +12 -0
- weaveflow-1.1.0/weave/interop/crewai.py +48 -0
- weaveflow-1.1.0/weave/interop/foreign.py +144 -0
- weaveflow-1.1.0/weave/interop/langchain.py +57 -0
- weaveflow-1.1.0/weave/llm/__init__.py +15 -0
- weaveflow-1.1.0/weave/llm/_deps.py +38 -0
- weaveflow-1.1.0/weave/llm/_retry.py +55 -0
- weaveflow-1.1.0/weave/llm/adapters/__init__.py +17 -0
- weaveflow-1.1.0/weave/llm/adapters/anthropic_adapter.py +60 -0
- weaveflow-1.1.0/weave/llm/adapters/deepseek_adapter.py +25 -0
- weaveflow-1.1.0/weave/llm/adapters/google_adapter.py +46 -0
- weaveflow-1.1.0/weave/llm/adapters/mistral_adapter.py +25 -0
- weaveflow-1.1.0/weave/llm/adapters/ollama_adapter.py +30 -0
- weaveflow-1.1.0/weave/llm/adapters/openai_adapter.py +61 -0
- weaveflow-1.1.0/weave/llm/base.py +66 -0
- weaveflow-1.1.0/weave/llm/factory.py +61 -0
- weaveflow-1.1.0/weave/logger.py +104 -0
- weaveflow-1.1.0/weave/memory/__init__.py +13 -0
- weaveflow-1.1.0/weave/memory/base.py +35 -0
- weaveflow-1.1.0/weave/memory/long_term.py +67 -0
- weaveflow-1.1.0/weave/memory/short_term.py +39 -0
- weaveflow-1.1.0/weave/py.typed +0 -0
- weaveflow-1.1.0/weave/runtime/__init__.py +7 -0
- weaveflow-1.1.0/weave/runtime/parallel.py +119 -0
- weaveflow-1.1.0/weave/runtime/pipeline.py +67 -0
- weaveflow-1.1.0/weave/runtime/runner.py +69 -0
- weaveflow-1.1.0/weave/schema/__init__.py +7 -0
- weaveflow-1.1.0/weave/schema/port.py +49 -0
- weaveflow-1.1.0/weave/schema/registry.py +29 -0
- weaveflow-1.1.0/weave/schema/validator.py +82 -0
- weaveflow-1.1.0/weave/types/__init__.py +17 -0
- weaveflow-1.1.0/weave/types/payload.py +44 -0
- weaveflow-1.1.0/weave/types/primitives.py +51 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
## What changed
|
|
2
|
+
<!-- Concrete, specific list of changes. -->
|
|
3
|
+
|
|
4
|
+
## Why
|
|
5
|
+
<!-- Reason / context. Link the issue if there is one. -->
|
|
6
|
+
|
|
7
|
+
## Trade-offs
|
|
8
|
+
<!-- Any decision with trade-offs, and why you chose this approach. "None" is valid. -->
|
|
9
|
+
|
|
10
|
+
## Checklist
|
|
11
|
+
- [ ] `make check` is green (lint + mypy strict + tests ≥80%)
|
|
12
|
+
- [ ] Tests added/updated, mirroring the source tree
|
|
13
|
+
- [ ] Public API changes are documented; breaking changes noted in `CHANGELOG.md`
|
|
14
|
+
- [ ] No secrets, no `Any` leaks, no magic numbers, no if/elif dispatch chains
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
concurrency:
|
|
10
|
+
group: ci-${{ github.ref }}
|
|
11
|
+
cancel-in-progress: true
|
|
12
|
+
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
check:
|
|
18
|
+
name: lint · typecheck · test (py${{ matrix.python-version }})
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
strategy:
|
|
21
|
+
fail-fast: false
|
|
22
|
+
matrix:
|
|
23
|
+
python-version: ["3.10", "3.11", "3.12"]
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v4
|
|
26
|
+
|
|
27
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
28
|
+
uses: actions/setup-python@v5
|
|
29
|
+
with:
|
|
30
|
+
python-version: ${{ matrix.python-version }}
|
|
31
|
+
cache: pip
|
|
32
|
+
|
|
33
|
+
- name: Install (dev + all providers)
|
|
34
|
+
run: |
|
|
35
|
+
python -m pip install --upgrade pip
|
|
36
|
+
pip install -e ".[dev,all]"
|
|
37
|
+
|
|
38
|
+
- name: Lint (ruff)
|
|
39
|
+
run: ruff check weave tests
|
|
40
|
+
|
|
41
|
+
- name: Format check (ruff)
|
|
42
|
+
run: ruff format --check weave tests
|
|
43
|
+
|
|
44
|
+
- name: Typecheck (mypy strict)
|
|
45
|
+
run: mypy weave
|
|
46
|
+
|
|
47
|
+
- name: Test (pytest, coverage gate ≥80%)
|
|
48
|
+
run: pytest --cov=weave --cov-report=xml --cov-report=term-missing
|
|
49
|
+
|
|
50
|
+
- name: Upload coverage artifact
|
|
51
|
+
if: matrix.python-version == '3.12'
|
|
52
|
+
uses: actions/upload-artifact@v4
|
|
53
|
+
with:
|
|
54
|
+
name: coverage-xml
|
|
55
|
+
path: coverage.xml
|
|
56
|
+
|
|
57
|
+
docker:
|
|
58
|
+
name: docker build
|
|
59
|
+
runs-on: ubuntu-latest
|
|
60
|
+
needs: check
|
|
61
|
+
steps:
|
|
62
|
+
- uses: actions/checkout@v4
|
|
63
|
+
- name: Build production image
|
|
64
|
+
run: docker build -t weave:ci .
|
|
65
|
+
- name: Smoke-test CLI in image
|
|
66
|
+
run: docker run --rm weave:ci --version
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
# Publishes to PyPI when a semver tag (vX.Y.Z) is pushed.
|
|
4
|
+
# Uses PyPI Trusted Publishing (OIDC) — no long-lived API token required.
|
|
5
|
+
on:
|
|
6
|
+
push:
|
|
7
|
+
tags: ["v*.*.*"]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
build:
|
|
14
|
+
name: build distribution
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
- uses: actions/setup-python@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: "3.12"
|
|
21
|
+
cache: pip
|
|
22
|
+
- name: Build sdist + wheel
|
|
23
|
+
run: |
|
|
24
|
+
python -m pip install --upgrade pip build
|
|
25
|
+
python -m build
|
|
26
|
+
- name: Check metadata
|
|
27
|
+
run: |
|
|
28
|
+
pip install twine
|
|
29
|
+
twine check dist/*
|
|
30
|
+
- uses: actions/upload-artifact@v4
|
|
31
|
+
with:
|
|
32
|
+
name: dist
|
|
33
|
+
path: dist/
|
|
34
|
+
|
|
35
|
+
publish:
|
|
36
|
+
name: publish to PyPI
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
needs: build
|
|
39
|
+
environment:
|
|
40
|
+
name: pypi
|
|
41
|
+
url: https://pypi.org/project/weaveflow/
|
|
42
|
+
permissions:
|
|
43
|
+
id-token: write # required for OIDC trusted publishing
|
|
44
|
+
steps:
|
|
45
|
+
- uses: actions/download-artifact@v4
|
|
46
|
+
with:
|
|
47
|
+
name: dist
|
|
48
|
+
path: dist/
|
|
49
|
+
- name: Publish
|
|
50
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to Weave are documented here. The format is based on
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and this project adheres to
|
|
5
|
+
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [1.1.0] - 2026-06-23
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- **Interop bridges (`weave.interop`)**: connect a foreign-framework agent without
|
|
13
|
+
rewriting it. `from_langchain` (LangChain/LangGraph `Runnable`), `from_crewai`
|
|
14
|
+
(`kickoff`), and `from_callable` (any function) wrap a foreign agent into a Weave
|
|
15
|
+
`BaseAgent`, so it composes in pipelines/parallels and the connection protocol
|
|
16
|
+
auto-calibrates the handoff. Everything is duck-typed, with no framework imports and
|
|
17
|
+
zero new dependencies. Shape the boundary with `prepare`/`extract` callables.
|
|
18
|
+
- **`Parallel` runtime primitive**: the fan-out / fan-in sibling of `Pipeline`. Runs
|
|
19
|
+
branches concurrently, transforms the input to each branch's port via the connection
|
|
20
|
+
protocol, and merges results with a `combine` strategy (default: `{name: value}` as
|
|
21
|
+
`structured_json`). It is a `BaseAgent`, so it nests inside a `Pipeline` for any
|
|
22
|
+
topology (series-of-parallels, parallel-of-series). Fan-out links validate at
|
|
23
|
+
construction (fail fast). A `max_concurrency` knob caps in-flight branches for
|
|
24
|
+
expensive (e.g. LLM-backed) fan-outs; unbounded by default.
|
|
25
|
+
- **Reliability**: every LLM adapter is now bounded by a `timeout` (default 30s) and
|
|
26
|
+
retries transient failures with exponential backoff + jitter (`max_retries`, default 2).
|
|
27
|
+
Configure per adapter: `create_adapter("openai:gpt-4o", timeout=10, max_retries=3)`.
|
|
28
|
+
Deterministic framework errors are never retried.
|
|
29
|
+
- **DeepSeek** provider (`deepseek:deepseek-chat`) via the OpenAI-compatible endpoint.
|
|
30
|
+
- `weave/py.typed` marker so downstream type-checkers consume the bundled type hints.
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
- **`BaseAgent.run` now accepts a raw value or a `Payload`**. A raw value is wrapped to
|
|
34
|
+
the input port type. Removes per-subclass wrapping (DRY) and makes `agent.run("text")`
|
|
35
|
+
work everywhere, not just inside a `Pipeline`. Backward compatible.
|
|
36
|
+
- **`Pipeline` is now a `BaseAgent`**: its ports are the first agent's input and the
|
|
37
|
+
last agent's output. A pipeline therefore nests anywhere an agent does (inside another
|
|
38
|
+
`Pipeline`, or as a `Parallel` branch) with no wrapper, so any topology composes
|
|
39
|
+
directly. `run()` still accepts a raw value or a `Payload`; existing behavior is
|
|
40
|
+
unchanged. New optional `name` / `tags` keyword args.
|
|
41
|
+
- Adapters build their provider client **once** and cache it (connection reuse) instead
|
|
42
|
+
of constructing a new client per call.
|
|
43
|
+
- The `text -> structured_json` transform now tolerates code fences / surrounding prose
|
|
44
|
+
and raises a typed `ConnectionIncompatibleError` (never a bare `JSONDecodeError`).
|
|
45
|
+
|
|
46
|
+
### Fixed
|
|
47
|
+
- Error `docs_url` links pointed at a non-existent `docs.weave.dev` domain. They now
|
|
48
|
+
resolve to anchors in the new [error reference](docs/errors.md) on the project repo,
|
|
49
|
+
so the link printed in every Weave error message actually opens documentation.
|
|
50
|
+
|
|
51
|
+
## [1.0.0] - 2026-06-01
|
|
52
|
+
|
|
53
|
+
### Added
|
|
54
|
+
- **Standard data types**: the 8 Weave primitives (`text`, `structured_json`, `image`,
|
|
55
|
+
`code`, `audio`, `document`, `embedding`, `stream`) with a directed compatibility graph.
|
|
56
|
+
- **Schema layer**: immutable `PortSchema`, a fail-fast `validate()` (<100ms, NFR-001),
|
|
57
|
+
and a reference `SchemaRegistry`.
|
|
58
|
+
- **LLM adapter layer**: the `LLMAdapter` abstraction plus 5 providers (OpenAI, Anthropic,
|
|
59
|
+
Google, Mistral, Ollama) resolved from a `"provider:model"` string via a provider registry.
|
|
60
|
+
- **Memory organ**: a bounded `ShortTermMemory` buffer and a dependency-free
|
|
61
|
+
`LongTermMemory` vector store with cosine-similarity search.
|
|
62
|
+
- **Guardrails**: a `pre` / `post` / `on_error` hook bundle (FR-009).
|
|
63
|
+
- **Agent layer**: `BaseAgent` with a full validate → guard → handle → coerce → validate
|
|
64
|
+
lifecycle, and the ergonomic `@agent` decorator.
|
|
65
|
+
- **Connection layer**: a four-step `ConnectionProtocol` (type match, shape validation,
|
|
66
|
+
capability pre-check, transform injection), a `Router`, and an extensible transform registry.
|
|
67
|
+
- **Runtime**: `Pipeline` (links validated up front) and an in-process `LocalRunner`
|
|
68
|
+
with per-hop tracing (FR-005).
|
|
69
|
+
- **CLI**: `weave scaffold` / `validate` / `package` (FR-010).
|
|
70
|
+
- **Tooling**: `Makefile`, multi-stage `Dockerfile`, ruff + mypy (strict) + pytest
|
|
71
|
+
with a ≥80% coverage gate, and an offline quickstart example.
|
|
72
|
+
|
|
73
|
+
[Unreleased]: https://github.com/TheDeveloperDoctor/weave/compare/v1.1.0...HEAD
|
|
74
|
+
[1.1.0]: https://github.com/TheDeveloperDoctor/weave/compare/v1.0.0...v1.1.0
|
|
75
|
+
[1.0.0]: https://github.com/TheDeveloperDoctor/weave/releases/tag/v1.0.0
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Contributing to Weave
|
|
2
|
+
|
|
3
|
+
Thanks for helping build the interoperability standard for AI agents. This guide keeps
|
|
4
|
+
contributions consistent and shippable.
|
|
5
|
+
|
|
6
|
+
## Development setup
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
make install # creates .venv (falls back to virtualenv if python3-venv is absent)
|
|
10
|
+
source .venv/bin/activate
|
|
11
|
+
make check # lint + typecheck + tests — must pass before you push
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Quality gates (enforced in CI)
|
|
15
|
+
|
|
16
|
+
| Gate | Command | Bar |
|
|
17
|
+
|---|---|---|
|
|
18
|
+
| Lint | `make lint` (ruff) | zero violations |
|
|
19
|
+
| Types | `make typecheck` (mypy strict) | zero errors, no `Any` leaks in public APIs |
|
|
20
|
+
| Tests | `make test` (pytest) | all pass, **≥80% coverage** on business logic |
|
|
21
|
+
|
|
22
|
+
Tests live in `tests/` and **mirror the source tree one-to-one** (e.g.
|
|
23
|
+
`weave/schema/validator.py` → `tests/schema/test_validator.py`). Cover the happy path,
|
|
24
|
+
edge cases, and failure scenarios. Mock external dependencies (LLM SDKs, network).
|
|
25
|
+
|
|
26
|
+
## Engineering principles
|
|
27
|
+
|
|
28
|
+
- **KISS / DRY / SOLID / YAGNI.** Small, single-responsibility functions; files ≤300 LOC.
|
|
29
|
+
- **No if/elif chains** for dispatch — use lookup maps, polymorphism, or the strategy
|
|
30
|
+
pattern (adding a case must not require editing existing code).
|
|
31
|
+
- **Guard clauses / early returns.** Keep the happy path unindented.
|
|
32
|
+
- **Immutability by default** — return new objects; don't mutate in place.
|
|
33
|
+
- **Fail fast** at boundaries; **never swallow exceptions** — log, wrap, or re-raise.
|
|
34
|
+
- **Dependency injection** — pass collaborators in; don't instantiate them inside.
|
|
35
|
+
- No magic numbers/strings — extract named constants.
|
|
36
|
+
|
|
37
|
+
## Adding a provider / transform / data type
|
|
38
|
+
|
|
39
|
+
These are deliberately open for extension (Open/Closed):
|
|
40
|
+
|
|
41
|
+
- **LLM provider** → implement `LLMAdapter`, then `register_provider("name", Adapter)`.
|
|
42
|
+
- **Transform** → `register_transform(SOURCE, TARGET, async_fn)`.
|
|
43
|
+
- **Data-type compatibility** → add a row to the compatibility map in `weave/types/primitives.py`.
|
|
44
|
+
|
|
45
|
+
No edits to existing dispatch logic should be needed.
|
|
46
|
+
|
|
47
|
+
## Commit messages
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
<type>(<scope>): <short summary>
|
|
51
|
+
|
|
52
|
+
What changed:
|
|
53
|
+
- <specific change>
|
|
54
|
+
|
|
55
|
+
Why:
|
|
56
|
+
<reason or context>
|
|
57
|
+
|
|
58
|
+
Author: harisahmed510.00@gmail.com
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Types: `feat`, `fix`, `refactor`, `test`, `chore`, `docs`, `perf`, `security`.
|
|
62
|
+
|
|
63
|
+
## Pull requests
|
|
64
|
+
|
|
65
|
+
- State **what changed and why** in the description; flag trade-offs.
|
|
66
|
+
- Keep PRs focused and small. One concern per PR.
|
|
67
|
+
- CI (`make check`) must be green. Breaking changes require a 90-day notice and a
|
|
68
|
+
migration note in `CHANGELOG.md` (NFR-033).
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# --- Build Stage ---
|
|
2
|
+
FROM python:3.12-slim AS builder
|
|
3
|
+
WORKDIR /app
|
|
4
|
+
COPY pyproject.toml README.md ./
|
|
5
|
+
COPY weave ./weave
|
|
6
|
+
RUN pip install --no-cache-dir build && python -m build --wheel
|
|
7
|
+
|
|
8
|
+
# --- Production Stage ---
|
|
9
|
+
FROM python:3.12-slim AS production
|
|
10
|
+
ENV PYTHONUNBUFFERED=1 \
|
|
11
|
+
PIP_NO_CACHE_DIR=1
|
|
12
|
+
WORKDIR /app
|
|
13
|
+
COPY --from=builder /app/dist/*.whl /tmp/
|
|
14
|
+
RUN pip install --no-cache-dir /tmp/*.whl && rm -rf /tmp/*.whl
|
|
15
|
+
RUN addgroup --system appgroup && adduser --system --ingroup appgroup appuser
|
|
16
|
+
USER appuser
|
|
17
|
+
ENTRYPOINT ["weave"]
|
|
18
|
+
CMD ["--help"]
|
weaveflow-1.1.0/LICENSE
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or Derivative
|
|
95
|
+
Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works.
|
|
111
|
+
|
|
112
|
+
You may add Your own attribution notices within Derivative Works
|
|
113
|
+
that You distribute, alongside or as an addendum to the NOTICE text
|
|
114
|
+
from the Work, provided that such additional attribution notices
|
|
115
|
+
cannot be construed as modifying the License.
|
|
116
|
+
|
|
117
|
+
You may add Your own copyright statement to Your modifications and
|
|
118
|
+
may provide additional or different license terms and conditions
|
|
119
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
120
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
121
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
122
|
+
the conditions stated in this License.
|
|
123
|
+
|
|
124
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
125
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
126
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
127
|
+
this License, without any additional terms or conditions.
|
|
128
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
129
|
+
the terms of any separate license agreement you may have executed
|
|
130
|
+
with Licensor regarding such Contributions.
|
|
131
|
+
|
|
132
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
133
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
134
|
+
except as required for reasonable and customary use in describing the
|
|
135
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
136
|
+
|
|
137
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
138
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
139
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
140
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
141
|
+
implied, including, without limitation, any warranties or conditions
|
|
142
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
143
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
144
|
+
appropriateness of using or redistributing the Work and assume any
|
|
145
|
+
risks associated with Your exercise of permissions under this License.
|
|
146
|
+
|
|
147
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
148
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
149
|
+
unless required by applicable law (such as deliberate and grossly
|
|
150
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
151
|
+
liable to You for damages, including any direct, indirect, special,
|
|
152
|
+
incidental, or consequential damages of any character arising as a
|
|
153
|
+
result of this License or out of the use or inability to use the
|
|
154
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
155
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
156
|
+
other commercial damages or losses), even if such Contributor
|
|
157
|
+
has been advised of the possibility of such damages.
|
|
158
|
+
|
|
159
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
160
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
161
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
162
|
+
or other liability obligations and/or rights consistent with this
|
|
163
|
+
License. However, in accepting such obligations, You may act only
|
|
164
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
165
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
166
|
+
defend, and hold each Contributor harmless for any liability
|
|
167
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
168
|
+
of your accepting any such warranty or additional liability.
|
|
169
|
+
|
|
170
|
+
END OF TERMS AND CONDITIONS
|
|
171
|
+
|
|
172
|
+
Copyright 2026 Haris Ahmed
|
|
173
|
+
|
|
174
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
175
|
+
you may not use this file except in compliance with the License.
|
|
176
|
+
You may obtain a copy of the License at
|
|
177
|
+
|
|
178
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
179
|
+
|
|
180
|
+
Unless required by applicable law or agreed to in writing, software
|
|
181
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
182
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
183
|
+
See the License for the specific language governing permissions and
|
|
184
|
+
limitations under the License.
|
weaveflow-1.1.0/Makefile
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
.DEFAULT_GOAL := help
|
|
2
|
+
PYTHON := python3
|
|
3
|
+
VENV := .venv
|
|
4
|
+
BIN := $(VENV)/bin
|
|
5
|
+
IMAGE := weave:latest
|
|
6
|
+
|
|
7
|
+
.PHONY: help
|
|
8
|
+
help: ## Show this help
|
|
9
|
+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
|
|
10
|
+
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-16s\033[0m %s\n", $$1, $$2}'
|
|
11
|
+
|
|
12
|
+
$(VENV): ## Create the virtualenv (falls back to virtualenv when python3-venv is absent)
|
|
13
|
+
$(PYTHON) -m venv $(VENV) 2>/dev/null || virtualenv -p $(PYTHON) $(VENV)
|
|
14
|
+
|
|
15
|
+
.PHONY: install
|
|
16
|
+
install: $(VENV) ## Install the framework with dev + all provider extras
|
|
17
|
+
$(BIN)/pip install --upgrade pip
|
|
18
|
+
$(BIN)/pip install -e ".[dev,all]"
|
|
19
|
+
|
|
20
|
+
.PHONY: lint
|
|
21
|
+
lint: ## Run ruff lint checks
|
|
22
|
+
$(BIN)/ruff check weave tests
|
|
23
|
+
|
|
24
|
+
.PHONY: format
|
|
25
|
+
format: ## Auto-format with ruff
|
|
26
|
+
$(BIN)/ruff format weave tests
|
|
27
|
+
$(BIN)/ruff check --fix weave tests
|
|
28
|
+
|
|
29
|
+
.PHONY: typecheck
|
|
30
|
+
typecheck: ## Run mypy in strict mode
|
|
31
|
+
$(BIN)/mypy weave
|
|
32
|
+
|
|
33
|
+
.PHONY: test
|
|
34
|
+
test: ## Run the test suite with coverage (fails under 80%)
|
|
35
|
+
$(BIN)/pytest --cov=weave --cov-report=term-missing
|
|
36
|
+
|
|
37
|
+
.PHONY: e2e
|
|
38
|
+
e2e: ## Run the end-to-end suite (CLI, pipeline, examples — offline, no slow tests)
|
|
39
|
+
$(BIN)/pytest tests/e2e
|
|
40
|
+
|
|
41
|
+
.PHONY: e2e-full
|
|
42
|
+
e2e-full: ## Run e2e incl. the build+install-in-clean-venv deploy test
|
|
43
|
+
WEAVE_E2E_FULL=1 $(BIN)/pytest -m slow tests/e2e
|
|
44
|
+
|
|
45
|
+
.PHONY: check
|
|
46
|
+
check: lint typecheck test ## Run lint, typecheck, and tests
|
|
47
|
+
|
|
48
|
+
.PHONY: example
|
|
49
|
+
example: ## Run the offline example pipeline
|
|
50
|
+
$(BIN)/python examples/quickstart.py
|
|
51
|
+
|
|
52
|
+
.PHONY: demo-framework
|
|
53
|
+
demo-framework: ## Run the hands-on test-bed (series/parallel/nested/memory/CLI)
|
|
54
|
+
$(BIN)/python test-framwork/run.py
|
|
55
|
+
|
|
56
|
+
.PHONY: docs
|
|
57
|
+
docs: ## Serve the documentation site locally (http://127.0.0.1:8000)
|
|
58
|
+
$(BIN)/pip install -e ".[docs]" && $(BIN)/mkdocs serve
|
|
59
|
+
|
|
60
|
+
.PHONY: docs-build
|
|
61
|
+
docs-build: ## Build the static documentation site into ./site
|
|
62
|
+
$(BIN)/pip install -e ".[docs]" && $(BIN)/mkdocs build
|
|
63
|
+
|
|
64
|
+
.PHONY: docs-html
|
|
65
|
+
docs-html: ## Build the zero-dependency HTML docs (docs/index.html + docs/pages/)
|
|
66
|
+
python3 docs/build_site.py
|
|
67
|
+
|
|
68
|
+
.PHONY: build
|
|
69
|
+
build: ## Build the wheel + sdist
|
|
70
|
+
$(BIN)/pip install build && $(BIN)/python -m build
|
|
71
|
+
|
|
72
|
+
.PHONY: docker-build
|
|
73
|
+
docker-build: ## Build the production Docker image
|
|
74
|
+
docker build -t $(IMAGE) .
|
|
75
|
+
|
|
76
|
+
.PHONY: docker-run
|
|
77
|
+
docker-run: ## Run the CLI inside the Docker image
|
|
78
|
+
docker run --rm $(IMAGE) --version
|
|
79
|
+
|
|
80
|
+
.PHONY: clean
|
|
81
|
+
clean: ## Remove build/test artifacts
|
|
82
|
+
rm -rf $(VENV) dist build site *.egg-info .pytest_cache .mypy_cache .ruff_cache .coverage
|
|
83
|
+
find . -type d -name __pycache__ -exec rm -rf {} +
|