Skip to content

[FR][and a bug?] Support file: URLs in --installpkg #3498

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
webknjaz opened this issue Mar 17, 2025 · 0 comments
Open

[FR][and a bug?] Support file: URLs in --installpkg #3498

webknjaz opened this issue Mar 17, 2025 · 0 comments
Labels
enhancement help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted.

Comments

@webknjaz
Copy link
Contributor

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

@gaborbernat gaborbernat added the help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted. label Mar 28, 2025
@webknjaz webknjaz moved this to 🗒️ Backlog 📝 in 📅 Procrastinating in public Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted.
Projects
None yet
Development

No branches or pull requests

2 participants