-
Notifications
You must be signed in to change notification settings - Fork 4
feat: Code Ocean version 3.9 functionality #54
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
Conversation
jake-valsamis
commented
Aug 29, 2025
- add app panel parameters to capsule API
- add custom metadata API
- add last_accessed field to capsule
- add archive and delete capsule APIs
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.
Pull Request Overview
This PR adds Code Ocean version 3.9 functionality to the Python SDK, expanding API capabilities for custom metadata, capsule management, and app panel parameters.
- Introduces comprehensive custom metadata schema API with field types, ranges, and validation rules
- Adds extensive app panel parameter support for capsules including categories, data assets, and configuration options
- Extends capsule management with archive/delete operations and last accessed timestamp tracking
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/codeocean/custom_metadata.py | New module implementing custom metadata schema API with field definitions and client |
| src/codeocean/client.py | Updates minimum server version to 3.9.0 and integrates custom metadata client |
| src/codeocean/capsule.py | Adds app panel data structures, archive/delete methods, and last_accessed field |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| categories: Optional[AppPanelCategories] = dataclass_field( | ||
| default=None, | ||
| metadata={"description": "Categories for the pipeline process's app panel parameters."} | ||
| ) | ||
| parameters: Optional[AppPanelParameters] = dataclass_field( |
Copilot
AI
Aug 29, 2025
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.
The categories and parameters fields should be lists, not single objects. Based on the AppPanel class structure, these should be Optional[list[AppPanelCategories]] and Optional[list[AppPanelParameters]] respectively to match the pattern used elsewhere.
| categories: Optional[AppPanelCategories] = dataclass_field( | |
| default=None, | |
| metadata={"description": "Categories for the pipeline process's app panel parameters."} | |
| ) | |
| parameters: Optional[AppPanelParameters] = dataclass_field( | |
| categories: Optional[list[AppPanelCategories]] = dataclass_field( | |
| default=None, | |
| metadata={"description": "Categories for the pipeline process's app panel parameters."} | |
| ) | |
| parameters: Optional[list[AppPanelParameters]] = dataclass_field( |
| def delete_capsule(self, capsule_id: str): | ||
| """Delete a capsule permanently.""" | ||
| self.client.delete(f"capsules/{capsule_id}") |
Copilot
AI
Aug 29, 2025
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.
The delete_capsule method should validate the HTTP response status. Without checking the response, the method will silently fail if the deletion is unsuccessful, making it difficult to detect errors.
| def delete_capsule(self, capsule_id: str): | |
| """Delete a capsule permanently.""" | |
| self.client.delete(f"capsules/{capsule_id}") | |
| res = self.client.delete(f"capsules/{capsule_id}") | |
| res.raise_for_status() |
| def get_custom_metadata(self) -> CustomMetadata: | ||
| """Retrieve the Code Ocean deployment's custom metadata schema.""" | ||
| res = self.client.get("custom_metadata") | ||
|
|
Copilot
AI
Aug 29, 2025
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.
The get_custom_metadata method should validate the HTTP response status before attempting to parse JSON. Without checking res.status_code or using res.raise_for_status(), the method may fail silently or raise unclear exceptions on API errors.
| def get_custom_metadata(self) -> CustomMetadata: | |
| """Retrieve the Code Ocean deployment's custom metadata schema.""" | |
| res = self.client.get("custom_metadata") | |
| res.raise_for_status() |