feat: add Git sync support for capsules and pipelines#71
Merged
Conversation
Expose the v4.6 Git sync public API through the SDK via Capsules.sync_capsule and Pipelines.sync_pipeline, returning a GitSyncResults model (pushed, pulled, new_branch). Bump MIN_SERVER_VERSION to 4.6.0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR adds first-class SDK support for the Code Ocean v4.6 Git sync endpoints so users can trigger sync operations for capsules and pipelines and receive structured sync results back from the API.
Changes:
- Added
Capsules.sync_capsule()andPipelines.sync_pipeline()to call the new/:id/syncendpoints and deserialize the response. - Introduced a
GitSyncResultsmodel with safe zero/false defaults to handle empty{}responses. - Bumped the SDK
MIN_SERVER_VERSIONheader to4.6.0and added unit tests for capsule sync, default deserialization, and pipeline delegation.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
tests/test_git_sync.py |
Adds unit tests covering capsule sync parsing, empty-body defaults, and pipeline route delegation. |
src/codeocean/pipeline.py |
Adds sync_pipeline() that delegates to the shared capsules client configured for the pipelines route. |
src/codeocean/models/capsule.py |
Introduces the GitSyncResults dataclass model returned by sync endpoints. |
src/codeocean/client.py |
Updates MIN_SERVER_VERSION to 4.6.0 for the API header. |
src/codeocean/capsule.py |
Adds sync_capsule() to POST to /{id}/sync and deserialize into GitSyncResults. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ramdayan
approved these changes
Jun 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Exposes the Code Ocean v4.6 Git sync public API through the SDK so users can trigger and observe Git sync operations programmatically.
client.capsules.sync_capsule(capsule_id)→POST /capsules/:id/syncclient.pipelines.sync_pipeline(pipeline_id)→POST /pipelines/:id/sync(delegates to the capsules client, matching the existing pattern)Both return a new
GitSyncResultsmodel:pushedintpulledintnew_branchboolAll fields default to
0/False, so an empty{}body (the server omits zero-valued fields) deserializes cleanly. Errors (e.g. not-linked400, missing-creds/uncommitted403, locked423) surface through the SDK's existing error handler ascodeocean.Error.MIN_SERVER_VERSIONis bumped to4.6.0.🤖 Generated with Claude Code