Sandbox python installer

Intro

The script upgrade-sandbox-python.sh can be used to:

  • Reconfigure apt to install multiple python OS packages.
  • Clone voltha repositories by name.
  • Within a cloned sandbox install an upgraded python interpreter into {repository}/.venv/.
  • Upgrade all python packages mentioned in the rquirements.txt file.
  • Post upgrade/installation regenerate requirements.txt with the latest versiosn using 'pip freeze'

Install

% git clone ssh://gerrit.opencord.org:29418/onf-scripts.git % cd onf-scripts/python-upgrade % ./upgrade-sandbox-python.sh --help

Command

% ./upgrade-sandbox-python.sh --help

Usage: ./upgrade-sandbox-python.sh --repo [r] Repository name to checkout and configure. --version [v] Install python virtualenv at version [v]

--gerrit Browse a list of VOLTHA repositories in the gerrit UI --upgrade-pacakges Remove frozen version information from requirements.txt

--no-quiet Run commands in verbose mode (pip, virtualenv) --verbose alias for --no-quiet --clean Delete cloned sandbox prior to install --help This message

[EXAMPLES] % ./upgrade-sandbox-python.sh --version 3.12 --repo voltha-system-tests % ./upgrade-sandbox-python.sh --version 3.12 --repo voltha-lib-go

Upgrade all python packages: --upgrade-pacakges

The upgrade-packages argument will remove all version info (==3.1.2) from requirements.txt allowing the latest packages to be installed.

% ./upgrade-sandbox-python.sh --upgrade-packages --version 3.12 --repo voltha-lib-go

As a convenience the makefile target 'install' can be used to configure for a full upgrade:

% make install version=3.12 repo-voltha-lib-go

Known problems

[grpc] - Dependencies on compiling the wheels package has been problematic.

ERROR: Failed to build installable wheels for some pyproject.toml based projects (grpcio)

[OSX] - the upgrade script was written with ubuntu and apt in mind'

It should be trivial to get the script functional on OSX. All that should be needed is gather OS installer (brew?) package names. Update the install_python() fucntion (it will err on arch=darwin) to install brew packages as needed. Then update interpreter path(s) or create symlinks if needed (default: /usr/bin/python${version})