Skip to content

Commit

Permalink
Document
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Aug 21, 2024
1 parent b2d92bf commit b43f389
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 11 deletions.
38 changes: 29 additions & 9 deletions crates/platform-tags/src/tags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,17 @@ impl Tags {
) -> Result<Self, TagsError> {
let implementation = Implementation::parse(implementation_name, gil_disabled)?;

// If the interpreter is manylinux incompatible, we return an empty vector.
// This is the path that gets hit when user overrides the manylinux compatibility
// via adding `_manylinux` module to their standard library.
// See https://github.com/astral-sh/uv/issues/5915 for more details.
let platform_tags =
// Determine the compatible tags for the current platform.
let platform_tags = {
let mut platform_tags = compatible_tags(platform)?;
if matches!(platform.os(), Os::Manylinux { .. }) && !manylinux_compatible {
Vec::new()
} else {
compatible_tags(platform)?
};
platform_tags.retain(|tag| !tag.starts_with("manylinux"));
}
platform_tags
};

let mut tags = Vec::with_capacity(5 * platform_tags.len());

// 1. This exact c api version
for platform_tag in &platform_tags {
tags.push((
Expand Down Expand Up @@ -963,6 +962,27 @@ mod tests {
assert_snapshot!(
tags,
@r###"
cp39-cp39-linux_x86_64
cp39-abi3-linux_x86_64
cp39-none-linux_x86_64
cp38-abi3-linux_x86_64
cp37-abi3-linux_x86_64
cp36-abi3-linux_x86_64
cp35-abi3-linux_x86_64
cp34-abi3-linux_x86_64
cp33-abi3-linux_x86_64
cp32-abi3-linux_x86_64
py39-none-linux_x86_64
py3-none-linux_x86_64
py38-none-linux_x86_64
py37-none-linux_x86_64
py36-none-linux_x86_64
py35-none-linux_x86_64
py34-none-linux_x86_64
py33-none-linux_x86_64
py32-none-linux_x86_64
py31-none-linux_x86_64
py30-none-linux_x86_64
cp39-none-any
py39-none-any
py3-none-any
Expand Down
2 changes: 1 addition & 1 deletion crates/uv-python/python/get_interpreter_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ def main() -> None:
}
os_and_arch = get_operating_system_and_architecture()

manylinux_compatible = False
manylinux_compatible = True
if os_and_arch["os"]["name"] == "manylinux":
# noinspection PyProtectedMember
from .packaging._manylinux import _get_glibc_version, _is_compatible
Expand Down
1 change: 0 additions & 1 deletion crates/uv-python/src/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,6 @@ impl Interpreter {
}

/// Return whether this interpreter is `manylinux` compatible.
/// Used to determine whether manylinux wheels should be pulled or built locally.
pub fn manylinux_compatible(&self) -> bool {
self.manylinux_compatible
}
Expand Down
13 changes: 13 additions & 0 deletions docs/pip/compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,19 @@ reuse any binary distributions that are already present in the local cache.
Additionally, and in contrast to pip, uv's resolver will still read metadata from pre-built binary
distributions when `--no-binary` is provided.

## `manylinux_compatible` enforcement

[PEP 600](https://peps.python.org/pep-0600/#package-installers) describes a mechanism through which
Python distributors can opt out of `manylinux` compatibility by defining a `manylinux_compatible`
function on the `_manylinux` standard library module.

uv respects `manylinux_compatible`, but only tests against the current glibc version, and applies
the return value of `manylinux_compatible` globally.

In other words, if `manylinux_compatible` returns `True`, uv will treat the system as
`manylinux`-compatible; if it returns `False`, uv will treat the system as `manylinux`-incompatible,
without calling `manylinux_compatible` for every glibc version.

## Bytecode compilation

Unlike pip, uv does not compile `.py` files to `.pyc` files during installation by default (i.e., uv
Expand Down

0 comments on commit b43f389

Please sign in to comment.