Skip to content

Build azure-cosmos wheels with an importable Rust extension - #50250

Open
dibahlfi wants to merge 1 commit into
feature/python-vNextfrom
users/dibahl/python-vNext-01-rust-packaging
Open

dibahlfi wants to merge 1 commit into
feature/python-vNextfrom
users/dibahl/python-vNext-01-rust-packaging

Conversation

@dibahlfi

@dibahlfi dibahlfi commented Dec 4, 2026

Copy link
Copy Markdown
Member

Purpose

This is the first part of #46851, targeting feature/python-vNext. It packages a minimal Rust extension as azure.cosmos._rust so a customer can install a prebuilt wheel and import the module without compiling Rust or connecting to Cosmos DB. No SDK operation uses Rust in this PR; read_item comes in PR 2.

Changes

  • Use Maturin to build the Python package and Rust extension into one wheel. Keep setup.py available for metadata queries, but prevent it from building a wheel without the extension.
  • Configure wheel builds for Windows x64, Linux x86_64, and macOS arm64
  • Set Python 3.10 as the minimum because the V5 Python code coming in later PRs uses the kw_only and slots dataclass options introduced in 3.10. Rust itself does not require this minimum.

Versioning and PyPI

PR 1 keeps azure-cosmos at 4.17.2. a later PR will update the package version to match the vNext beta release in both pyproject.toml (used by CI) and _version.py (used at runtime), and add a check that they match.

Validation

Built and installed the Windows x64 wheel in a clean environment outside the checkout. The sync and async clients imported, and _rust loaded from the installed wheel. Compared with feature/python-vNext, _rust.pyd was the only addition under azure; no SDK package files or dependencies were lost. The source archive and a wheel rebuilt from it both contained LICENSE.

@azure-sdk-automation

Copy link
Copy Markdown
Contributor

Add sdk-api-review-ready when this working PR is ready for API review of azure-cosmos. The review will compare target version 4.0.0b6 from this working PR against baseline version 4.0.0b5 (tag azure-cosmos_4.0.0b5). If you need a different comparison, use the Azure SDK CLI (azsdk apireview create).

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).
8 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@github-actions

github-actions Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor
[Pilot] PR Pipeline Failure Analysis

What failed

Two Azure Pipelines checks failed on build 7144104 and 7144105:

1. python - cosmos - ci (Build Build_Linux) — https://dev.azure.com/azure-sdk/public/_build/results?buildId=7144104

cibuildwheel failed while building the cp310-manylinux_x86_64 wheel for azure-cosmos inside the quay.io/pypa/manylinux_2_28_x86_64 container. The container-setup step attempts to bootstrap a Rust toolchain via msrustup/install-msrustup.sh, which runs curl against an internal feed; that request returned curl: (52) Empty reply from server, aborting the container build with exit code 52. Because no wheel/sdist was produced, the downstream "Validate Distribution" step then failed separately with InvalidDistribution: Cannot find file (or expand pattern) '.../*.whl' and '.../*.tar.gz' — a cascading symptom of the same root cause, not an independent failure.

2. python - pullrequest (Build Analyze) — https://dev.azure.com/azure-sdk/public/_build/results?buildId=7144105

cspell lint flagged 21 "unknown word" errors in the new Rust-related files: Cargo.toml, azure_cosmos_rust/src/lib.rs, rust-toolchain.toml, and scripts/install-msrustup.sh — words such as cdylib, pymodule, msrustup, MSRUSTUP, msvc, MSYS, and esac (a legitimate POSIX shell keyword, not a typo).

Relevant pipeline output
cibuildwheel: error: Command ['sh', '-c', 'dnf install -y jq && mkdir -p $MSRUSTUP_HOME/bootstrap && cd $MSRUSTUP_HOME/bootstrap && sh /project/scripts/install-msrustup.sh && cd /project && $MSRUSTUP_HOME/bootstrap/msrustup toolchain install && sh /project/scripts/configure-cargo-feed.sh'] failed with code 52.
Host is x86_64-unknown-linux-gnu
curl: (52) Empty reply from server

##[error]sdk/cosmos/azure-cosmos/azure_cosmos_rust/Cargo.toml:16:16 - Unknown word (cdylib)
##[error]sdk/cosmos/azure-cosmos/azure_cosmos_rust/src/lib.rs:6:3 - Unknown word (pymodule)
##[error]sdk/cosmos/azure-cosmos/rust-toolchain.toml:1:32 - Unknown word (msrustup)
##[error]sdk/cosmos/azure-cosmos/scripts/install-msrustup.sh:11:12 - Unknown word (MSRUSTUP)
##[error]sdk/cosmos/azure-cosmos/scripts/install-msrustup.sh:59:28 - Unknown word (msvc)
##[error]sdk/cosmos/azure-cosmos/scripts/install-msrustup.sh:69:1 - Unknown word (esac)
##[error]Spelling errors detected. To correct false positives or learn about spell checking see: https://aka.ms/azsdk/engsys/spellcheck

Recommended next steps

  • Build_Linux (Rust toolchain curl failure): this is a transient infrastructure error against an internal feed (curl: (52) Empty reply from server) reached from inside the manylinux Docker container during install-msrustup.sh/configure-cargo-feed.sh. Retry the pipeline first; if it persists, verify the internal Rust-feed endpoint used by configure-cargo-feed.sh is reachable from the manylinux build container (proxy/network egress rules may block it).
  • cspell (Build Analyze): add the flagged Rust/tooling terms (cdylib, pymodule, msrustup, MSRUSTUP, msvc, MSYS, esac, etc.) to the repository's cspell dictionary/word list so legitimate new identifiers aren't flagged as typos.
  • See https://aka.ms/ci-fix

Automated fix: Fix found, view and apply fix

Generated by Pipeline Analysis Next Steps · copilot · sonnet50 · 36.8 AIC · ⌖ 0.58 AIC · ⊞ 9.1K · ◷

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant