refactor: replace subxet with xet-session API#1
Merged
davanstrien merged 3 commits intoMar 6, 2026
Conversation
Swap the low-level subxet dependency (XetClient/XetWriter) for the official xet-session API (XetSession/UploadCommit/SingleFileCleaner) from huggingface/xet-core. - xet_upload.rs: remove BucketWriter, add create_xet_session() - streaming_upload.rs: use SingleFileCleaner instead of XetWriter, remove AbortOnDropHandle (48 lines) - mod.rs: update upload_and_register_file() to use xet-session No changes to batch.rs or hf_bucket_sink.rs (ComputeNode). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
XetSession internally creates its own tokio runtime, which panics when built from within an existing async runtime. Wrap session creation, upload_file, and commit() in spawn_blocking to run on tokio's blocking thread pool. Also add the required UploadCommit::commit() call after SingleFileCleaner::finish() — without it, data is not persisted to XET storage and the batch API returns "File not found". Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ition The three token extraction tests (token_from_env_var, token_from_cached_file, token_missing_returns_error) mutate shared env vars (HF_TOKEN, HF_HOME) and fail intermittently when run in parallel. Add a TOKEN_TEST_LOCK mutex to serialize them. Also update XET_SESSION_REFACTOR.md with Session A validation results. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The uncompressed lib size after this PR is 53.6980 MB. |
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
subxetcrate (low-levelXetClient/XetWriter) with the officialxet-sessionAPI (XetSession/UploadCommit/SingleFileCleaner)spawn_blockingUploadCommit::commit()call required to persist data to XET storageDetails
Reduces code by ~71 lines and switches from an opaque internal crate to three well-defined xet-core public API crates (
xet-session,xet-data,xet-utils).streaming_upload.rsxet_upload.rsmod.rsTest plan
cargo test --features hf_bucket_sink -p polars-io)cargo check --features hf_bucket_sink -p polars-streamcompilessubxet/BucketWriter/XetWriter) in crates/ and py-polars/davanstrien/polars-hf-bucket-sink-wheels🤖 Generated with Claude Code