Convert YAML workflow files to LangGraph implementations
Project description
YAML to LangGraph Converter
A powerful tool for converting Defy YAML workflow files to LangGraph implementations with comprehensive validation and beautiful CLI output.
Features
- ๐ YAML Schema Validation: Comprehensive validation of workflow structure
- ๐จ Rich CLI Interface: Beautiful command-line interface with Click
- โก Fast Conversion: Efficient parsing and code generation
- ๐งช Comprehensive Testing: Full test suite with pytest
- ๐ฆ Modern Packaging: Standard Python package structure
- ๐ ๏ธ Extensible: Easy to customize and extend
Installation
From Source
git clone https://github.com/example/yaml-to-langgraph.git
cd yaml-to-langgraph
pip install -e .
With Development Dependencies
pip install -e ".[dev]"
With LangChain Dependencies
pip install -e ".[langchain]"
Usage
Command Line Interface
# Validate Defy YAML workflow
yaml-to-langgraph validate workflow.yml
# Convert Defy YAML to LangGraph
yaml-to-langgraph convert workflow.yml
# Convert with custom output directory
yaml-to-langgraph convert workflow.yml -o my_workflow
# List nodes without generating code
yaml-to-langgraph list-nodes workflow.yml
# Dry run to see what would be generated
yaml-to-langgraph dry-run workflow.yml
# Get help
yaml-to-langgraph --help
Python API
from yaml_to_langgraph import YAMLToLangGraphConverter
# Convert YAML workflow
converter = YAMLToLangGraphConverter("workflow.yml", "output_dir")
output_path = converter.convert()
Development
Setup Development Environment
# Clone repository
git clone https://github.com/example/yaml-to-langgraph.git
cd yaml-to-langgraph
# Install in development mode
pip install -e ".[dev]"
# Run tests
pytest tests/ -v
# Run with coverage
pytest tests/ --cov=src/yaml_to_langgraph --cov-report=html
Code Quality
# Format code
black src/ tests/
# Sort imports
isort src/ tests/
# Lint code
ruff check src/ tests/
# Type checking
mypy src/
Project Structure
yaml_to_langgraph/
โโโ src/
โ โโโ yaml_to_langgraph/
โ โโโ __init__.py
โ โโโ cli.py # Command-line interface
โ โโโ converter.py # Main converter logic
โ โโโ schema_validator.py # YAML validation
โ โโโ yaml_parser.py # YAML parsing
โ โโโ code_generator.py # Code generation
โโโ tests/
โ โโโ __init__.py
โ โโโ conftest.py
โ โโโ test_sample_workflow.py
โ โโโ test_cli.py
โ โโโ test_converter.py
โ โโโ test_schema_validation.py
โโโ pyproject.toml
โโโ README.md
Testing
The project includes a comprehensive test suite with 41 tests covering:
- Schema Validation: YAML structure validation
- CLI Functionality: Command-line interface testing
- Core Converter: Conversion logic testing
- Sample Workflow: Real-world workflow testing
# Run all tests
pytest tests/ -v
# Run specific test categories
pytest tests/test_schema_validation.py -v
pytest tests/test_cli.py -v
pytest tests/test_converter.py -v
pytest tests/test_sample_workflow.py -v
Publishing
The package can be published to PyPI using several methods:
Using UV (Recommended)
# Build the package
make build
# Publish with environment variables
export UV_PUBLISH_USERNAME=your-username
export UV_PUBLISH_PASSWORD=your-password
make publish
# Or publish with token
make publish-token TOKEN=your-pypi-token
# Publish to Test PyPI first
make publish-test TOKEN=your-testpypi-token
Using Twine (Fallback)
If you prefer to use your existing ~/.pypirc configuration:
# Build the package
make build
# Publish using twine (reads ~/.pypirc)
make publish-twine
# Publish to Test PyPI using twine
make publish-test-twine
Manual Publishing
# Build
uv build
# Publish with uv
uv publish --token your-token
# Or with twine
python -m twine upload dist/*
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
License
MIT License - see LICENSE file for details.
Support
- Issues: GitHub Issues
- Documentation: GitHub Wiki
- Discussions: GitHub Discussions
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file yaml_to_langgraph-1.0.0.tar.gz.
File metadata
- Download URL: yaml_to_langgraph-1.0.0.tar.gz
- Upload date:
- Size: 24.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
84b615dfbb06d351d0eb1abab1e0e8ff48326967d278d46ed73f14776f30cb1f
|
|
| MD5 |
f21eda0bd2f639b25bbb94d7fc16abd3
|
|
| BLAKE2b-256 |
a4e7680c3f3dee41bb117e9cf1a6aa9c465935795afe232210bf814279ce78e8
|
File details
Details for the file yaml_to_langgraph-1.0.0-py3-none-any.whl.
File metadata
- Download URL: yaml_to_langgraph-1.0.0-py3-none-any.whl
- Upload date:
- Size: 20.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d3a7808b8943291efa28040a97a680f50d5f97886db8aecca2d484ba9a181c36
|
|
| MD5 |
28ddd0ffb013f68827e6a976e0542bf3
|
|
| BLAKE2b-256 |
135a6889c865cda12138fd21d7fc2c7b8de6cdf7e7609053d1250d72bbdc146c
|