duragraph-python 0.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.
- duragraph_python-0.1.0/.github/CODEOWNERS +28 -0
- duragraph_python-0.1.0/.github/ISSUE_TEMPLATE/bug_report.md +55 -0
- duragraph_python-0.1.0/.github/ISSUE_TEMPLATE/feature_request.md +34 -0
- duragraph_python-0.1.0/.github/labeler.yml +67 -0
- duragraph_python-0.1.0/.github/pull_request_template.md +38 -0
- duragraph_python-0.1.0/.github/workflows/ci.yml +85 -0
- duragraph_python-0.1.0/.github/workflows/labeler.yml +18 -0
- duragraph_python-0.1.0/.github/workflows/publish.yml +82 -0
- duragraph_python-0.1.0/.gitignore +62 -0
- duragraph_python-0.1.0/CHANGELOG.md +30 -0
- duragraph_python-0.1.0/CONTRIBUTING.md +173 -0
- duragraph_python-0.1.0/LICENSE +190 -0
- duragraph_python-0.1.0/PKG-INFO +224 -0
- duragraph_python-0.1.0/README.md +175 -0
- duragraph_python-0.1.0/lefthook.yml +52 -0
- duragraph_python-0.1.0/pyproject.toml +131 -0
- duragraph_python-0.1.0/src/duragraph/__init__.py +35 -0
- duragraph_python-0.1.0/src/duragraph/cli/__init__.py +5 -0
- duragraph_python-0.1.0/src/duragraph/cli/main.py +163 -0
- duragraph_python-0.1.0/src/duragraph/edges.py +116 -0
- duragraph_python-0.1.0/src/duragraph/graph.py +429 -0
- duragraph_python-0.1.0/src/duragraph/nodes.py +252 -0
- duragraph_python-0.1.0/src/duragraph/prompts/__init__.py +6 -0
- duragraph_python-0.1.0/src/duragraph/prompts/decorators.py +43 -0
- duragraph_python-0.1.0/src/duragraph/prompts/store.py +171 -0
- duragraph_python-0.1.0/src/duragraph/py.typed +0 -0
- duragraph_python-0.1.0/src/duragraph/types.py +100 -0
- duragraph_python-0.1.0/src/duragraph/worker/__init__.py +5 -0
- duragraph_python-0.1.0/src/duragraph/worker/worker.py +327 -0
- duragraph_python-0.1.0/tests/__init__.py +1 -0
- duragraph_python-0.1.0/tests/test_graph.py +71 -0
- duragraph_python-0.1.0/uv.lock +1601 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# CODEOWNERS - Define who reviews what
|
|
2
|
+
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
|
|
3
|
+
|
|
4
|
+
# Default owners for everything
|
|
5
|
+
* @duragraph/maintainers
|
|
6
|
+
|
|
7
|
+
# Core graph functionality
|
|
8
|
+
/src/duragraph/graph.py @duragraph/core
|
|
9
|
+
/src/duragraph/nodes.py @duragraph/core
|
|
10
|
+
/src/duragraph/edges.py @duragraph/core
|
|
11
|
+
/src/duragraph/types.py @duragraph/core
|
|
12
|
+
|
|
13
|
+
# Worker and control plane integration
|
|
14
|
+
/src/duragraph/worker/ @duragraph/core
|
|
15
|
+
|
|
16
|
+
# Prompts module
|
|
17
|
+
/src/duragraph/prompts/ @duragraph/core
|
|
18
|
+
|
|
19
|
+
# CLI
|
|
20
|
+
/src/duragraph/cli/ @duragraph/maintainers
|
|
21
|
+
|
|
22
|
+
# CI/CD and infrastructure
|
|
23
|
+
/.github/ @duragraph/maintainers
|
|
24
|
+
/pyproject.toml @duragraph/maintainers
|
|
25
|
+
|
|
26
|
+
# Documentation - more permissive
|
|
27
|
+
/*.md @duragraph/maintainers
|
|
28
|
+
/docs/ @duragraph/maintainers
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug Report
|
|
3
|
+
about: Report a bug in DuraGraph Python SDK
|
|
4
|
+
title: "[BUG] "
|
|
5
|
+
labels: bug
|
|
6
|
+
assignees: ''
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Bug Description
|
|
10
|
+
|
|
11
|
+
<!-- A clear and concise description of the bug -->
|
|
12
|
+
|
|
13
|
+
## To Reproduce
|
|
14
|
+
|
|
15
|
+
Steps to reproduce the behavior:
|
|
16
|
+
|
|
17
|
+
1. Create a graph with...
|
|
18
|
+
2. Run...
|
|
19
|
+
3. See error
|
|
20
|
+
|
|
21
|
+
## Expected Behavior
|
|
22
|
+
|
|
23
|
+
<!-- What you expected to happen -->
|
|
24
|
+
|
|
25
|
+
## Actual Behavior
|
|
26
|
+
|
|
27
|
+
<!-- What actually happened -->
|
|
28
|
+
|
|
29
|
+
## Code Example
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
# Minimal code to reproduce the issue
|
|
33
|
+
from duragraph import Graph, llm_node
|
|
34
|
+
|
|
35
|
+
@Graph(id="example")
|
|
36
|
+
class MyAgent:
|
|
37
|
+
...
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Error Message
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
# Paste the full error message/traceback here
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Environment
|
|
47
|
+
|
|
48
|
+
- OS: [e.g., macOS 14.0, Ubuntu 22.04]
|
|
49
|
+
- Python version: [e.g., 3.12.0]
|
|
50
|
+
- DuraGraph version: [e.g., 0.1.0]
|
|
51
|
+
- Control Plane version (if applicable): [e.g., 0.1.0]
|
|
52
|
+
|
|
53
|
+
## Additional Context
|
|
54
|
+
|
|
55
|
+
<!-- Any other context about the problem -->
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature Request
|
|
3
|
+
about: Suggest a new feature for DuraGraph Python SDK
|
|
4
|
+
title: "[FEATURE] "
|
|
5
|
+
labels: enhancement
|
|
6
|
+
assignees: ''
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Problem Statement
|
|
10
|
+
|
|
11
|
+
<!-- What problem does this feature solve? -->
|
|
12
|
+
|
|
13
|
+
## Proposed Solution
|
|
14
|
+
|
|
15
|
+
<!-- Describe your proposed solution -->
|
|
16
|
+
|
|
17
|
+
## Example Usage
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
# How would this feature be used?
|
|
21
|
+
from duragraph import Graph, new_feature
|
|
22
|
+
|
|
23
|
+
@Graph(id="example")
|
|
24
|
+
class MyAgent:
|
|
25
|
+
...
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Alternatives Considered
|
|
29
|
+
|
|
30
|
+
<!-- What alternatives have you considered? -->
|
|
31
|
+
|
|
32
|
+
## Additional Context
|
|
33
|
+
|
|
34
|
+
<!-- Any other context, mockups, or references -->
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# PR Labeler configuration
|
|
2
|
+
# https://github.com/actions/labeler
|
|
3
|
+
|
|
4
|
+
# Core functionality
|
|
5
|
+
core:
|
|
6
|
+
- changed-files:
|
|
7
|
+
- any-glob-to-any-file:
|
|
8
|
+
- src/duragraph/graph.py
|
|
9
|
+
- src/duragraph/nodes.py
|
|
10
|
+
- src/duragraph/edges.py
|
|
11
|
+
- src/duragraph/types.py
|
|
12
|
+
- src/duragraph/__init__.py
|
|
13
|
+
|
|
14
|
+
# Worker module
|
|
15
|
+
worker:
|
|
16
|
+
- changed-files:
|
|
17
|
+
- any-glob-to-any-file:
|
|
18
|
+
- src/duragraph/worker/**/*
|
|
19
|
+
|
|
20
|
+
# Prompts module
|
|
21
|
+
prompts:
|
|
22
|
+
- changed-files:
|
|
23
|
+
- any-glob-to-any-file:
|
|
24
|
+
- src/duragraph/prompts/**/*
|
|
25
|
+
|
|
26
|
+
# CLI
|
|
27
|
+
cli:
|
|
28
|
+
- changed-files:
|
|
29
|
+
- any-glob-to-any-file:
|
|
30
|
+
- src/duragraph/cli/**/*
|
|
31
|
+
|
|
32
|
+
# Tests
|
|
33
|
+
tests:
|
|
34
|
+
- changed-files:
|
|
35
|
+
- any-glob-to-any-file:
|
|
36
|
+
- tests/**/*
|
|
37
|
+
|
|
38
|
+
# Documentation
|
|
39
|
+
documentation:
|
|
40
|
+
- changed-files:
|
|
41
|
+
- any-glob-to-any-file:
|
|
42
|
+
- "**/*.md"
|
|
43
|
+
- docs/**/*
|
|
44
|
+
|
|
45
|
+
# CI/CD
|
|
46
|
+
ci:
|
|
47
|
+
- changed-files:
|
|
48
|
+
- any-glob-to-any-file:
|
|
49
|
+
- .github/**/*
|
|
50
|
+
|
|
51
|
+
# Dependencies
|
|
52
|
+
dependencies:
|
|
53
|
+
- changed-files:
|
|
54
|
+
- any-glob-to-any-file:
|
|
55
|
+
- pyproject.toml
|
|
56
|
+
- "*.lock"
|
|
57
|
+
- requirements*.txt
|
|
58
|
+
|
|
59
|
+
# Configuration
|
|
60
|
+
config:
|
|
61
|
+
- changed-files:
|
|
62
|
+
- any-glob-to-any-file:
|
|
63
|
+
- lefthook.yml
|
|
64
|
+
- .ruff.toml
|
|
65
|
+
- mypy.ini
|
|
66
|
+
- "*.toml"
|
|
67
|
+
- "*.cfg"
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
## Description
|
|
2
|
+
|
|
3
|
+
<!-- Describe your changes in detail -->
|
|
4
|
+
|
|
5
|
+
## Type of Change
|
|
6
|
+
|
|
7
|
+
<!-- Mark the relevant option with [x] -->
|
|
8
|
+
|
|
9
|
+
- [ ] `feat` - New feature
|
|
10
|
+
- [ ] `fix` - Bug fix
|
|
11
|
+
- [ ] `docs` - Documentation only
|
|
12
|
+
- [ ] `refactor` - Code refactoring
|
|
13
|
+
- [ ] `perf` - Performance improvement
|
|
14
|
+
- [ ] `test` - Adding/updating tests
|
|
15
|
+
- [ ] `build` - Build system or dependencies
|
|
16
|
+
- [ ] `ci` - CI/CD changes
|
|
17
|
+
- [ ] `chore` - Maintenance
|
|
18
|
+
|
|
19
|
+
## Related Issues
|
|
20
|
+
|
|
21
|
+
<!-- Link related issues: Fixes #123, Closes #456 -->
|
|
22
|
+
|
|
23
|
+
## Checklist
|
|
24
|
+
|
|
25
|
+
- [ ] My code follows the project's code style
|
|
26
|
+
- [ ] I have run `ruff check src/` and `ruff format src/`
|
|
27
|
+
- [ ] I have added tests for my changes
|
|
28
|
+
- [ ] All tests pass (`pytest tests/`)
|
|
29
|
+
- [ ] I have updated documentation if needed
|
|
30
|
+
- [ ] My commits follow the [conventional commits](https://www.conventionalcommits.org/) format
|
|
31
|
+
|
|
32
|
+
## Breaking Changes
|
|
33
|
+
|
|
34
|
+
<!-- If this is a breaking change, describe what breaks and migration steps -->
|
|
35
|
+
|
|
36
|
+
## Screenshots / Examples
|
|
37
|
+
|
|
38
|
+
<!-- If applicable, add screenshots or code examples -->
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
lint:
|
|
11
|
+
name: Lint
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
|
|
16
|
+
- name: Set up Python
|
|
17
|
+
uses: actions/setup-python@v5
|
|
18
|
+
with:
|
|
19
|
+
python-version: "3.12"
|
|
20
|
+
|
|
21
|
+
- name: Install dependencies
|
|
22
|
+
run: |
|
|
23
|
+
python -m pip install --upgrade pip
|
|
24
|
+
pip install ruff mypy
|
|
25
|
+
|
|
26
|
+
- name: Run ruff
|
|
27
|
+
run: ruff check src/
|
|
28
|
+
|
|
29
|
+
- name: Run ruff format check
|
|
30
|
+
run: ruff format --check src/
|
|
31
|
+
|
|
32
|
+
test:
|
|
33
|
+
name: Test (Python ${{ matrix.python-version }})
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
strategy:
|
|
36
|
+
fail-fast: false
|
|
37
|
+
matrix:
|
|
38
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
39
|
+
|
|
40
|
+
steps:
|
|
41
|
+
- uses: actions/checkout@v4
|
|
42
|
+
|
|
43
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
44
|
+
uses: actions/setup-python@v5
|
|
45
|
+
with:
|
|
46
|
+
python-version: ${{ matrix.python-version }}
|
|
47
|
+
|
|
48
|
+
- name: Install dependencies
|
|
49
|
+
run: |
|
|
50
|
+
python -m pip install --upgrade pip
|
|
51
|
+
pip install -e ".[dev]"
|
|
52
|
+
|
|
53
|
+
- name: Run tests
|
|
54
|
+
run: pytest tests/ -v --cov=duragraph --cov-report=xml
|
|
55
|
+
|
|
56
|
+
- name: Upload coverage
|
|
57
|
+
uses: codecov/codecov-action@v4
|
|
58
|
+
if: matrix.python-version == '3.12'
|
|
59
|
+
with:
|
|
60
|
+
files: coverage.xml
|
|
61
|
+
fail_ci_if_error: false
|
|
62
|
+
|
|
63
|
+
build:
|
|
64
|
+
name: Build package
|
|
65
|
+
runs-on: ubuntu-latest
|
|
66
|
+
steps:
|
|
67
|
+
- uses: actions/checkout@v4
|
|
68
|
+
|
|
69
|
+
- name: Set up Python
|
|
70
|
+
uses: actions/setup-python@v5
|
|
71
|
+
with:
|
|
72
|
+
python-version: "3.12"
|
|
73
|
+
|
|
74
|
+
- name: Install build dependencies
|
|
75
|
+
run: |
|
|
76
|
+
python -m pip install --upgrade pip
|
|
77
|
+
pip install build
|
|
78
|
+
|
|
79
|
+
- name: Build package
|
|
80
|
+
run: python -m build
|
|
81
|
+
|
|
82
|
+
- name: Check package
|
|
83
|
+
run: |
|
|
84
|
+
pip install twine
|
|
85
|
+
twine check dist/*
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
name: PR Labeler
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types: [opened, synchronize, reopened]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
pull-requests: write
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
label:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/labeler@v5
|
|
16
|
+
with:
|
|
17
|
+
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
18
|
+
configuration-path: .github/labeler.yml
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
inputs:
|
|
8
|
+
test_pypi:
|
|
9
|
+
description: 'Publish to Test PyPI instead'
|
|
10
|
+
required: false
|
|
11
|
+
default: false
|
|
12
|
+
type: boolean
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
build:
|
|
16
|
+
name: Build distribution
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- name: Set up Python
|
|
22
|
+
uses: actions/setup-python@v5
|
|
23
|
+
with:
|
|
24
|
+
python-version: "3.12"
|
|
25
|
+
|
|
26
|
+
- name: Install build dependencies
|
|
27
|
+
run: |
|
|
28
|
+
python -m pip install --upgrade pip
|
|
29
|
+
pip install build
|
|
30
|
+
|
|
31
|
+
- name: Build package
|
|
32
|
+
run: python -m build
|
|
33
|
+
|
|
34
|
+
- name: Store distribution packages
|
|
35
|
+
uses: actions/upload-artifact@v4
|
|
36
|
+
with:
|
|
37
|
+
name: python-package-distributions
|
|
38
|
+
path: dist/
|
|
39
|
+
|
|
40
|
+
publish-to-pypi:
|
|
41
|
+
name: Publish to PyPI
|
|
42
|
+
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && !inputs.test_pypi)
|
|
43
|
+
needs: build
|
|
44
|
+
runs-on: ubuntu-latest
|
|
45
|
+
environment:
|
|
46
|
+
name: pypi
|
|
47
|
+
url: https://pypi.org/p/duragraph-python
|
|
48
|
+
permissions:
|
|
49
|
+
id-token: write # Required for trusted publishing
|
|
50
|
+
|
|
51
|
+
steps:
|
|
52
|
+
- name: Download distribution packages
|
|
53
|
+
uses: actions/download-artifact@v4
|
|
54
|
+
with:
|
|
55
|
+
name: python-package-distributions
|
|
56
|
+
path: dist/
|
|
57
|
+
|
|
58
|
+
- name: Publish to PyPI
|
|
59
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
60
|
+
|
|
61
|
+
publish-to-testpypi:
|
|
62
|
+
name: Publish to Test PyPI
|
|
63
|
+
if: github.event_name == 'workflow_dispatch' && inputs.test_pypi
|
|
64
|
+
needs: build
|
|
65
|
+
runs-on: ubuntu-latest
|
|
66
|
+
environment:
|
|
67
|
+
name: testpypi
|
|
68
|
+
url: https://test.pypi.org/p/duragraph-python
|
|
69
|
+
permissions:
|
|
70
|
+
id-token: write
|
|
71
|
+
|
|
72
|
+
steps:
|
|
73
|
+
- name: Download distribution packages
|
|
74
|
+
uses: actions/download-artifact@v4
|
|
75
|
+
with:
|
|
76
|
+
name: python-package-distributions
|
|
77
|
+
path: dist/
|
|
78
|
+
|
|
79
|
+
- name: Publish to Test PyPI
|
|
80
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
81
|
+
with:
|
|
82
|
+
repository-url: https://test.pypi.org/legacy/
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
.Python
|
|
7
|
+
build/
|
|
8
|
+
develop-eggs/
|
|
9
|
+
dist/
|
|
10
|
+
downloads/
|
|
11
|
+
eggs/
|
|
12
|
+
.eggs/
|
|
13
|
+
lib/
|
|
14
|
+
lib64/
|
|
15
|
+
parts/
|
|
16
|
+
sdist/
|
|
17
|
+
var/
|
|
18
|
+
wheels/
|
|
19
|
+
*.egg-info/
|
|
20
|
+
.installed.cfg
|
|
21
|
+
*.egg
|
|
22
|
+
|
|
23
|
+
# Virtual environments
|
|
24
|
+
.venv/
|
|
25
|
+
venv/
|
|
26
|
+
ENV/
|
|
27
|
+
env/
|
|
28
|
+
|
|
29
|
+
# IDE
|
|
30
|
+
.idea/
|
|
31
|
+
.vscode/
|
|
32
|
+
*.swp
|
|
33
|
+
*.swo
|
|
34
|
+
*~
|
|
35
|
+
|
|
36
|
+
# Testing
|
|
37
|
+
.tox/
|
|
38
|
+
.nox/
|
|
39
|
+
.coverage
|
|
40
|
+
.coverage.*
|
|
41
|
+
htmlcov/
|
|
42
|
+
.pytest_cache/
|
|
43
|
+
.mypy_cache/
|
|
44
|
+
|
|
45
|
+
# Documentation
|
|
46
|
+
docs/_build/
|
|
47
|
+
site/
|
|
48
|
+
|
|
49
|
+
# OS
|
|
50
|
+
.DS_Store
|
|
51
|
+
Thumbs.db
|
|
52
|
+
|
|
53
|
+
# Project specific
|
|
54
|
+
*.log
|
|
55
|
+
.env
|
|
56
|
+
.env.local
|
|
57
|
+
|
|
58
|
+
# Build artifacts
|
|
59
|
+
dist/
|
|
60
|
+
|
|
61
|
+
# UV lock file (optional - can be committed for reproducibility)
|
|
62
|
+
# uv.lock
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.1.0] - 2024-12-29
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- Initial package structure
|
|
14
|
+
- `@Graph` class decorator for defining workflows
|
|
15
|
+
- Node decorators: `@llm_node`, `@tool_node`, `@router_node`, `@human_node`, `@node`
|
|
16
|
+
- `@entrypoint` decorator for marking graph entry points
|
|
17
|
+
- Edge definitions with `>>` operator support
|
|
18
|
+
- `Worker` class for control plane integration
|
|
19
|
+
- `PromptStore` client for prompt management
|
|
20
|
+
- `@prompt` decorator for attaching prompts to nodes
|
|
21
|
+
- CLI commands: `init`, `dev`, `deploy`, `visualize`
|
|
22
|
+
- Type definitions: `State`, `Message`, `HumanMessage`, `AIMessage`, `ToolMessage`, `Event`, `RunResult`
|
|
23
|
+
- GitHub Actions CI/CD for PyPI publishing
|
|
24
|
+
- Lefthook git hooks for pre-commit and commit message validation
|
|
25
|
+
- Conventional commits enforcement
|
|
26
|
+
- Apache 2.0 license
|
|
27
|
+
- PEP 561 type hints support (py.typed marker)
|
|
28
|
+
|
|
29
|
+
[Unreleased]: https://github.com/duragraph/duragraph-python/compare/v0.1.0...HEAD
|
|
30
|
+
[0.1.0]: https://github.com/duragraph/duragraph-python/releases/tag/v0.1.0
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# Contributing to DuraGraph Python SDK
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to DuraGraph! This document provides guidelines and conventions for contributing.
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
1. Fork the repository
|
|
8
|
+
2. Clone your fork:
|
|
9
|
+
```bash
|
|
10
|
+
git clone https://github.com/YOUR_USERNAME/duragraph-python.git
|
|
11
|
+
cd duragraph-python
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
3. Install dependencies with uv:
|
|
15
|
+
```bash
|
|
16
|
+
uv sync --all-extras
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
4. Install git hooks:
|
|
20
|
+
```bash
|
|
21
|
+
lefthook install
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Development Workflow
|
|
25
|
+
|
|
26
|
+
### Running Tests
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Run all tests
|
|
30
|
+
pytest tests/
|
|
31
|
+
|
|
32
|
+
# Run with coverage
|
|
33
|
+
pytest tests/ --cov=duragraph --cov-report=html
|
|
34
|
+
|
|
35
|
+
# Run specific test
|
|
36
|
+
pytest tests/test_graph.py -v
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Linting & Formatting
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# Check linting
|
|
43
|
+
ruff check src/
|
|
44
|
+
|
|
45
|
+
# Auto-fix linting issues
|
|
46
|
+
ruff check src/ --fix
|
|
47
|
+
|
|
48
|
+
# Format code
|
|
49
|
+
ruff format src/
|
|
50
|
+
|
|
51
|
+
# Type checking
|
|
52
|
+
mypy src/duragraph
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Commit Convention
|
|
56
|
+
|
|
57
|
+
We use [Conventional Commits](https://www.conventionalcommits.org/). All commit messages must follow this format:
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
<type>(<scope>): <description>
|
|
61
|
+
|
|
62
|
+
[optional body]
|
|
63
|
+
|
|
64
|
+
[optional footer(s)]
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Commit Types
|
|
68
|
+
|
|
69
|
+
| Type | Description | Example |
|
|
70
|
+
|------------|------------------------------------------------------|--------------------------------------------|
|
|
71
|
+
| `feat` | New feature | `feat(graph): add subgraph support` |
|
|
72
|
+
| `fix` | Bug fix | `fix(worker): handle connection timeout` |
|
|
73
|
+
| `docs` | Documentation only | `docs: update installation guide` |
|
|
74
|
+
| `style` | Code style (formatting, semicolons, etc.) | `style: fix indentation in nodes.py` |
|
|
75
|
+
| `refactor` | Code change that neither fixes a bug nor adds feature| `refactor(cli): simplify command parsing` |
|
|
76
|
+
| `perf` | Performance improvement | `perf(graph): optimize node lookup` |
|
|
77
|
+
| `test` | Adding or updating tests | `test(worker): add registration tests` |
|
|
78
|
+
| `build` | Build system or dependencies | `build: update httpx to 0.28` |
|
|
79
|
+
| `ci` | CI/CD configuration | `ci: add Python 3.13 to test matrix` |
|
|
80
|
+
| `chore` | Maintenance tasks | `chore: update .gitignore` |
|
|
81
|
+
| `revert` | Revert a previous commit | `revert: feat(graph): add subgraph support`|
|
|
82
|
+
|
|
83
|
+
### Scopes
|
|
84
|
+
|
|
85
|
+
Common scopes for this project:
|
|
86
|
+
|
|
87
|
+
- `graph` - Graph decorator and execution
|
|
88
|
+
- `nodes` - Node decorators (llm_node, tool_node, etc.)
|
|
89
|
+
- `edges` - Edge definitions
|
|
90
|
+
- `worker` - Worker and control plane integration
|
|
91
|
+
- `prompts` - Prompt store and management
|
|
92
|
+
- `cli` - Command-line interface
|
|
93
|
+
- `types` - Type definitions
|
|
94
|
+
- `deps` - Dependencies
|
|
95
|
+
|
|
96
|
+
### Examples
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
# Feature
|
|
100
|
+
git commit -m "feat(graph): add async streaming support"
|
|
101
|
+
|
|
102
|
+
# Bug fix with issue reference
|
|
103
|
+
git commit -m "fix(worker): prevent duplicate registration
|
|
104
|
+
|
|
105
|
+
Fixes #123"
|
|
106
|
+
|
|
107
|
+
# Breaking change
|
|
108
|
+
git commit -m "feat(nodes)!: rename @llm to @llm_node
|
|
109
|
+
|
|
110
|
+
BREAKING CHANGE: The @llm decorator has been renamed to @llm_node for clarity."
|
|
111
|
+
|
|
112
|
+
# Documentation
|
|
113
|
+
git commit -m "docs(readme): add streaming example"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Pull Request Guidelines
|
|
117
|
+
|
|
118
|
+
### Before Submitting
|
|
119
|
+
|
|
120
|
+
- [ ] Code passes all tests (`pytest tests/`)
|
|
121
|
+
- [ ] Code passes linting (`ruff check src/`)
|
|
122
|
+
- [ ] Code is formatted (`ruff format src/`)
|
|
123
|
+
- [ ] Commit messages follow convention
|
|
124
|
+
- [ ] Documentation is updated if needed
|
|
125
|
+
- [ ] CHANGELOG.md is updated for user-facing changes
|
|
126
|
+
|
|
127
|
+
### PR Title
|
|
128
|
+
|
|
129
|
+
PR titles should also follow the commit convention:
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
feat(graph): add subgraph support
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### PR Labels
|
|
136
|
+
|
|
137
|
+
PRs are automatically labeled based on files changed:
|
|
138
|
+
|
|
139
|
+
| Label | Files |
|
|
140
|
+
|----------------|------------------------------------|
|
|
141
|
+
| `core` | `src/duragraph/graph.py`, `nodes.py`, `edges.py` |
|
|
142
|
+
| `worker` | `src/duragraph/worker/` |
|
|
143
|
+
| `prompts` | `src/duragraph/prompts/` |
|
|
144
|
+
| `cli` | `src/duragraph/cli/` |
|
|
145
|
+
| `tests` | `tests/` |
|
|
146
|
+
| `docs` | `*.md`, `docs/` |
|
|
147
|
+
| `ci` | `.github/` |
|
|
148
|
+
| `dependencies` | `pyproject.toml`, `*.lock` |
|
|
149
|
+
|
|
150
|
+
### Review Process
|
|
151
|
+
|
|
152
|
+
1. All PRs require at least one approval
|
|
153
|
+
2. CI must pass (lint, test, build)
|
|
154
|
+
3. Maintainers may request changes
|
|
155
|
+
4. Squash merge is preferred for clean history
|
|
156
|
+
|
|
157
|
+
## Releasing
|
|
158
|
+
|
|
159
|
+
Releases are handled by maintainers:
|
|
160
|
+
|
|
161
|
+
1. Update version in `pyproject.toml`
|
|
162
|
+
2. Update `CHANGELOG.md`
|
|
163
|
+
3. Create a GitHub release with tag `vX.Y.Z`
|
|
164
|
+
4. GitHub Actions automatically publishes to PyPI
|
|
165
|
+
|
|
166
|
+
## Code of Conduct
|
|
167
|
+
|
|
168
|
+
Be respectful and inclusive. We follow the [Contributor Covenant](https://www.contributor-covenant.org/).
|
|
169
|
+
|
|
170
|
+
## Questions?
|
|
171
|
+
|
|
172
|
+
- Open a [GitHub Discussion](https://github.com/duragraph/duragraph-python/discussions)
|
|
173
|
+
- Check existing [Issues](https://github.com/duragraph/duragraph-python/issues)
|