0

A project uses tox and poetry to manage the Python environment during continuous integration (CI) testing (install Python packages before running tests). The project root directory has files /tox.ini and /pyproject.toml.

In the CI workflow, a shell script /runner.sh calls tox. The /tox.ini instructs tox to call poetry install. The /pyproject.toml has a few settings which poetry passes to pip.

I want to pass some particular arguments to pip, e.g. --disable-pip-version-check.

What is the best way to pass arguments to pip?
Should I edit /tox.ini or /pyproject.toml? Is there a field in either file that will guarantee some particular arguments are passed to child invocations of pip?
Should I set an environment variable within the controlling shell script /runner.sh?

JamesThomasMoon
  • 6,169
  • 7
  • 37
  • 63

2 Answers2

0

I cannot give you a complete answer, but when you decide to set the env in the shell script, please do not forget to set the passenv option, as tox "blocks" all environment variables to provide a clean state.

So, the questions boils down to how poetry passes information to pip, and that is something I cannot answer.

I think there is no difference whether you set an env variable in your shell script (and then set passenv in tox) or you set the environment directly in tox via setenv.

If I were you, I would just try it on my dev pc. The pleasure of tox is that you can run it both locally and in CI.

Jürgen Gmach
  • 5,366
  • 3
  • 20
  • 37
0

You can probably set up some global options for pip, either via configuration file pip.conf or maybe via environment variables (not sure on this one): https://pip.pypa.io/en/stable/user_guide/#configuration

sinoroc
  • 18,409
  • 2
  • 39
  • 70