Description
What's the problem this feature will solve?
I'm making a matrix of wheels in a separate job in CI, then I want to invoke tox to test something from a wheel. In non-pure python projects, I have to first identify a compatible wheel.
To do this, I use something along the lines of pip install --find-links=./dist --no-index '${{ env.PROJECT_NAME }}' --dry-run --report=- | jq --raw-output .install[].download_info.url
.
But it returns things like file:///home/runner/work/pylibssh/pylibssh/dist/ansible_pylibssh-1.2.3.dev126%2Bgf256788-cp312-cp312-manylinux_2_28_x86_64.whl
. And so when it's passed as --installpkg file:///home/runner/work/pylibssh/pylibssh/dist/ansible_pylibssh-1.2.3.dev126%2Bgf256788-cp312-cp312-manylinux_2_28_x86_64.whl
, tox gets confused:
usage: tox run [-h] [--colored {yes,no}] [--stderr-color {BLACK,BLUE,CYAN,GREEN,LIGHTBLACK_EX,LIGHTBLUE_EX,LIGHTCYAN_EX,LIGHTGREEN_EX,LIGHTMAGENTA_EX,LIGHTRED_EX,LIGHTWHITE_EX,LIGHTYELLOW_EX,MAGENTA,RED,RESET,WHITE,YELLOW}]
[--exit-and-dump-after seconds] [-c file] [--workdir dir] [--root dir] [--runner {virtualenv}] [-v | -q] [--result-json path] [--hashseed SEED] [--discover path [path ...]] [--list-dependencies | --no-list-dependencies]
[-e ENV | -m label [label ...] | -f factor [factor ...] | --skip-env re] [-s [v]] [-n] [-b] [--installpkg INSTALL_PKG] [--develop] [--no-recreate-pkg] [--skip-pkg-install] [--version] [--no-provision [REQ_JSON]]
[--no-recreate-provision] [-r] [-x OVERRIDE]
tox run: error: argument --installpkg: /home/runner/work/pylibssh/pylibssh/file:/home/runner/work/pylibssh/pylibssh/dist/ansible_pylibssh-1.2.3.dev126%2Bgf256788-cp312-cp312-manylinux_2_28_x86_64.whl does not exist
This is obviously passed to pathlib.Path()
which treats it as a relative path. And then when it's made absolute, the CWD is prepended. The correct way to do this would be using pathlib.Path.from_uri()
.
Describe the solution you'd like
I think a simple str.startswith('file:')
for the pathlib object constructor selection would solve this.
Alternative Solutions
I could do the conversion before calling tox. But I feel like this is a valid use case for tox to support natively.
Additional context
N/A