Parse wheel filenames
Project description
GitHub | PyPI | Issues | Changelog
wheel-filename lets you verify wheel filenames and parse them into their component fields. It adheres strictly to the relevant PEPs, except that version components are allowed to contain ! and + for full PEP 440 support.
Installation
wheel-filename requires Python 3.5 or higher. Just use pip for Python 3 (You have pip, right?) to install wheel-filename and its dependencies:
python3 -m pip install wheel-filename
Example
>>> from wheel_filename import parse_wheel_filename >>> pwf = parse_wheel_filename('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
- parse_wheel_filename(filename)
Parses a wheel filename (without any directory components) and returns a ParsedWheelFilename instance. If the filename is invalid, raises an InvalidFilenameError.
- ParsedWheelFilename
A class representing the components of a wheel filename. It has the following attributes and methods:
- project
The name of the project distributed by the wheel
- version
The version of the project distributed by the wheel
- build
The wheel’s build tag (None if not defined)
- python_tags
A list of Python tags for the wheel
- abi_tags
A list of ABI tags for the wheel
- platform_tags
A list of platform tags for the wheel
- str(pwf)
Stringifying a ParsedWheelFilename returns the original filename
- tag_triples()
Returns an iterator of all simple tag triples formed from the compatibility tags in the filename
- InvalidFilenameError
A subclass of ValueError raised when an invalid wheel filename is passed to parse_wheel_filename(). It has a filename attribute containing the invalid filename.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for wheel_filename-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06ac90386f766487575efce4d884bae62f6b20f875a4d0b22a1557ea9b6ed20d |
|
MD5 | 58b0709ec4bed950b89a619ab7fb9eab |
|
BLAKE2b-256 | 3ff98c6fd45c245371a5b38c0ec7d1af328a72abc24a69aa92493888c4efbd14 |