Add new site management commands for running pip and python.

Review Request #12998 — Created April 30, 2023 and submitted

Information

Review Board
release-5.0.x

Reviewers

This introduces two new special commands for rb-site manage: pip
and python. These are used to execute pip and python,
respectively, using the correct version of the site.

If the site is installed with an embedded venv directory, the
executable will be run from there, ensuring the command is executing
within that virtual environment.

If the site is a traditional globally-installed site, the versioned
pythonX.Y binary for the current version of Python running rb-site
will be used. pip always uses pythonX.Y -m pip.

The python command is conceptually distinct from shell, as it's
meant to be a raw pass-through to Python, rather than an interactive
shell (Django has additional logic going into their shell and can
execute ipython or bpython).

These are intentionally not implemented as management commands, in
order to minimize any Django-related code that needs to execute in
order to work with packages or the Python interpreter.

This will be the preferred way going forward for documenting any pip
or python usage within a site. Documentation will be updated
separately to show this usage.

Tested using the pip command for installing, uninstalling, and listing
packages. Tested this with both a virtualenv install and a traditional
global install.

Tested using the python command as a shell, command runner (using -c),
and piping a script to it.

Summary ID
Add new site management commands for running pip and python.
This introduces two new special commands for `rb-site manage`: `pip` and `python`. These are used to execute `pip` and `python`, respectively, using the correct version of the site. If the site is installed with an embedded `venv` directory, the executable will be run from there, ensuring the command is executing within that virtual environment. If the site is a traditional globally-installed site, the versioned `pipX.Y` or `pythonX.Y` binary for the current version of Python running `rb-site` will be used. The `python` command is conceptually distinct from `shell`, as it's meant to be a raw pass-through to Python, rather than an interactive shell (which isn't guaranteed to be using the standard Python shell or environment in the future). This will be the preferred way going forward for documenting any `pip` or `python` usage within a site. Documentation will be updated separately to show this usage.
9db18c49e0cafeece6cb544aca3d7bcf60ff8212
chipx86
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-5.0.x (3fec6ca)
Loading...