Skip to main content

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

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Ensure all tests pass
  6. Submit a pull request

License

MIT License - see LICENSE file for details.

Support

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

yaml_to_langgraph-1.0.0.tar.gz (24.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yaml_to_langgraph-1.0.0-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

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

Hashes for yaml_to_langgraph-1.0.0.tar.gz
Algorithm Hash digest
SHA256 84b615dfbb06d351d0eb1abab1e0e8ff48326967d278d46ed73f14776f30cb1f
MD5 f21eda0bd2f639b25bbb94d7fc16abd3
BLAKE2b-256 a4e7680c3f3dee41bb117e9cf1a6aa9c465935795afe232210bf814279ce78e8

See more details on using hashes here.

File details

Details for the file yaml_to_langgraph-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for yaml_to_langgraph-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d3a7808b8943291efa28040a97a680f50d5f97886db8aecca2d484ba9a181c36
MD5 28ddd0ffb013f68827e6a976e0542bf3
BLAKE2b-256 135a6889c865cda12138fd21d7fc2c7b8de6cdf7e7609053d1250d72bbdc146c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page