Code Monkey home page Code Monkey logo

wheel-filename's Introduction

Project Status: Active โ€” The project has reached a stable, usable state and is being actively developed. CI Status 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 relevant PEPs, with the following exceptions:

  • Unlike other filename components, version components may contain the characters ! and + for full PEP 440 support.
  • 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.6 or higher. Just use pip for Python 3 (You have pip, right?) to install wheel-filename:

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 (a str, bytes, or os.PathLike) and returns a ParsedWheelFilename instance. Any leading directory components are stripped from the argument before processing. If the filename is not a valid wheel filename, raises an InvalidFilenameError.
ParsedWheelFilename

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

project: str
The name of the project distributed by the wheel
version: str
The version of the project distributed by the wheel
build: Optional[str]
The wheel's build tag (None if not defined)
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 ParsedWheelFilename returns the original filename
tag_triples() -> Iterator[str]
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 basename of the invalid filename.

wheel-filename's People

Contributors

jwodder avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.