Skip to main content

Project Status: Active — The project has reached a stable, usable state and is being actively developed. CI Status coverage pyversions MIT License

GitHub | PyPI | Issues | Changelog

wheel-filename lets you verify wheel filenames and parse them into their component fields.

This package adheres strictly to the standard, with the following exceptions:

  • Version components may be any sequence of the relevant set of characters; they are not verified for PEP 440 compliance.

  • The .whl file extension is matched case-insensitively.

Installation

wheel-filename requires Python 3.10 or higher. Just use pip for Python 3 (You have pip, right?) to install it:

python3 -m pip install wheel-filename

Example

>>> from wheel_filename import WheelFilename
>>> pwf = WheelFilename.parse('pip-18.0-py2.py3-none-any.whl')
>>> str(pwf)
'pip-18.0-py2.py3-none-any.whl'
>>> pwf.project
'pip'
>>> pwf.version
'18.0'
>>> pwf.build is None
True
>>> pwf.python_tags
['py2', 'py3']
>>> pwf.abi_tags
['none']
>>> pwf.platform_tags
['any']
>>> list(pwf.tag_triples())
['py2-none-any', 'py3-none-any']

API

WheelFilename

A dataclass representing the components of a wheel filename. It has the following attributes and methods:

WheelFilename.parse(filename)

(classmethod) Parses a wheel filename (a str, bytes, or os.PathLike) and returns a WheelFilename instance. Any leading directory components are stripped from the argument before processing. If the filename is not a valid wheel filename, raises a ParseError.

project: str

The name of the project distributed by the wheel

version: str

The version of the project distributed by the wheel

build: str | None

The wheel’s build tag (None if not defined)

build_tuple: tuple[int, str] | tuple[()]

The build tag as a tuple for use in sorting. If build is non-None, this is (build_leading, build_trailing); otherwise, it is the empty tuple.

build_leading: int | None

If build is non-None, this is the leading integer portion of the build tag converted to an int; otherwise it is None

build_trailing: str | None

If build is non-None, this is the part after the leading integer portion of the build tag; otherwise it is None

python_tags: list[str]

A list of Python tags for the wheel

abi_tags: list[str]

A list of ABI tags for the wheel

platform_tags: list[str]

A list of platform tags for the wheel

str(pwf)

Stringifying a WheelFilename returns the original filename

tag_triples() -> Iterator[str]

Returns an iterator of all simple tag triples formed from the compatibility tags in the filename

ParseError

A subclass of ValueError raised when an invalid wheel filename is passed to WheelFilename.parse(). It has a filename attribute containing the basename of the invalid filename.

Command

New in version 1.4.0

wheel-filename also provides a command of the same name that takes a wheel filename (The actual wheel does not have to exist) and outputs the filename components as JSON.

Example:

$ wheel-filename pip-18.0-py2.py3-none-any.whl
{
    "project": "pip",
    "version": "18.0",
    "build": null,
    "python_tags": [
        "py2",
        "py3"
    ],
    "abi_tags": [
        "none"
    ],
    "platform_tags": [
        "any"
    ]
}

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wheel_filename-2.1.0.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wheel_filename-2.1.0-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file wheel_filename-2.1.0.tar.gz.

File metadata

  • Download URL: wheel_filename-2.1.0.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for wheel_filename-2.1.0.tar.gz
Algorithm Hash digest
SHA256 4c12c51ee92d5fb77ed0932e4f83ff82d8b129b845422f0a1ab2ab9d2d2e2aa4
MD5 00694b71116beacd579bbecc3e5b2b05
BLAKE2b-256 9ffecf3ae073fdb82e8ca1d40460efa3686ae45fec3420a2f2d855cd0bb157ea

See more details on using hashes here.

File details

Details for the file wheel_filename-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: wheel_filename-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for wheel_filename-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 33de41b29f9520fff89494387e27d244d1c8ebe20126537b4a663f4be625ccff
MD5 cf934351e3a97b2bbdc0f48cd7e18612
BLAKE2b-256 8be1f0f65444e6d6ba37556ddff7cc41864bc565d8b6645969e3dadca93c74a7

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.1.0 This release

2 files

2.0.0

2 files

1.4.2

2 files

1.4.1

2 files

1.4.0

2 files

1.3.0

2 files

1.2.0

2 files

1.1.0

2 files

1.0.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page