From 163f328aeadcb6c7a25977dce922b6a3fa46e9ea Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Mon, 10 Jun 2024 05:58:08 -0700 Subject: [PATCH] Document bytecode compilation in pip compatibility guide (#4195) ## Summary Closes #4188. --- PIP_COMPATIBILITY.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/PIP_COMPATIBILITY.md b/PIP_COMPATIBILITY.md index e36173b32..0311efe78 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.