From d1a4137fdd16fc1f296a72d852bbc7756b5eb57e Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Mon, 10 Jun 2024 08:51:48 -0400 Subject: [PATCH] Document bytecode compilation in pip compatibility guide --- PIP_COMPATIBILITY.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/PIP_COMPATIBILITY.md b/PIP_COMPATIBILITY.md index e36173b325b4..0311efe78971 100644 --- a/PIP_COMPATIBILITY.md +++ b/PIP_COMPATIBILITY.md @@ -310,6 +310,12 @@ the package is "allowed" in such cases without building its metadata. Both pip and uv allow editables requirements to be built and installed even when `--only-binary` is provided. For example, `uv pip install -e . --only-binary :all:` is allowed. +## Bytecode compilation + +Unlike pip, uv does not compile `.py` files to `.pyc` files during installation by default (i.e., +uv does not create or populate `__pycache__` directories). To enable bytecode compilation +during installs, pass the `--compile-bytecode` flag to `uv pip install` or `uv pip sync`. + ## Strictness and spec enforcement uv tends to be stricter than `pip`, and will often reject packages that `pip` would install.