Skip to content

Conversation

@jake-valsamis
Copy link
Contributor

  • add app panel parameters to capsule API
  • add custom metadata API
  • add last_accessed field to capsule
  • add archive and delete capsule APIs

@jake-valsamis jake-valsamis requested review from Copilot and zvikagart and removed request for Copilot August 29, 2025 02:51
Copilot AI review requested due to automatic review settings August 29, 2025 18:01
Copy link

Copilot AI left a 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.

Comment on lines +390 to +394
categories: Optional[AppPanelCategories] = dataclass_field(
default=None,
metadata={"description": "Categories for the pipeline process's app panel parameters."}
)
parameters: Optional[AppPanelParameters] = dataclass_field(
Copy link

Copilot AI Aug 29, 2025

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.

Suggested change
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(

Copilot uses AI. Check for mistakes.
Comment on lines +444 to +446
def delete_capsule(self, capsule_id: str):
"""Delete a capsule permanently."""
self.client.delete(f"capsules/{capsule_id}")
Copy link

Copilot AI Aug 29, 2025

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.

Suggested change
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()

Copilot uses AI. Check for mistakes.
Comment on lines +88 to +91
def get_custom_metadata(self) -> CustomMetadata:
"""Retrieve the Code Ocean deployment's custom metadata schema."""
res = self.client.get("custom_metadata")

Copy link

Copilot AI Aug 29, 2025

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.

Suggested change
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()

Copilot uses AI. Check for mistakes.
@zvikagart zvikagart merged commit 59306a0 into main Sep 1, 2025
1 check passed
@zvikagart zvikagart deleted the version-3-9 branch September 1, 2025 00:09
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.

4 participants