Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Astral 9 min read Deep dive mediumAdept

An introduction to wheel variants for Python package maintainers

PEPs 817, 825 and 850 extend Python wheels with variants: labeled builds of the same release whose variant.json declares compatibility properties (namespace :: feature :: value) such as CUDA version, GPU sm_arch or AVX-512 support. Installers query provider plugins (e.g. nvidia-variant-provider, x86-64 provider) in isolated environments to learn what the host supports, treat a wheel as compatible only if every declared feature matches, and rank compatible wheels by namespace priority, then feature and value. Maintainers can also gate dependencies with variant markers, but should publish variants of dependencies rather than pick dependency versions per variant, since universal resolvers may fail to lock. The format is provisionally accepted in PEP 825 and testable via uv 0.13.8's wheel-variants preview against the WheelNext test index.

Related posts

  • Making Python in Zed Fun

    Zed easyNovice

    Zed reworked its Python support around a generic per-language toolchain selector backed by Microsoft's python-environment-tools, the same library Visual Studio Code uses for venv detection. A manifest tree tracks the nearest pyproject.toml so each monorepo sub-project gets its own toolchain. Zed also runs a separate language server per toolchain rather than making servers juggle multiple environments. Basedpyright is now the default LSP, ty and Ruff work out of the box, Pyrefly is available via an extension, and the team plans to move Astral's ty into core and add notebooks in 2026.

  • Vulnerability and malware checks in uv

    Astral easyNovice

    uv gains two preview security features: `uv audit`, a native replacement for pip-audit that checks locked dependencies against known vulnerabilities and adverse statuses like deprecation, running 4-10x faster on typical projects, and an opt-in malware check (`UV_MALWARE_CHECK=1`) that queries OSV for MAL advisories on every sync and aborts before malicious code runs. The malware check exists because PyPI quarantines only remove the index pointer, so lockfiles that reference object storage directly can still install quarantined distributions. Because it relies on public advisories, dependency cooldowns are still recommended. Planned work includes vulnerability-aware resolution, reachability analysis with ty, and alternative backends such as PYSEC.

  • From Zero to GPU: A Guide to Building and Scaling Production-Ready CUDA Kernels

    Hugging Face mediumAdept

    Hugging Face's kernel-builder lets developers write a custom CUDA kernel, register it as a native PyTorch operator, build it reproducibly with Nix for every supported PyTorch/CUDA combination, and publish it to the Hub for loading via `get_kernel`. The worked example is an RGB-to-grayscale kernel using a 2D thread grid, bound through TORCH_LIBRARY so it works with torch.compile and the dispatcher's per-device backends. It covers the build.toml manifest, Nix dev shells per torch/CUDA variant, build2cmake, and uploading build artifacts with Git LFS. Production concerns follow, including versioning kernels so API changes don't break downstream users and packaging kernels as Python wheels.

  • Securing Python projects from supply-chain attacks

    Astral mediumAdept

    Hash-pinning is the core defense against compromised maintainer accounts or hacked distribution servers, because version pins alone fail when PyPI files can be added post-release and GitHub Action tags can be force-pushed. Concrete hardening steps for Python projects on GitHub: pin Actions by commit SHA (via pinact, Dependabot or Renovate), verify SHA-256 hashes of downloaded binaries in Bash, Python or TypeScript, use PyPI Trusted Publishing over OIDC, require approvals on release environments, and lint workflows with zizmor. With uv, add dependency cooldowns via exclude-newer, lock CI tools as dependency groups and run them with UV_LOCKED, lock PEP 723 scripts, and set no-build to avoid executing source-distribution build backends.

  • Roll it out, roll it back, never redeploy

    Railway mediumAdept

    Railway now offers feature flags across its dashboard, CLI, TypeScript SDK and MCP server, so code can ship dark behind a default-off flag and be rolled out to a team, a percentage of users, or targeted segments without redeploying. Percentage rollouts use a stable bucket(key) hash, so raising a threshold never flips users back. Reads evaluate in memory against rulesets fetched at init and refreshed in the background, which makes them cheap enough for hot paths. Instead of rule priorities, conflicting or unmatched rules resolve to the flag's default, and an evaluate API returns a reason and per-rule trace for debugging.

The quest for software engineering knowledge.

Look:
Layout: