-
Notifications
You must be signed in to change notification settings - Fork 41
Cleaning exospherehost python sdk and adding first exospherehost runtime #141
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
Cleaning exospherehost python sdk and adding first exospherehost runtime #141
Conversation
|
Warning Rate limit exceeded@NiveditJain has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 11 minutes and 23 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe changes refactor node execution and registration in the Exosphere Python SDK. The Changes
Sequence Diagram(s)sequenceDiagram
participant Runtime
participant NodeClass
participant NodeInstance
Runtime->>NodeClass: Instantiate NodeInstance
Runtime->>NodeInstance: Call _execute(inputs)
NodeInstance->>NodeInstance: Set self.inputs = inputs
NodeInstance->>NodeInstance: Call execute()
NodeInstance-->>Runtime: Return Outputs/List[Outputs]
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 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. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Fixes #139 |
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: 4
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (4)
python-sdk/exospherehost/node/BaseNode.py(2 hunks)python-sdk/exospherehost/runtime.py(11 hunks)python-sdk/sample.py(1 hunks)state-manager/app/controller/create_states.py(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
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.
🔇 Additional comments (7)
state-manager/app/controller/create_states.py (1)
23-24: Good defensive initialization of the error field.Explicitly initializing
error=Noneensures the field is always present in the state object, preventing potential AttributeError or KeyError issues downstream. This aligns well with the enhanced error handling in the runtime.python-sdk/sample.py (2)
11-13: Correctly adapted to the new BaseNode interface.The
executemethod properly usesself.inputsinstead of parameters, aligning with the updated BaseNode architecture.
15-19: Clean runtime instantiation with the new API.The simplified runtime creation with direct node class passing and immediate start is more intuitive than the previous multi-step process.
python-sdk/exospherehost/node/BaseNode.py (1)
57-78: Good use of NotImplementedError for abstract method.Changing from
passtoraise NotImplementedErroris a better practice as it provides clear feedback when subclasses forget to implement the required method.python-sdk/exospherehost/runtime.py (3)
50-66: Constructor properly initializes nodes list.The updated constructor correctly requires nodes at initialization time, which is a cleaner API than the previous approach of adding nodes later.
149-164: Clean implementation of node registration.The simplified registration using class names instead of unique instance names makes the API cleaner and more predictable. The validation ensures all nodes are properly configured before registration.
195-196: Good defensive programming with safe dictionary access.Using
data.get("states", [])prevents KeyError if the response doesn't contain a "states" key.
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: 3
🔭 Outside diff range comments (2)
python-sdk/exospherehost/node/BaseNode.py (1)
56-77: Update execute method docstring to reflect new signatureThe
executemethod docstring still documents aninputsparameter that no longer exists in the method signature. Update it to reflect that inputs are now accessed viaself.inputs.async def execute(self) -> Outputs | List[Outputs]: """ Execute the node's main logic. This is the core method that must be implemented by all concrete node classes. - It receives inputs, processes them according to the node's logic, and returns + It processes inputs (accessible via self.inputs) according to the node's logic, and returns outputs. The method can return either a single Outputs instance or a list of Outputs instances for batch processing. - Args: - inputs (Inputs): The input data for this execution, validated against - the Inputs model defined by the node. - Returns: Outputs | List[Outputs]: The output data from this execution. Can be a single Outputs instance or a list of Outputs instances.python-sdk/exospherehost/runtime.py (1)
120-139: Fix class name reference in register methodThe register method has the same issue with
node.__class__.__name__returning "type" for class objects.async def _register(self): """ Register node schemas and runtime metadata with the state manager. Raises: RuntimeError: If registration fails. """ async with ClientSession() as session: endpoint = self._get_register_endpoint() body = { "runtime_name": self._name, "runtime_namespace": self._namespace, "nodes": [ { - "name": node.__class__.__name__, + "name": node.__name__, "namespace": self._namespace, "inputs_schema": node.Inputs.model_json_schema(), "outputs_schema": node.Outputs.model_json_schema(), } for node in self._nodes ] }
♻️ Duplicate comments (2)
python-sdk/exospherehost/runtime.py (2)
226-260: Fix all class name references in validation error messagesAll error messages incorrectly use
node.__class__.__name__whennodeis already a class, returning "type" instead of the actual class name.def _validate_nodes(self): """ Validate that all provided nodes are valid BaseNode subclasses. Args: nodes (List[type[BaseNode]]): List of node classes to validate. Returns: List[type[BaseNode]]: The validated list of node classes. Raises: ValidationError: If any node is invalid or duplicate class names are found. """ errors = [] for node in self._nodes: if not issubclass(node, BaseNode): - errors.append(f"{node.__class__.__name__} does not inherit from exospherehost.BaseNode") + errors.append(f"{node.__name__} does not inherit from exospherehost.BaseNode") if not hasattr(node, "Inputs"): - errors.append(f"{node.__class__.__name__} does not have an Inputs class") + errors.append(f"{node.__name__} does not have an Inputs class") if not hasattr(node, "Outputs"): - errors.append(f"{node.__class__.__name__} does not have an Outputs class") + errors.append(f"{node.__name__} does not have an Outputs class") if not issubclass(node.Inputs, BaseModel): - errors.append(f"{node.__class__.__name__} does not have an Inputs class that inherits from pydantic.BaseModel") + errors.append(f"{node.__name__} does not have an Inputs class that inherits from pydantic.BaseModel") if not issubclass(node.Outputs, BaseModel): - errors.append(f"{node.__class__.__name__} does not have an Outputs class that inherits from pydantic.BaseModel") + errors.append(f"{node.__name__} does not have an Outputs class that inherits from pydantic.BaseModel") # Find nodes with the same __class__.__name__ - class_names = [node.__class__.__name__ for node in self._nodes] + class_names = [node.__name__ for node in self._nodes] duplicate_class_names = [name for name in set(class_names) if class_names.count(name) > 1] if duplicate_class_names: errors.append(f"Duplicate node class names found: {duplicate_class_names}") if len(errors) > 0: raise ValidationError("Following errors while validating nodes: " + "\n".join(errors))
274-274: Consider caching node instances for better performanceCreating a new node instance for each execution ensures isolation but may impact performance for high-throughput scenarios.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
python-sdk/exospherehost/node/BaseNode.py(4 hunks)python-sdk/exospherehost/runtime.py(10 hunks)
🔇 Additional comments (2)
python-sdk/exospherehost/node/BaseNode.py (1)
48-54: Good implementation of the_executewrapper methodThe
_executemethod properly sets inputs before calling the parameterlessexecutemethod. The type annotation concern from previous reviews has been addressed by declaringself.inputsin__init__.python-sdk/exospherehost/runtime.py (1)
181-181: Good defensive programming practiceUsing
.get("states", [])prevents KeyError if the "states" key is missing from the response.
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
♻️ Duplicate comments (1)
python-sdk/exospherehost/node/BaseNode.py (1)
20-27: Update docstring to match current constructor signature.The constructor no longer accepts any parameters, but the docstring formatting still suggests parameter documentation structure. Consider simplifying the docstring.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
python-sdk/exospherehost/node/BaseNode.py(1 hunks)
🔇 Additional comments (1)
python-sdk/exospherehost/node/BaseNode.py (1)
45-56: Well-designed internal execution method.The
_executemethod provides a clean separation between input validation/assignment and the actual node logic, following good design principles.
- Created .gitignore to exclude unnecessary files. - Added .python-version to specify Python version 3.12. - Implemented main.py to load environment variables and start the runtime. - Defined project metadata in pyproject.toml with dependencies. - Created README.md and uv.lock for project documentation and dependency locking. - Added nodes package with ListS3FilesNode to list files in S3 buckets.
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: 8
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (1)
exosphere-runtimes/cloud-storage-runtime/uv.lockis excluded by!**/*.lock
📒 Files selected for processing (6)
exosphere-runtimes/cloud-storage-runtime/.gitignore(1 hunks)exosphere-runtimes/cloud-storage-runtime/.python-version(1 hunks)exosphere-runtimes/cloud-storage-runtime/main.py(1 hunks)exosphere-runtimes/cloud-storage-runtime/nodes/list_s3_files.py(1 hunks)exosphere-runtimes/cloud-storage-runtime/pyproject.toml(1 hunks)python-sdk/exospherehost/_version.py(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 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:
exosphere-runtimes/cloud-storage-runtime/.python-versionpython-sdk/exospherehost/_version.pyexosphere-runtimes/cloud-storage-runtime/pyproject.toml
📚 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.py
🔇 Additional comments (3)
python-sdk/exospherehost/_version.py (1)
1-1: Version bump looks correct—confirm ancillary artefacts get updated as well.The bump from
0.0.7b0→0.0.7b1is straightforward.
Please ensure the same version is reflected in:•
pyproject.toml/setup.cfg(if present) so the published package isn’t inconsistent.
• Any Docker image tags / CI deployment scripts that parse the version string.
• CHANGELOG / release notes, to surface the breaking node-execution API changes described in the PR.No code issues spotted here.
exosphere-runtimes/cloud-storage-runtime/.gitignore (1)
1-66: LGTM!Comprehensive .gitignore file with appropriate exclusions for Python development, environment files, and IDE-specific artifacts. The gitkeep exceptions are well thought out.
exosphere-runtimes/cloud-storage-runtime/main.py (1)
1-14: LGTM!Clean runtime setup with proper environment variable loading and node registration. The structure follows expected patterns for the exosphere runtime framework.
…Jain/exospherehost into bringing-it-all-together
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: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
python-sdk/README.md(2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 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/README.md
📚 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/README.md
🪛 LanguageTool
python-sdk/README.md
[grammar] ~7-~7: Use correct spacing
Context: ...tateful applications using a node-based architecture. ## Overview ExosphereHost provides a robus...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~11-~11: There might be a mistake here.
Context: ...s and agents. The Python SDK allows you to: - Create distributed workflows using a si...
(QB_NEW_EN_OTHER)
[grammar] ~13-~13: There might be a mistake here.
Context: ...ted workflows using a simple node-based architecture - Build stateful applications that can sca...
(QB_NEW_EN_OTHER)
[grammar] ~14-~14: There might be a mistake here.
Context: ... that can scale across multiple compute resources - Execute complex AI workflows with automa...
(QB_NEW_EN_OTHER)
[grammar] ~15-~15: There might be a mistake here.
Context: ...mplex AI workflows with automatic state management - Integrate with the ExosphereHost platfor...
(QB_NEW_EN_OTHER)
[grammar] ~16-~16: There might be a problem here.
Context: ...he ExosphereHost platform for optimized performance ## Installation bash pip install exospherehost ## Quick Start ### Basic Node Creation Cr...
(QB_NEW_EN_MERGED_MATCH)
[grammar] ~24-~24: Use correct spacing
Context: ...pip install exospherehost ``` ## Quick Start ### Basic Node Creation Create a simple nod...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~26-~26: Use correct spacing
Context: ...ost ``` ## Quick Start ### Basic Node Creation Create a simple node that processes data...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~28-~28: There might be a mistake here.
Context: ...on Create a simple node that processes data: python from exospherehost import Runtime, BaseNode from pydantic import BaseModel class SampleNode(BaseNode): class Inputs(BaseModel): name: str data: dict class Outputs(BaseModel): message: str processed_data: dict async def execute(self) -> Outputs: print(f"Processing data for: {self.inputs.name}") # Your processing logic here processed_data = {"status": "completed", "input": self.inputs.data} return self.Outputs( message="success", processed_data=processed_data ) # Initialize the runtime Runtime( namespace="MyProject", name="DataProcessor", nodes=[SampleNode] ).start() ## Environme...
(QB_NEW_EN_OTHER)
[grammar] ~60-~60: Use correct spacing
Context: ...mpleNode] ).start() ``` ## Environment Configuration The SDK requires the following environme...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~62-~62: There might be a mistake here.
Context: ...nment variables for authentication with ExosphereHost: bash export EXOSPHERE_STATE_MANAGER_URI="your-state-manager-uri" export EXOSPHERE_API_KEY="your-api-key" ## Key Features - **Distributed Exec...
(QB_NEW_EN_OTHER)
[grammar] ~69-~69: Use correct spacing
Context: ...HERE_API_KEY="your-api-key" ``` ## Key Features - Distributed Execution: Run nodes acros...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~71-~71: There might be a mistake here.
Context: ...on**: Run nodes across multiple compute resources - State Management: Automatic state pers...
(QB_NEW_EN_OTHER)
[grammar] ~72-~72: There might be a mistake here.
Context: ...ment**: Automatic state persistence and recovery - Type Safety: Full Pydantic integration...
(QB_NEW_EN_OTHER)
[grammar] ~73-~73: There might be a mistake here.
Context: ...l Pydantic integration for input/output validation - Async Support: Native async/await supp...
(QB_NEW_EN_OTHER)
[grammar] ~74-~74: There might be a mistake here.
Context: ...sync/await support for high-performance operations - Error Handling: Built-in retry mechani...
(QB_NEW_EN_OTHER)
[grammar] ~75-~75: There might be a mistake here.
Context: ...**: Built-in retry mechanisms and error recovery - Scalability: Designed for high-volume ...
(QB_NEW_EN_OTHER)
[grammar] ~76-~76: There might be a problem here.
Context: ...ed for high-volume batch processing and workflows ## Architecture The SDK is built around two core concept...
(QB_NEW_EN_MERGED_MATCH)
[grammar] ~80-~80: There might be a mistake here.
Context: ...cture The SDK is built around two core concepts: ### Runtime The Runtime class manages the...
(QB_NEW_EN_OTHER)
[grammar] ~87-~87: Use correct spacing
Context: ... Error handling and recovery - Resource allocation ### Nodes Nodes are the building blocks of y...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~94-~94: Use correct spacing
Context: ...workflows - Automatically handles state persistence ## Advanced Usage ### Custom Node Configur...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~96-~96: Use correct spacing
Context: ... handles state persistence ## Advanced Usage ### Custom Node Configuration ```python cla...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~98-~98: Use correct spacing
Context: ...nce ## Advanced Usage ### Custom Node Configuration python class ConfigurableNode(BaseNode): class Inputs(BaseModel): text: str max_length: int = 100 class Outputs(BaseModel): result: str length: int async def execute(self) -> Outputs: result = self.inputs.text[:self.inputs.max_length] return self.Outputs(result=result, length=len(result)) ### Error Handling ```python class RobustNo...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~115-~115: Use correct spacing
Context: ...ult, length=len(result)) ### Error Handling python class RobustNode(BaseNode): class Inputs(BaseModel): data: str class Outputs(BaseModel): success: bool result: str async def execute(self) -> Outputs: raise Exception("This is a test error") ``` Error handling is automatically handled ...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~129-~129: Use correct spacing
Context: ...ly handled by the runtime and the state manager. ## Integration with ExosphereHost Platform ...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~131-~131: Use correct spacing
Context: ...ger. ## Integration with ExosphereHost Platform The Python SDK integrates seamlessly wit...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~133-~133: There might be a mistake here.
Context: ...lessly with the ExosphereHost platform, providing: - Cost Optimization: Leverage ExosphereH...
(QB_NEW_EN_OTHER)
[grammar] ~135-~135: There might be a mistake here.
Context: ...zed infrastructure for significant cost savings - Reliability: Built-in fault tolerance ...
(QB_NEW_EN_OTHER)
[grammar] ~136-~136: There might be a mistake here.
Context: ... Built-in fault tolerance and automatic recovery - Scalability: Automatic scaling based o...
(QB_NEW_EN_OTHER)
[grammar] ~137-~137: There might be a mistake here.
Context: ...**: Automatic scaling based on workload demands - Monitoring: Integrated logging and mon...
(QB_NEW_EN_OTHER)
[grammar] ~138-~138: There might be a problem here.
Context: ...ng**: Integrated logging and monitoring capabilities ## Documentation For more detailed information, visit our...
(QB_NEW_EN_MERGED_MATCH)
[grammar] ~146-~146: Use correct spacing
Context: ...herehost/blob/main/CONTRIBUTING.md) for details. ## Support For support and questions: - **...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~157-~157: Correctly pair commas and coordinating conjunctions
Context: ...nse This SDK is licensed under the MIT License and the main project is licensend under...
(QB_NEW_EN_OTHER_ERROR_IDS_14)
[grammar] ~157-~157: Ensure spelling is correct
Context: ...the MIT License and the main project is licensend under Elastic License 2.0.
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
🪛 markdownlint-cli2 (0.17.2)
python-sdk/README.md
82-82: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
84-84: Lists should be surrounded by blank lines
(MD032, blanks-around-lists)
89-89: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
91-91: Lists should be surrounded by blank lines
(MD032, blanks-around-lists)
128-128: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
151-151: Lists should be surrounded by blank lines
(MD032, blanks-around-lists)
157-157: Files should end with a single newline character
(MD047, single-trailing-newline)
No description provided.