Skip to content

feat: add Git sync support for capsules and pipelines - #71

Merged
zvikagart merged 1 commit into
mainfrom
add-git-sync-support
Jun 8, 2026
Merged

feat: add Git sync support for capsules and pipelines#71
zvikagart merged 1 commit into
mainfrom
add-git-sync-support

Conversation

@zvikagart

@zvikagartzvikagart commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

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/sync
  • client.pipelines.sync_pipeline(pipeline_id)POST /pipelines/:id/sync (delegates to the capsules client, matching the existing pattern)

Both return a new GitSyncResults model:

fieldtypemeaning
pushedintcommits pushed to the external Git remote
pulledintcommits pulled from the external Git remote
new_branchboolwhether the current branch was newly created on the remote

All fields default to 0/False, so an empty {} body (the server omits zero-valued fields) deserializes cleanly. Errors (e.g. not-linked 400, missing-creds/uncommitted 403, locked 423) surface through the SDK's existing error handler as codeocean.Error.

MIN_SERVER_VERSION is bumped to 4.6.0.

🤖 Generated with Claude Code

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>
CopilotAI review requested due to automatic review settings June 8, 2026 11:27

CopilotAI left a comment

Copy link
Copy Markdown

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 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() and Pipelines.sync_pipeline() to call the new /:id/sync endpoints and deserialize the response.
  • Introduced a GitSyncResults model with safe zero/false defaults to handle empty {} responses.
  • Bumped the SDK MIN_SERVER_VERSION header to 4.6.0 and 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
FileDescription
tests/test_git_sync.pyAdds unit tests covering capsule sync parsing, empty-body defaults, and pipeline route delegation.
src/codeocean/pipeline.pyAdds sync_pipeline() that delegates to the shared capsules client configured for the pipelines route.
src/codeocean/models/capsule.pyIntroduces the GitSyncResults dataclass model returned by sync endpoints.
src/codeocean/client.pyUpdates MIN_SERVER_VERSION to 4.6.0 for the API header.
src/codeocean/capsule.pyAdds 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.

@zvikagart
zvikagart requested a review from ramdayanJune 8, 2026 12:00
@zvikagart
zvikagart merged commit 60f2287 into mainJun 8, 2026
2 checks passed
@zvikagart
zvikagart deleted the add-git-sync-support branch June 8, 2026 13:24
@zvikagartzvikagart mentioned this pull request Jun 8, 2026
Sign up for freeto 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.

3 participants

@zvikagart@ramdayan