packageurl-python


Namepackageurl-python JSON
Version 0.16.0 PyPI version JSON
download
home_pagehttps://github.com/package-url/packageurl-python
SummaryA purl aka. Package URL parser and builder
upload_time2024-10-22 05:51:25
maintainerNone
docs_urlNone
authorthe purl authors
requires_python>=3.8
licenseMIT
keywords package url package manager package url
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            =================
packageurl-python
=================

Python library to parse and build "purl" aka. Package URLs.
See https://github.com/package-url/purl-spec for details.

Join the discussion at https://gitter.im/package-url/Lobby or enter a ticket for support.

License: MIT

Tests and build status
======================

+----------------------+
| **Tests and build**  |
+======================+
| |ci-tests|           |
+----------------------+

Install
=======
::

    pip install packageurl-python

Usage
=====
::

    >>> from packageurl import PackageURL

    >>> purl = PackageURL.from_string("pkg:maven/org.apache.commons/io@1.3.4")
    >>> print(purl.to_dict())
    {'type': 'maven', 'namespace': 'org.apache.commons', 'name': 'io', 'version': '1.3.4', 'qualifiers': None, 'subpath': None}

    >>> print(purl.to_string())
    pkg:maven/org.apache.commons/io@1.3.4

    >>> print(str(purl))
    pkg:maven/org.apache.commons/io@1.3.4

    >>> print(repr(purl))
    PackageURL(type='maven', namespace='org.apache.commons', name='io', version='1.3.4', qualifiers={}, subpath=None)

Utilities
=========

Django models
^^^^^^^^^^^^^

`packageurl.contrib.django.models.PackageURLMixin` is a Django abstract model mixin to
use Package URLs in Django.

SQLAlchemy mixin
^^^^^^^^^^^^^^^^

`packageurl.contrib.sqlalchemy.mixin.PackageURLMixin` is a SQLAlchemy declarative mixin
to use Package URLs in SQLAlchemy models.

URL to PURL
^^^^^^^^^^^

`packageurl.contrib.url2purl.get_purl(url)` returns a Package URL inferred from an URL.

::

    >>> from packageurl.contrib import url2purl
    >>> url2purl.get_purl("https://github.com/package-url/packageurl-python")
    PackageURL(type='github', namespace='package-url', name='packageurl-python', version=None, qualifiers={}, subpath=None)

PURL to URL
^^^^^^^^^^^

- `packageurl.contrib.purl2url.get_repo_url(purl)` returns a repository URL inferred
  from a Package URL.
- `packageurl.contrib.purl2url.get_download_url(purl)` returns a download URL inferred
  from a Package URL.
- `packageurl.contrib.purl2url.get_inferred_urls(purl)` return all inferred URLs
  (repository, download) from a Package URL.

::

    >>> from packageurl.contrib import purl2url

    >>> purl2url.get_repo_url("pkg:gem/bundler@2.3.23")
    "https://rubygems.org/gems/bundler/versions/2.3.23"

    >>> purl2url.get_download_url("pkg:gem/bundler@2.3.23")
    "https://rubygems.org/downloads/bundler-2.3.23.gem"

    >>> purl2url.get_inferred_urls("pkg:gem/bundler@2.3.23")
    ["https://rubygems.org/gems/bundler/versions/2.3.23", "https://rubygems.org/downloads/bundler-2.3.23.gem"]

Run tests
=========

Install test dependencies::

    python3 thirdparty/virtualenv.pyz --never-download --no-periodic-update .
    bin/pip install -e ."[test]"

Run tests::

    bin/pytest tests

Make a new release
==================

- Start a new release branch
- Update the CHANGELOG.rst, AUTHORS.rst, and README.rst if needed
- Bump version in setup.cfg
- Run all tests
- Install restview and validate that all .rst docs are correct
- Commit and push this branch
- Make a PR and merge once approved
- Tag and push that tag. This triggers the pypi-release.yml workflow that takes care of
  building the dist release files and upload those to pypi::

    VERSION=v0.x.x
    git tag -a $VERSION -m "Tag $VERSION"
    git push origin $VERSION

- Review the GitHub release created by the workflow at
  https://github.com/package-url/packageurl-python/releases

.. |ci-tests| image:: https://github.com/package-url/packageurl-python/actions/workflows/ci.yml/badge.svg?branch=main
    :target: https://github.com/package-url/packageurl-python/actions/workflows/ci.yml
    :alt: CI Tests and build status

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/package-url/packageurl-python",
    "name": "packageurl-python",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "package, url, package manager, package url",
    "author": "the purl authors",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/68/7d/0bd319dc94c7956b4d864e87d3dc03739f125ce174671e3128edd566a63e/packageurl_python-0.16.0.tar.gz",
    "platform": null,
    "description": "=================\npackageurl-python\n=================\n\nPython library to parse and build \"purl\" aka. Package URLs.\nSee https://github.com/package-url/purl-spec for details.\n\nJoin the discussion at https://gitter.im/package-url/Lobby or enter a ticket for support.\n\nLicense: MIT\n\nTests and build status\n======================\n\n+----------------------+\n| **Tests and build**  |\n+======================+\n| |ci-tests|           |\n+----------------------+\n\nInstall\n=======\n::\n\n    pip install packageurl-python\n\nUsage\n=====\n::\n\n    >>> from packageurl import PackageURL\n\n    >>> purl = PackageURL.from_string(\"pkg:maven/org.apache.commons/io@1.3.4\")\n    >>> print(purl.to_dict())\n    {'type': 'maven', 'namespace': 'org.apache.commons', 'name': 'io', 'version': '1.3.4', 'qualifiers': None, 'subpath': None}\n\n    >>> print(purl.to_string())\n    pkg:maven/org.apache.commons/io@1.3.4\n\n    >>> print(str(purl))\n    pkg:maven/org.apache.commons/io@1.3.4\n\n    >>> print(repr(purl))\n    PackageURL(type='maven', namespace='org.apache.commons', name='io', version='1.3.4', qualifiers={}, subpath=None)\n\nUtilities\n=========\n\nDjango models\n^^^^^^^^^^^^^\n\n`packageurl.contrib.django.models.PackageURLMixin` is a Django abstract model mixin to\nuse Package URLs in Django.\n\nSQLAlchemy mixin\n^^^^^^^^^^^^^^^^\n\n`packageurl.contrib.sqlalchemy.mixin.PackageURLMixin` is a SQLAlchemy declarative mixin\nto use Package URLs in SQLAlchemy models.\n\nURL to PURL\n^^^^^^^^^^^\n\n`packageurl.contrib.url2purl.get_purl(url)` returns a Package URL inferred from an URL.\n\n::\n\n    >>> from packageurl.contrib import url2purl\n    >>> url2purl.get_purl(\"https://github.com/package-url/packageurl-python\")\n    PackageURL(type='github', namespace='package-url', name='packageurl-python', version=None, qualifiers={}, subpath=None)\n\nPURL to URL\n^^^^^^^^^^^\n\n- `packageurl.contrib.purl2url.get_repo_url(purl)` returns a repository URL inferred\n  from a Package URL.\n- `packageurl.contrib.purl2url.get_download_url(purl)` returns a download URL inferred\n  from a Package URL.\n- `packageurl.contrib.purl2url.get_inferred_urls(purl)` return all inferred URLs\n  (repository, download) from a Package URL.\n\n::\n\n    >>> from packageurl.contrib import purl2url\n\n    >>> purl2url.get_repo_url(\"pkg:gem/bundler@2.3.23\")\n    \"https://rubygems.org/gems/bundler/versions/2.3.23\"\n\n    >>> purl2url.get_download_url(\"pkg:gem/bundler@2.3.23\")\n    \"https://rubygems.org/downloads/bundler-2.3.23.gem\"\n\n    >>> purl2url.get_inferred_urls(\"pkg:gem/bundler@2.3.23\")\n    [\"https://rubygems.org/gems/bundler/versions/2.3.23\", \"https://rubygems.org/downloads/bundler-2.3.23.gem\"]\n\nRun tests\n=========\n\nInstall test dependencies::\n\n    python3 thirdparty/virtualenv.pyz --never-download --no-periodic-update .\n    bin/pip install -e .\"[test]\"\n\nRun tests::\n\n    bin/pytest tests\n\nMake a new release\n==================\n\n- Start a new release branch\n- Update the CHANGELOG.rst, AUTHORS.rst, and README.rst if needed\n- Bump version in setup.cfg\n- Run all tests\n- Install restview and validate that all .rst docs are correct\n- Commit and push this branch\n- Make a PR and merge once approved\n- Tag and push that tag. This triggers the pypi-release.yml workflow that takes care of\n  building the dist release files and upload those to pypi::\n\n    VERSION=v0.x.x\n    git tag -a $VERSION -m \"Tag $VERSION\"\n    git push origin $VERSION\n\n- Review the GitHub release created by the workflow at\n  https://github.com/package-url/packageurl-python/releases\n\n.. |ci-tests| image:: https://github.com/package-url/packageurl-python/actions/workflows/ci.yml/badge.svg?branch=main\n    :target: https://github.com/package-url/packageurl-python/actions/workflows/ci.yml\n    :alt: CI Tests and build status\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A purl aka. Package URL parser and builder",
    "version": "0.16.0",
    "project_urls": {
        "Homepage": "https://github.com/package-url/packageurl-python"
    },
    "split_keywords": [
        "package",
        " url",
        " package manager",
        " package url"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c4473c197fb7596a813afef2e4198d507b761aed2c7150d90be64dff9fe0ea71",
                "md5": "60714b7eab3e24b416c7e236738d9934",
                "sha256": "5c3872638b177b0f1cf01c3673017b7b27ebee485693ae12a8bed70fa7fa7c35"
            },
            "downloads": -1,
            "filename": "packageurl_python-0.16.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "60714b7eab3e24b416c7e236738d9934",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 28544,
            "upload_time": "2024-10-22T05:51:23",
            "upload_time_iso_8601": "2024-10-22T05:51:23.924629Z",
            "url": "https://files.pythonhosted.org/packages/c4/47/3c197fb7596a813afef2e4198d507b761aed2c7150d90be64dff9fe0ea71/packageurl_python-0.16.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "687d0bd319dc94c7956b4d864e87d3dc03739f125ce174671e3128edd566a63e",
                "md5": "7510a4ac5e76a176e0d2231b43f5321b",
                "sha256": "69e3bf8a3932fe9c2400f56aaeb9f86911ecee2f9398dbe1b58ec34340be365d"
            },
            "downloads": -1,
            "filename": "packageurl_python-0.16.0.tar.gz",
            "has_sig": false,
            "md5_digest": "7510a4ac5e76a176e0d2231b43f5321b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 40492,
            "upload_time": "2024-10-22T05:51:25",
            "upload_time_iso_8601": "2024-10-22T05:51:25.708528Z",
            "url": "https://files.pythonhosted.org/packages/68/7d/0bd319dc94c7956b4d864e87d3dc03739f125ce174671e3128edd566a63e/packageurl_python-0.16.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-22 05:51:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "package-url",
    "github_project": "packageurl-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "packageurl-python"
}
        
Elapsed time: 0.40029s