.. image:: http://www.repostatus.org/badges/latest/active.svg
:target: http://www.repostatus.org/#active
:alt: Project Status: Active — The project has reached a stable, usable
state and is being actively developed.
.. image:: https://github.com/jwodder/wheel-filename/workflows/Test/badge.svg?branch=master
:target: https://github.com/jwodder/wheel-filename/actions?workflow=Test
:alt: CI Status
.. image:: https://codecov.io/gh/jwodder/wheel-filename/branch/master/graph/badge.svg
:target: https://codecov.io/gh/jwodder/wheel-filename
.. image:: https://img.shields.io/pypi/pyversions/wheel-filename.svg
:target: https://pypi.org/project/wheel-filename/
.. image:: https://img.shields.io/github/license/jwodder/wheel-filename.svg
:target: https://opensource.org/licenses/MIT
:alt: MIT License
`GitHub <https://github.com/jwodder/wheel-filename>`_
| `PyPI <https://pypi.org/project/wheel-filename/>`_
| `Issues <https://github.com/jwodder/wheel-filename/issues>`_
| `Changelog <https://github.com/jwodder/wheel-filename/blob/master/CHANGELOG.md>`_
``wheel-filename`` lets you verify `wheel
<https://www.python.org/dev/peps/pep-0427/>`_ 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
<https://pip.pypa.io>`_ 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.
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"
]
}
Raw data
{
"_id": null,
"home_page": "https://github.com/jwodder/wheel-filename",
"name": "wheel-filename",
"maintainer": "",
"docs_url": null,
"requires_python": "~=3.6",
"maintainer_email": "",
"keywords": "filename,pep427,wheel",
"author": "John Thorvald Wodder II",
"author_email": "wheel-filename@varonathe.org",
"download_url": "https://files.pythonhosted.org/packages/2a/24/ffb1fc1340edbfd03c9fa9179b3242aedf2bea6d79c56150b5f8354eff25/wheel-filename-1.4.1.tar.gz",
"platform": null,
"description": ".. image:: http://www.repostatus.org/badges/latest/active.svg\n :target: http://www.repostatus.org/#active\n :alt: Project Status: Active \u2014 The project has reached a stable, usable\n state and is being actively developed.\n\n.. image:: https://github.com/jwodder/wheel-filename/workflows/Test/badge.svg?branch=master\n :target: https://github.com/jwodder/wheel-filename/actions?workflow=Test\n :alt: CI Status\n\n.. image:: https://codecov.io/gh/jwodder/wheel-filename/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/jwodder/wheel-filename\n\n.. image:: https://img.shields.io/pypi/pyversions/wheel-filename.svg\n :target: https://pypi.org/project/wheel-filename/\n\n.. image:: https://img.shields.io/github/license/jwodder/wheel-filename.svg\n :target: https://opensource.org/licenses/MIT\n :alt: MIT License\n\n`GitHub <https://github.com/jwodder/wheel-filename>`_\n| `PyPI <https://pypi.org/project/wheel-filename/>`_\n| `Issues <https://github.com/jwodder/wheel-filename/issues>`_\n| `Changelog <https://github.com/jwodder/wheel-filename/blob/master/CHANGELOG.md>`_\n\n``wheel-filename`` lets you verify `wheel\n<https://www.python.org/dev/peps/pep-0427/>`_ filenames and parse them into\ntheir component fields.\n\nThis package adheres strictly to the relevant PEPs, with the following\nexceptions:\n\n- Unlike other filename components, version components may contain the\n characters ``!`` and ``+`` for full PEP 440 support.\n\n- Version components may be any sequence of the relevant set of characters;\n they are not verified for PEP 440 compliance.\n\n- The ``.whl`` file extension is matched case-insensitively.\n\n\nInstallation\n============\n``wheel-filename`` requires Python 3.6 or higher. Just use `pip\n<https://pip.pypa.io>`_ for Python 3 (You have pip, right?) to install\n``wheel-filename``::\n\n python3 -m pip install wheel-filename\n\n\nExample\n=======\n\n>>> from wheel_filename import parse_wheel_filename\n>>> pwf = parse_wheel_filename('pip-18.0-py2.py3-none-any.whl')\n>>> str(pwf)\n'pip-18.0-py2.py3-none-any.whl'\n>>> pwf.project\n'pip'\n>>> pwf.version\n'18.0'\n>>> pwf.build is None\nTrue\n>>> pwf.python_tags\n['py2', 'py3']\n>>> pwf.abi_tags\n['none']\n>>> pwf.platform_tags\n['any']\n>>> list(pwf.tag_triples())\n['py2-none-any', 'py3-none-any']\n\n\nAPI\n===\n\n``parse_wheel_filename(filename)``\n Parses a wheel filename (a ``str``, ``bytes``, or ``os.PathLike``) and\n returns a ``ParsedWheelFilename`` instance. Any leading directory\n components are stripped from the argument before processing. If the\n filename is not a valid wheel filename, raises an ``InvalidFilenameError``.\n\n``ParsedWheelFilename``\n A namedtuple representing the components of a wheel filename. It has the\n following attributes and methods:\n\n ``project: str``\n The name of the project distributed by the wheel\n\n ``version: str``\n The version of the project distributed by the wheel\n\n ``build: Optional[str]``\n The wheel's build tag (``None`` if not defined)\n\n ``python_tags: List[str]``\n A list of Python tags for the wheel\n\n ``abi_tags: List[str]``\n A list of ABI tags for the wheel\n\n ``platform_tags: List[str]``\n A list of platform tags for the wheel\n\n ``str(pwf)``\n Stringifying a ``ParsedWheelFilename`` returns the original filename\n\n ``tag_triples() -> Iterator[str]``\n Returns an iterator of all simple tag triples formed from the\n compatibility tags in the filename\n\n``InvalidFilenameError``\n A subclass of ``ValueError`` raised when an invalid wheel filename is passed\n to ``parse_wheel_filename()``. It has a ``filename`` attribute containing\n the basename of the invalid filename.\n\n\nCommand\n=======\n\n*New in version 1.4.0*\n\n``wheel-filename`` also provides a command of the same name that takes a wheel\nfilename (The actual wheel does not have to exist) and outputs the filename\ncomponents as JSON.\n\nExample::\n\n $ wheel-filename pip-18.0-py2.py3-none-any.whl\n {\n \"project\": \"pip\",\n \"version\": \"18.0\",\n \"build\": null,\n \"python_tags\": [\n \"py2\",\n \"py3\"\n ],\n \"abi_tags\": [\n \"none\"\n ],\n \"platform_tags\": [\n \"any\"\n ]\n }\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Parse wheel filenames",
"version": "1.4.1",
"split_keywords": [
"filename",
"pep427",
"wheel"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "6b359d428a44796520a8cdae7109039b",
"sha256": "a53d8ece58822eb27b3a8841c6b4bebf357f19ff0dd83ce9179756f64a4bc0df"
},
"downloads": -1,
"filename": "wheel_filename-1.4.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6b359d428a44796520a8cdae7109039b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "~=3.6",
"size": 6417,
"upload_time": "2022-05-31T13:31:00",
"upload_time_iso_8601": "2022-05-31T13:31:00.578799Z",
"url": "https://files.pythonhosted.org/packages/f4/a8/8da5a73d450cae099ed02c98161d706e10593a0ffbd24c462c1f932f2964/wheel_filename-1.4.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "182cdc6f002d3ee85dd83b64a504a6f6",
"sha256": "e2e1eb0780910a0148358252aad6394cc674250686c56c39aa379493438370b3"
},
"downloads": -1,
"filename": "wheel-filename-1.4.1.tar.gz",
"has_sig": false,
"md5_digest": "182cdc6f002d3ee85dd83b64a504a6f6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "~=3.6",
"size": 9070,
"upload_time": "2022-05-31T13:31:02",
"upload_time_iso_8601": "2022-05-31T13:31:02.317094Z",
"url": "https://files.pythonhosted.org/packages/2a/24/ffb1fc1340edbfd03c9fa9179b3242aedf2bea6d79c56150b5f8354eff25/wheel-filename-1.4.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-05-31 13:31:02",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "jwodder",
"github_project": "wheel-filename",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "wheel-filename"
}