You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Build azure-cosmos wheels with an importable Rust extension - #50250
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.
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:
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.
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.
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.
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
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.
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
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.