Skip to content

Conversation

@arminhammer
Copy link

Many thanks for submitting your Pull Request ❤️!

What this PR does / why we need it:
This PR addresses #26 . This repo has not been updated in quite some time, and the python SDK is not terribly useful at the moment because it is still pointing to 0.8. This PR updates the SDK to the 1.0 spec, and also updates the repo to use more modern python tooling and standards, like pyproject.toml and uv.

This PR makes the following changes:

  • deprecate the existing codebase around the 0.8 specification, replacing it with the 1.0 spec
  • replace pipenv with uv and pyproject.toml
  • add and enforce the ruff and mypy linter
  • replace pygraphviz with pydot to remove a C++ compilation dependency
  • add the specification repo as a git submodule
    -- add unit tests to validate parsing all examples
    -- add unit tests to create all examples in python, and serialize correctly to the yaml examples
    -- add unit tests to validate creating dot files for all examples
  • add a .pre-commit-hook.yaml file
  • bump the minimum Python version to 3.10
  • update Github Action workflows

Special notes for reviewers:
Apologies in advance for such a large PR! Given the nature of the move from 0.8 and 1.0, it was hard to rework the repo without reworking the entire codebase. I also acknowledge making some opinionated changes, so I welcome feedback if there are things that should be changed or addressed to more closely align to project goals.

Additional information (if needed):

Complete rewrite of the Python SDK to conform to the Serverless Workflow
specification v1.0, replacing the previous v0.8 implementation.

- Replace WorkflowValidator with automatic parsing validation
- `base.py`: New base types (Duration, Error, Timeout, Input/Output, etc.)
- `authentication.py`: OAuth2, OIDC, Bearer, Basic, Digest auth policies
- `call_tasks.py`: HTTP, gRPC, OpenAPI, AsyncAPI, MCP function calls
- `tasks.py`: Core task types (Do, Fork, For, Listen, Emit, Set, Switch, Try, Wait, Run, Raise)
- `events.py`: Event consumption strategies and correlation
- `retry.py`: Retry policies with backoff strategies
- `endpoint.py`: Endpoint and catalog definitions
- `draw.py`: Workflow visualization using Graphviz (930 lines)
- `workflow.py`: Rewritten Workflow class with Document, Schedule, Use components
- Replace Pipfile/pipenv with pyproject.toml/uv
- Add pre-commit hooks configuration
- Add specification submodule for validation testing
- Update to Python 3.10+
- Configure ruff for linting/formatting, mypy for type checking
- Modernize GitHub Actions workflow
- Split into separate lint, test, build jobs
- Add ruff linting and formatting checks
- Add mypy type checking
- Test matrix: Python 3.10, 3.11, 3.12
- Use uv for faster dependency management
- Remove old v0.8 test examples (13 JSON files)
- Add comprehensive v1.0 spec validation tests (1,748 lines)
- Add visualization tests with 74 DOT fixtures
- Test against official specification examples via submodule
- Update README for v1.0 API with modern examples
- Replace state-based examples with task-based patterns
- Update installation instructions for uv
- Document workflow visualization capabilities
- Reference new test locations

## Breaking Changes
- Complete API rewrite - no backwards compatibility with v0.8
- All state classes removed
- WorkflowValidator removed (validation now automatic)
- StateMachineHelper replaced with workflow.render_graph()

Signed-off-by: Armin Graf <arminhammer@gmail.com>
Signed-off-by: Armin Graf <arminhammer@gmail.com>
Signed-off-by: Armin Graf <arminhammer@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant