Skip to content
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

Panic on plugin installation from a local simple repository #4510

Closed
BenediktMaag opened this issue Jun 25, 2024 · 5 comments · Fixed by #4524
Closed

Panic on plugin installation from a local simple repository #4510

BenediktMaag opened this issue Jun 25, 2024 · 5 comments · Fixed by #4524
Assignees
Labels
bug Something isn't working compatibility Compatibility with a specification or another tool

Comments

@BenediktMaag
Copy link

BenediktMaag commented Jun 25, 2024

I have setup a simple repository (https://packaging.python.org/en/latest/specifications/simple-repository-api/ | PEP503).

Installing a plugin from the repository by providing a extra-index-url works with pip
❯ : pip install --extra-index-url C:\temp\simple pyplugin
Looking in indexes: https://pypi.org/simple, c:\temp\simple
Processing c:\temp\simple\pyplugin\pyplugin-0.2.0-cp312-none-win_amd64.whl
Installing collected packages: pyplugin
Successfully installed pyplugin-0.2.0

Auditing once installed works:
❯ : uv pip install --extra-index-url C:\temp\simple pyplugin
Audited 1 package in 0.87ms

Uninstalling with uv works
❯ : uv pip uninstall pyplugin
Uninstalled 1 package in 4ms

  • pyplugin==0.2.0

Installing if not installed panics on as an error is unwrapped:
❯ : uv pip install --extra-index-url C:\temp\simple pyplugin -vv
0.000065s DEBUG uv uv 0.2.15
uv_requirements::specification::from_source source=pyplugin
0.004157s DEBUG uv_toolchain::discovery Searching for Python interpreter in system toolchains
0.005540s DEBUG uv_toolchain::discovery Found cpython 3.12.0 at C:\temp\test_install\.venv\Scripts\python.exe (active virtual environment)
0.006112s DEBUG uv::commands::pip::install Using Python 3.12.0 environment at .venv\Scripts\python.exe
0.007138s DEBUG uv_fs Acquired lock for .venv
0.007840s DEBUG uv::commands::pip::install At least one requirement is not satisfied: pyplugin
uv_client::linehaul::linehaul
0.008540s DEBUG uv_client::base_client Using request timeout of 30s
uv_resolver::flat_index::from_entries
uv_resolver::resolver::solve
uv_resolver::resolver::solve_tracked
0.012593s 0ms DEBUG uv_resolver::resolver Solving with installed Python version: 3.12.0
uv_resolver::resolver::choose_version package=root
uv_resolver::resolver::get_dependencies_forking package=root, version=0a0.dev0
uv_resolver::resolver::get_dependencies package=root, version=0a0.dev0
0.013802s 0ms DEBUG uv_resolver::resolver Adding direct dependency: pyplugin*
uv_resolver::resolver::process_request request=Versions pyplugin
uv_client::registry_client::simple_api package=pyplugin
thread ' uv_resolver::resolver::choose_version package=pyplugin
main' panicked at D:\a\uv\uv\crates\uv-client\src\registry_client.rs:273:14:
called Result::unwrap() on an Err value: ()

A minimal setup can be found here, github doesnt allow .7z files (maturin init compiled as 0.1.0 and 0.2.0):
https://we.tl/t-WOJyEdOD1L

❯ : uv --version
uv 0.2.15 (bfc342d 2024-06-24)
Windows 11

@charliermarsh
Copy link
Member

I think we require that you pass it as a file:// URL, so we can distinguish it from an HTTP registry.

@BenediktMaag
Copy link
Author

Indeed it works when prefixing the url with file:://
However you might still considers prompting a more understandable error than:

❯ : uv pip install --extra-index-url C:\temp\simple pyplugin
⠙ Resolving dependencies...
thread 'main' panicked at D:\a\uv\uv\crates\uv-client\src\registry_client.rs:273:14:
called Result::unwrap() on an Err value: ()
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

@charliermarsh charliermarsh self-assigned this Jun 25, 2024
@zanieb zanieb added the bug Something isn't working label Jun 25, 2024
@charliermarsh charliermarsh added the compatibility Compatibility with a specification or another tool label Jun 25, 2024
@charliermarsh
Copy link
Member

It looks like pip's logic is:

if os.path.exists(location):  # Is a local path.
    url = path_to_url(location)
    path = location
elif location.startswith("file:"):  # A file: URL.
    url = location
    path = url_to_path(location)
elif is_url(location):
    url = location

@charliermarsh
Copy link
Member

Next release supports this.

@BenediktMaag
Copy link
Author

Thanks alot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compatibility Compatibility with a specification or another tool
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants