Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid network/index related imports for pip uninstall & list (unless necessary) #12637

Merged
merged 3 commits into from
May 6, 2024

Commits on May 5, 2024

  1. Move warn_if_run_as_root() to utils

    While it's reasonable to put this function in req_install.py, putting it
    there unfortunately means importing a bunch of heavy network/index code
    as well which isn't acceptable.
    ichard26 committed May 5, 2024
    Configuration menu
    Copy the full SHA
    50ada46 View commit details
    Browse the repository at this point in the history
  2. Move non requirement command classes out of req_command.py

    By moving SessionCommandMixin and IndexGroupCommand into their own
    module, lazy imports can be easily used.
    ichard26 committed May 5, 2024
    Configuration menu
    Copy the full SHA
    55cfa54 View commit details
    Browse the repository at this point in the history
  3. Avoid heavy index imports for pip uninstall & list

    pip uninstall and list currently depend on req_install.py which always imports
    the expensive network and index machinery. However, it's only in rare situations
    that these commands actually hit the network:
    
    - `pip list --outdated`
    - `pip list --uptodate`
    - `pip uninstall --requirement <url>`
    
    This commit builds on the previous two refactoring commits and modifies these
    commands to avoid the expensive imports unless truly necessary.
    ichard26 committed May 5, 2024
    Configuration menu
    Copy the full SHA
    1071614 View commit details
    Browse the repository at this point in the history