uv
b9b4109a - Initialize client lazily for remote requirements files (#2350)

Commit
1 year ago
Initialize client lazily for remote requirements files (#2350) ## Summary We now initialize an HTTP client in advance for remote requirements files. It turns out this adds a significant overhead, even for operations like auditing the environment (at least on macOS). This PR makes initialization lazy. After a lot of evaluation, I took the easiest route, which is: we just pass in `Connectivity`, and then use the default HTTP client. So we won't respect netrc files and anything else that we get from our registry client. If we want to keep using the registry client, we _can_, it's just way more ceremony to pass down a closure. See: https://github.com/astral-sh/uv/issues/2346. ## Test Plan - Verified that `cargo run pip compile https://raw.githubusercontent.com/ansible/ansible/f1ded0f41759235eb15a7d13dbc3c95dce5d5acd/requirements.txt` completed without error. - Verified that `cargo run pip compile https://raw.githubusercontent.com/ansible/ansible/f1ded0f41759235eb15a7d13dbc3c95dce5d5acd/requirements.txt --offline` failed with an error. - Verified that `./target/release/uv pip install requests` completed in 0-2ms, rather than hundreds.
Author
Parents
  • File
    Cargo.lock
  • crates
    • requirements-txt
      • File
        Cargo.toml
      • src
        • File
          lib.rs
    • uv
      • src
        • commands
          • File
            pip_compile.rs
          • File
            pip_install.rs
          • File
            pip_sync.rs
          • File
            pip_uninstall.rs
        • File
          requirements.rs
      • tests
        • File
          pip_install.rs