Skip to content

micropip fails to parse package version from URL when local version identifier is present #247

Description

@raptium

When a local version identifier is present, a package version may look like 1.0.0+localbuild.1.

If the wheel file is hosted on a remote server, the URL encoding results in a filename such as:

foo-1.0.0%2Blocalbuild.1.whl

However, micropip does not unquote the path before parsing. This causes version parsing to fail.

file_name = Path(parsed_url.path).name

micropip._vendored.packaging.src.packaging.version.InvalidVersion: Invalid version: '1.0.0%2Blocalbuild.1'

Steps to reproduce:

  1. Build a wheel with a local version identifier (e.g., 1.0.0+localbuild.1).
  2. Host the wheel file on a remote server.
  3. Install it via micropip.install("https://example.com/foo-1.0.0%2Blocalbuild.1.whl").
  4. Observe that parsing fails with InvalidVersion.

Expected behavior:

The path should be URL-decoded before version parsing so that 1.0.0+localbuild.1 is correctly recognized as a valid version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions