Repository navigation
Python SDK v3: gzip-compressed pickles - #18
Merged
Merged
Conversation
MoveApps hands the App extension-less input and output paths, so pandas cannot infer the compression from the file name. Write gzip explicitly, and determine on read whether the input is compressed - that keeps uncompressed output from Apps built against an earlier SDK readable. Breaking change, hence the SDK version is v3.0.0: Apps built against an earlier SDK cannot read the compressed output and have to be rebuilt. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Measured against the new co-pilot base image on linux/amd64: 3.14 solves with pandas, geopandas, movingpandas and the SDK's own dependencies. `environment.yml` is in `.templatesyncignore`, so this reaches new Apps created from the template and never an existing fork. The changelog entry says so, because it is the only channel a fork owner reads. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Draft on purpose — see "Why this is a draft" below.
What changes
App output is now always written as a gzip-compressed pickle, and App input is read whether it is
compressed or not. On the samples shipped here that is a factor of 8 to 19 —
input2_LatLongoes from72.5 MB to 3.8 MB.
The compression is determined from the file content, not from the file name. That is the one
non-obvious part, so it is worth spelling out: during an App run MoveApps dictates the paths and they
carry no extension —
— so pandas'
compression='infer', which only looks at the suffix, has nothing to work with. Writingtherefore states the compression explicitly, and reading reads the gzip magic number (
1f 8b,RFC 1952) from the first two bytes.
This is what the R SDK has always done:
saveRDSgzips by default into that very same extension-less/tmp/output_file, andreadRDSrecognises the compression from the header.sdk/moveapps_pickle.py(new) —read(),write(),detect_compression()sdk/moveapps_execution.pydelegates to it; its directpandasimport is gonetests/sdk/test_moveapps_pickle.py(new) — 7 tests; the full suite is 21 greenCHANGELOG_SDK.md— released asv3.0.0, breaking change stated explicitlyBreaking, deliberately
Reading stays backward compatible: an App on this SDK happily consumes uncompressed output from an App
built against an earlier one. That matters more than it may look, because MoveApps replays the stored
output of a pinned workflow item, and those blobs are never rewritten.
Writing cannot be made compatible. An App on SDK ≤
v2.3.0sitting behind a new App reads a gzipstream with
inferand dies onUnpicklingError: invalid load key, '\x1f'. Hence the major version,and hence every Python App on MoveApps needs rebuilding against the new co-pilot image.
Why this is a draft
Two reasons, both about blast radius rather than about the code:
wiring the platform actually uses — but the platform rollout is still ahead of us. Tag
v3.0.0-RC1exists on this branch so the co-pilot image can be built and rehearsed on an isolatedenvironment first. The real
v3.0.0follows onmain, after that rehearsal..github/workflows/template-sync.ymlruns weekly inevery repository derived from it.
sdk/is not listed in.github/.templatesyncignore, so merginghere propagates the change into all of those App repositories. That is the intended end state — but
it should happen once, deliberately, and not before the rehearsal has passed.
Companion work already released:
cargo-agent-pythonv2.2.0reads the compressed output, andlink-r-pythonv2.1.0/v1.1.0cover the four R↔Python translator Apps, which handle picklesoutside this SDK.