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

@zvikagart zvikagart 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:

field type meaning
pushed int commits pushed to the external Git remote
pulled int commits pulled from the external Git remote
new_branch bool whether 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>
Copilot AI review requested due to automatic review settings June 8, 2026 11:27

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

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

3 participants