st2 icon indicating copy to clipboard operation
st2 copied to clipboard

Pantsbuild: Make exported venv useful for running nose

Open cognifloyd opened this issue 2 years ago • 0 comments

With this change, you can run pants export --resolve=st2 to get a venv under dist/export/python/virtualenvs/st2/<python version>. The venv includes:

  • editable installs of all of our st2* (st2api, st2auth, ...) and runners
  • everything in lockfiles/st2.lock:
    • nose so that you can run the tests.
    • versions of pymongo and mongoengine that is compatible with our code
      • All unit tests pass with this

Pex (used by pants) will create the venv with the first interpreter on the path that matches the interpreter_constraints in pants.toml. If you want to generate a venv with a particular python binary use this:

pants export --resolve=st2 --python-bootstrap-search-path=[] --python-bootstrap-search-path=/usr/bin/python3.9

Replace /usr/bin/python3.9 with the interpreter you want pants to use.

This PR does not attempt to get the Makefile to use the venv. This PR just extracts the bits I'm confident about from #6130.

Summary of changes in the Lockfile:

==                    Upgraded dependencies                     ==

  certifi                        2023.11.17   -->   2024.2.2
  cryptography                   42.0.1       -->   42.0.3
  gitpython                      3.1.41       -->   3.1.42
  netaddr                        0.10.1       -->   1.1.0
  orjson                         3.9.12       -->   3.9.14
  pip                            23.3.2       -->   24.0
  platformdirs                   4.1.0        -->   4.2.0
  pytz                           2023.4       -->   2024.1
  setuptools                     69.0.3       -->   69.1.0
  ruamel-yaml                    0.18.5       -->   0.18.6
  tzdata                         2023.4       -->   2024.1
  urllib3                        2.1.0        -->   2.2.0
  voluptuous                     0.14.1       -->   0.14.2
  waitress                       2.1.2        -->   3.0.0

==                      Added dependencies                      ==

  colorama                       0.4.6
  nose                           1.3.7
  nose-parallel                  0.4.0
  nose-timer                     1.0.1
  rednose                        1.3.0
  termstyle                      0.1.11

==                !! Downgraded dependencies !!                 ==

  mongoengine                    0.27.0       -->   0.23.1
  pymongo                        4.6.1        -->   3.12.3

cognifloyd avatar Feb 16 '24 20:02 cognifloyd