-
Notifications
You must be signed in to change notification settings - Fork 41
Adding flow to Register runtime and Nodes with StateManager #134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding flow to Register runtime and Nodes with StateManager #134
Conversation
📝 WalkthroughSummary by CodeRabbit
WalkthroughThis update introduces comprehensive documentation and type safety improvements to the ExosphereHost Python SDK. The Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Runtime
participant BaseNode
participant StateManager
User->>Runtime: Initialize Runtime(namespace, name)
User->>Runtime: Connect nodes (BaseNode subclasses)
User->>Runtime: Start runtime
loop Polling
Runtime->>StateManager: Fetch new states
StateManager-->>Runtime: Return state batch
Runtime->>BaseNode: execute(inputs: Inputs)
BaseNode-->>Runtime: outputs: Outputs
Runtime->>StateManager: Notify executed(outputs)
alt Error
Runtime->>StateManager: Notify errored
end
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (1)
python-sdk/uv.lockis excluded by!**/*.lock
📒 Files selected for processing (8)
python-sdk/exospherehost/__init__.py(1 hunks)python-sdk/exospherehost/_version.py(1 hunks)python-sdk/exospherehost/node/BaseNode.py(1 hunks)python-sdk/exospherehost/node/__init__.py(1 hunks)python-sdk/exospherehost/node/status.py(1 hunks)python-sdk/exospherehost/runtime.py(9 hunks)python-sdk/pyproject.toml(1 hunks)python-sdk/sample.py(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: NiveditJain
PR: exospherehost/exospherehost#130
File: .github/workflows/ci.yml:22-22
Timestamp: 2025-08-02T12:43:35.075Z
Learning: The exospherehost project requires Python versions > 3.12 for the CI workflow, meaning Python 3.13 or higher should be used despite potential stability concerns with pre-release versions.
Learnt from: NiveditJain
PR: exospherehost/exospherehost#131
File: state-manager/app/models/executed_models.py:0-0
Timestamp: 2025-08-03T04:26:00.148Z
Learning: The exospherehost project is currently in beta phase, so breaking changes in APIs are acceptable and don't require versioning or migration strategies.
📚 Learning: the exospherehost project is currently in beta phase, so breaking changes in apis are acceptable and...
Learnt from: NiveditJain
PR: exospherehost/exospherehost#131
File: state-manager/app/models/executed_models.py:0-0
Timestamp: 2025-08-03T04:26:00.148Z
Learning: The exospherehost project is currently in beta phase, so breaking changes in APIs are acceptable and don't require versioning or migration strategies.
Applied to files:
python-sdk/exospherehost/_version.pypython-sdk/exospherehost/__init__.py
📚 Learning: the exospherehost project requires python versions > 3.12 for the ci workflow, meaning python 3.13 o...
Learnt from: NiveditJain
PR: exospherehost/exospherehost#130
File: .github/workflows/ci.yml:22-22
Timestamp: 2025-08-02T12:43:35.075Z
Learning: The exospherehost project requires Python versions > 3.12 for the CI workflow, meaning Python 3.13 or higher should be used despite potential stability concerns with pre-release versions.
Applied to files:
python-sdk/exospherehost/_version.pypython-sdk/exospherehost/__init__.py
🧬 Code Graph Analysis (4)
python-sdk/exospherehost/node/__init__.py (1)
python-sdk/exospherehost/node/BaseNode.py (1)
BaseNode(6-85)
python-sdk/exospherehost/node/status.py (1)
state-manager/app/models/state_status_enum.py (1)
StateStatusEnum(4-14)
python-sdk/exospherehost/node/BaseNode.py (2)
python-sdk/sample.py (3)
Inputs(6-7)Outputs(9-10)execute(12-14)state-manager/app/models/db/state.py (1)
State(7-14)
python-sdk/exospherehost/runtime.py (2)
python-sdk/exospherehost/node/BaseNode.py (3)
BaseNode(6-85)get_unique_name(73-85)Outputs(40-47)python-sdk/sample.py (1)
Outputs(9-10)
🔇 Additional comments (14)
python-sdk/pyproject.toml (1)
10-10: Confirmpydanticversion string & pin strategy
"pydantic>=2.11.7"assumes that a 2.11.x series already exists. If 2.11.* hasn’t been published yet (or is still a pre-release), installs will fail. Consider either:pydantic>=2.7,<3or verify that 2.11.7 is on PyPI before merging.
python-sdk/sample.py (2)
2-2: LGTM! Excellent adoption of the new typed interface.The Pydantic models are well-defined and demonstrate the proper usage of the new BaseNode pattern with typed inputs and outputs.
Also applies to: 6-11
16-19: LGTM! Proper usage of the new Runtime API.The Runtime instantiation correctly uses the new keyword argument pattern, allowing the runtime to handle configuration from environment variables internally.
python-sdk/exospherehost/node/BaseNode.py (5)
6-18: Excellent comprehensive documentation.The class docstring provides clear guidance on the purpose, usage, and attributes of BaseNode. This will greatly help developers understand how to implement their own nodes.
20-29: Well-designed constructor with proper state management.The addition of the state dictionary is a valuable feature for maintaining node state between executions. The optional unique_name parameter provides good flexibility.
31-47: Excellent use of Pydantic for type safety.The nested Inputs and Outputs models provide a clean foundation for type-safe node implementations. The clear documentation guides developers on how to override these in their subclasses.
49-71: Excellent typed interface with comprehensive documentation.The new execute method signature provides strong type safety while maintaining flexibility for batch processing. The detailed docstring covers all important aspects including error handling.
73-85: Good documentation enhancement for utility method.The added docstring clearly explains the method's behavior and return value logic.
python-sdk/exospherehost/runtime.py (6)
11-33: Outstanding comprehensive documentation.The class docstring and attribute documentation provide an excellent overview of the Runtime's purpose, functionality, and internal structure. This will greatly assist developers in understanding the system.
35-70: Excellent constructor with improved flexibility.The updated constructor provides great flexibility by allowing configuration through environment variables or direct parameters. The comprehensive documentation and parameter validation make it much more user-friendly.
72-94: Excellent separation of concerns with thorough validation.The new private methods demonstrate good software engineering practices by separating environment variable handling from validation logic. The comprehensive validation with clear error messages will help developers troubleshoot configuration issues.
96-106: Good documentation enhancement for utility methods.The added docstrings make these endpoint helper methods more self-documenting and maintainable.
108-224: Robust node validation with excellent error handling.The enhanced connect method and validation logic provide clear feedback for debugging issues. The comprehensive documentation and specific BaseNode inheritance checking improve the developer experience.
164-287: Excellent integration with the new typed BaseNode interface.The updated methods correctly handle the new Pydantic-based outputs using
model_dump(), and the enhanced documentation throughout makes the execution flow much clearer. The start method improvement to return a task when running in an existing event loop is a valuable enhancement.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🔭 Outside diff range comments (1)
python-sdk/exospherehost/runtime.py (1)
35-65: Fix parameter name typo.The parameter
state_manage_versionshould bestate_manager_versionto maintain consistency with the attribute name_state_manager_version.-def __init__(self, namespace: str, name: str, state_manager_uri: str | None = None, key: str | None = None, batch_size: int = 16, workers: int = 4, state_manage_version: str = "v0", poll_interval: int = 1): +def __init__(self, namespace: str, name: str, state_manager_uri: str | None = None, key: str | None = None, batch_size: int = 16, workers: int = 4, state_manager_version: str = "v0", poll_interval: int = 1):Also update line 65:
-self._state_manager_version = state_manage_version +self._state_manager_version = state_manager_version
♻️ Duplicate comments (1)
python-sdk/sample.py (1)
5-13: Implementation correctly follows the new typed interface.The SampleNode properly implements the new Pydantic-based input/output models and the updated execute method signature. The BaseModel import and model definitions are correct.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (7)
python-sdk/README.md(1 hunks)python-sdk/exospherehost/__init__.py(1 hunks)python-sdk/exospherehost/_version.py(1 hunks)python-sdk/exospherehost/node/__init__.py(1 hunks)python-sdk/exospherehost/node/status.py(1 hunks)python-sdk/exospherehost/runtime.py(8 hunks)python-sdk/sample.py(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: NiveditJain
PR: exospherehost/exospherehost#130
File: .github/workflows/ci.yml:22-22
Timestamp: 2025-08-02T12:43:35.075Z
Learning: The exospherehost project requires Python versions > 3.12 for the CI workflow, meaning Python 3.13 or higher should be used despite potential stability concerns with pre-release versions.
Learnt from: NiveditJain
PR: exospherehost/exospherehost#131
File: state-manager/app/models/executed_models.py:0-0
Timestamp: 2025-08-03T04:26:00.148Z
Learning: The exospherehost project is currently in beta phase, so breaking changes in APIs are acceptable and don't require versioning or migration strategies.
📚 Learning: the exospherehost project is currently in beta phase, so breaking changes in apis are acceptable and...
Learnt from: NiveditJain
PR: exospherehost/exospherehost#131
File: state-manager/app/models/executed_models.py:0-0
Timestamp: 2025-08-03T04:26:00.148Z
Learning: The exospherehost project is currently in beta phase, so breaking changes in APIs are acceptable and don't require versioning or migration strategies.
Applied to files:
python-sdk/exospherehost/_version.pypython-sdk/exospherehost/__init__.py
📚 Learning: the exospherehost project requires python versions > 3.12 for the ci workflow, meaning python 3.13 o...
Learnt from: NiveditJain
PR: exospherehost/exospherehost#130
File: .github/workflows/ci.yml:22-22
Timestamp: 2025-08-02T12:43:35.075Z
Learning: The exospherehost project requires Python versions > 3.12 for the CI workflow, meaning Python 3.13 or higher should be used despite potential stability concerns with pre-release versions.
Applied to files:
python-sdk/exospherehost/_version.pypython-sdk/exospherehost/__init__.py
🧬 Code Graph Analysis (2)
python-sdk/exospherehost/node/__init__.py (2)
python-sdk/exospherehost/node/BaseNode.py (2)
BaseNode(6-85)BaseNode(5-17)python-sdk/exospherehost/node/status.py (1)
Status(11-44)
python-sdk/exospherehost/node/status.py (2)
state-manager/app/models/state_status_enum.py (1)
StateStatusEnum(4-14)state-manager/app/models/executed_models.py (1)
ExecutedResponseModel(9-10)
🔇 Additional comments (14)
python-sdk/exospherehost/_version.py (1)
1-1: PEP 440 compliance issue resolved.The version string now correctly includes the numeric suffix "0" making "0.0.6b0" compliant with PEP 440 standards, addressing the previous review feedback.
python-sdk/exospherehost/__init__.py (1)
1-35: Excellent comprehensive documentation with working example.The module docstring provides clear documentation of the SDK's purpose and components. The example correctly demonstrates the new typed node interface with Pydantic models and the updated Runtime constructor signature. The BaseModel import is properly included, addressing previous feedback.
python-sdk/exospherehost/node/__init__.py (1)
13-16: Clean resolution of import/export issues.The explicit imports and properly maintained
__all__list address the previous concerns about star-import namespace pollution. The module now provides clear, controlled access toBaseNodeandStatus.python-sdk/exospherehost/node/status.py (1)
11-44: Excellent implementation of type-safe status enum.The conversion from plain string constants to a
Statusenum addresses the previous feedback perfectly. The implementation provides type safety, IDE autocompletion, and clear documentation. The status values are consistent with the state-manager'sStateStatusEnum, ensuring compatibility across the system.python-sdk/sample.py (1)
15-18: Runtime initialization updated correctly.The Runtime constructor now uses the new signature with
namespaceandnameparameters, which aligns with the enhanced configuration approach described in the PR objectives.python-sdk/README.md (3)
8-17: Good adoption of Pydantic for type safety!The introduction of Pydantic models for inputs and outputs provides strong type validation and improves the developer experience with better IDE support and runtime validation.
18-20: Type-safe method signature improves maintainability.The updated
executemethod signature with typed inputs and outputs ensures compile-time type checking and better documentation of the expected data structures.
22-26: Clear documentation of environment variable requirements.The comment helpfully documents the required environment variables, and the simplified initialization improves usability by reducing boilerplate code.
python-sdk/exospherehost/runtime.py (6)
1-33: Excellent documentation additions!The comprehensive class docstring and attribute documentation significantly improve code maintainability and developer experience.
72-94: Well-structured configuration and validation logic.The separation of environment variable loading and validation into dedicated methods improves code organization. The validation provides clear error messages for debugging.
108-124: Good validation in connect method.The added documentation and explicit validation of nodes improves the robustness of the runtime setup.
243-244: Good handling of single output case.The addition of the isinstance check properly handles nodes that return a single output object rather than a list, improving API flexibility.
271-286: Flexible start method implementation.The updated start method elegantly handles both async and sync contexts, making the runtime more versatile for different use cases.
164-174: No action needed:BaseNode.Outputsis defined and correctly used.Verified that
BaseNodeincludes a nestedOutputsclass subclassingBaseModel. TheList[BaseNode.Outputs]annotation and use ofmodel_dump()are both valid.
✅ Actions performedReview triggered.
|
No description provided.