From eae13cf4b98739f3540aca2670ca871dbb5564bd Mon Sep 17 00:00:00 2001 From: Tushar Goel Date: Fri, 11 Nov 2022 14:53:57 +0530 Subject: [PATCH] Replaced Packaging module with Packvers in different files. Signed-off-by: swastik --- CHANGELOG.rst | 4 - requirements.txt | 5 +- setup.cfg | 7 +- src/_packagedcode/pypi.py | 11 +- src/python_inspector/api.py | 7 +- src/python_inspector/dependencies.py | 2 +- src/python_inspector/resolution.py | 14 +- src/python_inspector/resolve_cli.py | 4 +- src/python_inspector/setup_py_live_eval.py | 2 +- .../utils_pip_compatibility_tags.py | 12 +- src/python_inspector/utils_pypi.py | 13 +- .../frozen-requirements.txt-expected.json | 34 +- tests/data/test-api-with-python-311.json | 424 ------------------ .../data/test-api-with-requirement-file.json | 36 +- tests/test_api.py | 21 - tests/test_cli.py | 10 +- tests/test_resolution.py | 12 +- 17 files changed, 86 insertions(+), 532 deletions(-) delete mode 100644 tests/data/test-api-with-python-311.json diff --git a/CHANGELOG.rst b/CHANGELOG.rst index bb606251..94574377 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,10 +6,6 @@ v0.9.3 ------ - Add support for recursive requirements. -- Add python 3.11 as a valid python version in choices. -- Operating system and python version are now required fields in CLI. -- Add dot versions (3.6, 3.7, 3.8, 3.9, 3.10, 3.11, 2.7) with - current python version choices for CLI (36, 37, 38, 39, 310, 311, 27). v0.9.2 diff --git a/requirements.txt b/requirements.txt index 1f953e2f..f763956b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,13 +5,14 @@ charset-normalizer==2.1.0 click==8.1.3 colorama==0.4.5 commoncode==30.2.0 -dparse2==0.6.1 +dparse2==0.7.0 idna==3.3 importlib-metadata==4.12.0 intbitset==3.0.1 packageurl-python==0.10.0 packaging==21.3 -pip-requirements-parser==31.2.0 +packvers==21.5 +pip-requirements-parser==32.0.1 pkginfo2==30.0.0 pyparsing==3.0.9 PyYAML==6.0 diff --git a/setup.cfg b/setup.cfg index 73d7b7e6..04e3412b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -58,18 +58,19 @@ install_requires = click > 7.0 colorama >= 0.3.9 commoncode >= 30.0.0 - dparse2 >= 0.6.1 + dparse2 >= 0.7.0 importlib_metadata >= 4.12.0 packageurl_python >= 0.9.0 pkginfo2 >= 30.0.0 - pip-requirements-parser >= 31.2.0 + pip-requirements-parser >= 32.0.1 requests >= 2.18.0 resolvelib >= 0.8.1 saneyaml >= 0.5.2 tinynetrc >= 1.3.1 toml >= 0.10.0 mock >= 3.0.5 - + packaging >= 21.0.0 + packvers >= 21.5 [options.packages.find] where = src diff --git a/src/_packagedcode/pypi.py b/src/_packagedcode/pypi.py index a76b6f8d..86fda70f 100644 --- a/src/_packagedcode/pypi.py +++ b/src/_packagedcode/pypi.py @@ -22,15 +22,14 @@ import zipfile import dparse2 -import packaging +import packvers as packaging import pip_requirements_parser -import pkginfo2 from commoncode import fileutils -from packaging.specifiers import SpecifierSet +from packvers.specifiers import SpecifierSet from packageurl import PackageURL -from packaging import markers -from packaging.requirements import Requirement -from packaging.utils import canonicalize_name +from packvers import markers +from packvers.requirements import Requirement +from packvers.utils import canonicalize_name from _packagedcode import models from _packagedcode.utils import build_description diff --git a/src/python_inspector/api.py b/src/python_inspector/api.py index 42711568..51f8a5cd 100644 --- a/src/python_inspector/api.py +++ b/src/python_inspector/api.py @@ -16,7 +16,7 @@ from typing import Sequence from packageurl import PackageURL -from packaging.requirements import Requirement +from packvers.requirements import Requirement from resolvelib import BaseReporter from resolvelib import Resolver from tinynetrc import Netrc @@ -40,8 +40,8 @@ from python_inspector.resolution import get_requirements_from_python_manifest from python_inspector.utils_pypi import PLATFORMS_BY_OS from python_inspector.utils_pypi import PYPI_SIMPLE_URL +from python_inspector.utils_pypi import PYTHON_DOT_VERSIONS_BY_VER from python_inspector.utils_pypi import Environment -from python_inspector.utils_pypi import valid_python_versions class Resolution(NamedTuple): @@ -103,6 +103,9 @@ def resolve_dependencies( f"Must be one of: {', '.join(PLATFORMS_BY_OS.keys())}" ) + valid_python_versions = list(PYTHON_DOT_VERSIONS_BY_VER.keys()) + valid_python_versions.extend([dot_ver for pyver, dot_ver in PYTHON_DOT_VERSIONS_BY_VER.items()]) + if not python_version: raise Exception(f"No python version provided.") if python_version not in valid_python_versions: diff --git a/src/python_inspector/dependencies.py b/src/python_inspector/dependencies.py index 7ba7fcb6..a7aec863 100644 --- a/src/python_inspector/dependencies.py +++ b/src/python_inspector/dependencies.py @@ -10,7 +10,7 @@ # from packageurl import PackageURL -from packaging.requirements import Requirement +from packvers.requirements import Requirement from pip_requirements_parser import InstallRequirement from _packagedcode import models diff --git a/src/python_inspector/resolution.py b/src/python_inspector/resolution.py index 8c0016c6..c86f7a8a 100644 --- a/src/python_inspector/resolution.py +++ b/src/python_inspector/resolution.py @@ -18,12 +18,12 @@ from typing import Union from zipfile import ZipFile -import packaging.utils +import packvers.utils from packageurl import PackageURL -from packaging.requirements import Requirement -from packaging.version import LegacyVersion -from packaging.version import Version -from packaging.version import parse as parse_version +from packvers.requirements import Requirement +from packvers.version import LegacyVersion +from packvers.version import Version +from packvers.version import parse as parse_version from resolvelib import AbstractProvider from resolvelib.structs import DirectedGraph @@ -325,7 +325,7 @@ def __init__( def identify(self, requirement_or_candidate: Union[Candidate, Requirement]) -> str: """Given a requirement, return an identifier for it. Overridden.""" - name = packaging.utils.canonicalize_name(requirement_or_candidate.name) + name = packvers.utils.canonicalize_name(requirement_or_candidate.name) if requirement_or_candidate.extras: extras_str = ",".join(sorted(requirement_or_candidate.extras)) return "{}[{}]".format(name, extras_str) @@ -576,7 +576,7 @@ def _iter_dependencies(self, candidate: Candidate) -> Generator[Requirement, Non """ Yield dependencies for the given candidate. """ - name = packaging.utils.canonicalize_name(candidate.name) + name = packvers.utils.canonicalize_name(candidate.name) # TODO: handle extras https://github.com/nexB/python-inspector/issues/10 if candidate.extras: r = f"{name}=={candidate.version}" diff --git a/src/python_inspector/resolve_cli.py b/src/python_inspector/resolve_cli.py index 687f1f2d..ab59e782 100644 --- a/src/python_inspector/resolve_cli.py +++ b/src/python_inspector/resolve_cli.py @@ -70,10 +70,9 @@ def print_version(ctx, param, value): "-p", "--python-version", "python_version", - type=click.Choice(utils_pypi.valid_python_versions), + type=click.Choice(utils_pypi.PYTHON_VERSIONS), metavar="PYVER", show_default=True, - required=True, help="Python version to use for dependency resolution.", ) @click.option( @@ -83,7 +82,6 @@ def print_version(ctx, param, value): type=click.Choice(utils_pypi.PLATFORMS_BY_OS), metavar="OS", show_default=True, - required=True, help="OS to use for dependency resolution.", ) @click.option( diff --git a/src/python_inspector/setup_py_live_eval.py b/src/python_inspector/setup_py_live_eval.py index 129cc185..e9515e55 100755 --- a/src/python_inspector/setup_py_live_eval.py +++ b/src/python_inspector/setup_py_live_eval.py @@ -21,7 +21,7 @@ import mock import setuptools from commoncode.command import pushd -from packaging.requirements import Requirement +from packvers.requirements import Requirement def minver_error(pkg_name): diff --git a/src/python_inspector/utils_pip_compatibility_tags.py b/src/python_inspector/utils_pip_compatibility_tags.py index 122ae59a..afe3fb3b 100644 --- a/src/python_inspector/utils_pip_compatibility_tags.py +++ b/src/python_inspector/utils_pip_compatibility_tags.py @@ -27,12 +27,12 @@ import re -from packaging.tags import compatible_tags -from packaging.tags import cpython_tags -from packaging.tags import generic_tags -from packaging.tags import interpreter_name -from packaging.tags import interpreter_version -from packaging.tags import mac_platforms +from packvers.tags import compatible_tags +from packvers.tags import cpython_tags +from packvers.tags import generic_tags +from packvers.tags import interpreter_name +from packvers.tags import interpreter_version +from packvers.tags import mac_platforms _osx_arch_pat = re.compile(r"(.+)_(\d+)_(\d+)_(.+)") diff --git a/src/python_inspector/utils_pypi.py b/src/python_inspector/utils_pypi.py index 7b30525d..2846275d 100644 --- a/src/python_inspector/utils_pypi.py +++ b/src/python_inspector/utils_pypi.py @@ -26,9 +26,9 @@ from bs4 import BeautifulSoup from commoncode import fileutils from commoncode.hash import multi_checksums -from packaging import tags as packaging_tags -from packaging import version as packaging_version -from packaging.specifiers import SpecifierSet +from packvers import tags as packaging_tags +from packvers import version as packaging_version +from packvers.specifiers import SpecifierSet from python_inspector import DEFAULT_PYTHON_VERSION from python_inspector import utils_pip_compatibility_tags @@ -98,7 +98,7 @@ TRACE_ULTRA_DEEP = False # Supported environments -PYTHON_VERSIONS = "36", "37", "38", "39", "310", "311", "27" +PYTHON_VERSIONS = "36", "37", "38", "39", "310", "27" PYTHON_DOT_VERSIONS_BY_VER = { "36": "3.6", @@ -107,12 +107,8 @@ "39": "3.9", "310": "3.10", "27": "2.7", - "311": "3.11", } -valid_python_versions = list(PYTHON_DOT_VERSIONS_BY_VER.keys()) -valid_python_versions.extend([dot_ver for pyver, dot_ver in PYTHON_DOT_VERSIONS_BY_VER.items()]) - def get_python_dot_version(version): """ @@ -127,7 +123,6 @@ def get_python_dot_version(version): "38": ["cp38", "cp38m", "abi3"], "39": ["cp39", "cp39m", "abi3"], "310": ["cp310", "cp310m", "abi3"], - "311": ["cp311", "cp311m", "abi3"], "27": ["cp27", "cp27m"], } diff --git a/tests/data/frozen-requirements.txt-expected.json b/tests/data/frozen-requirements.txt-expected.json index 5d2d4b80..e6d92355 100644 --- a/tests/data/frozen-requirements.txt-expected.json +++ b/tests/data/frozen-requirements.txt-expected.json @@ -6013,12 +6013,12 @@ "type": "pypi", "namespace": null, "name": "pip", - "version": "22.3.1", + "version": "22.3", "qualifiers": {}, "subpath": null, "primary_language": "Python", "description": "The PyPA recommended tool for installing Python packages.\npip - The Python Package Installer\n==================================\n\n.. image:: https://img.shields.io/pypi/v/pip.svg\n :target: https://pypi.org/project/pip/\n\n.. image:: https://readthedocs.org/projects/pip/badge/?version=latest\n :target: https://pip.pypa.io/en/latest\n\npip is the `package installer`_ for Python. You can use pip to install packages from the `Python Package Index`_ and other indexes.\n\nPlease take a look at our documentation for how to install and use pip:\n\n* `Installation`_\n* `Usage`_\n\nWe release updates regularly, with a new version every 3 months. Find more details in our documentation:\n\n* `Release notes`_\n* `Release process`_\n\nIn pip 20.3, we've `made a big improvement to the heart of pip`_; `learn more`_. We want your input, so `sign up for our user experience research studies`_ to help us do it right.\n\n**Note**: pip 21.0, in January 2021, removed Python 2 support, per pip's `Python 2 support policy`_. Please migrate to Python 3.\n\nIf you find bugs, need help, or want to talk to the developers, please use our mailing lists or chat rooms:\n\n* `Issue tracking`_\n* `Discourse channel`_\n* `User IRC`_\n\nIf you want to get involved head over to GitHub to get the source code, look at our development documentation and feel free to jump on the developer mailing lists and chat rooms:\n\n* `GitHub page`_\n* `Development documentation`_\n* `Development IRC`_\n\nCode of Conduct\n---------------\n\nEveryone interacting in the pip project's codebases, issue trackers, chat\nrooms, and mailing lists is expected to follow the `PSF Code of Conduct`_.\n\n.. _package installer: https://packaging.python.org/guides/tool-recommendations/\n.. _Python Package Index: https://pypi.org\n.. _Installation: https://pip.pypa.io/en/stable/installation/\n.. _Usage: https://pip.pypa.io/en/stable/\n.. _Release notes: https://pip.pypa.io/en/stable/news.html\n.. _Release process: https://pip.pypa.io/en/latest/development/release-process/\n.. _GitHub page: https://github.com/pypa/pip\n.. _Development documentation: https://pip.pypa.io/en/latest/development\n.. _made a big improvement to the heart of pip: https://pyfound.blogspot.com/2020/11/pip-20-3-new-resolver.html\n.. _learn more: https://pip.pypa.io/en/latest/user_guide/#changes-to-the-pip-dependency-resolver-in-20-3-2020\n.. _sign up for our user experience research studies: https://pyfound.blogspot.com/2020/03/new-pip-resolver-to-roll-out-this-year.html\n.. _Python 2 support policy: https://pip.pypa.io/en/latest/development/release-process/#python-2-support\n.. _Issue tracking: https://github.com/pypa/pip/issues\n.. _Discourse channel: https://discuss.python.org/c/packaging\n.. _User IRC: https://kiwiirc.com/nextclient/#ircs://irc.libera.chat:+6697/pypa\n.. _Development IRC: https://kiwiirc.com/nextclient/#ircs://irc.libera.chat:+6697/pypa-dev\n.. _PSF Code of Conduct: https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md", - "release_date": "2022-11-05T15:56:17", + "release_date": "2022-10-15T11:41:14", "parties": [ { "type": "person", @@ -6044,11 +6044,11 @@ "Topic :: Software Development :: Build Tools" ], "homepage_url": "https://pip.pypa.io/", - "download_url": "https://files.pythonhosted.org/packages/09/bd/2410905c76ee14c62baf69e3f4aa780226c1bbfc9485731ad018e35b0cb5/pip-22.3.1-py3-none-any.whl", - "size": 2051534, + "download_url": "https://files.pythonhosted.org/packages/47/ef/8b5470b5b94b36231ed9c0bde90caa71c0d4322d4a15f009b2b7f4287fe0/pip-22.3-py3-none-any.whl", + "size": 2051507, "sha1": null, - "md5": "74d0d338e0af6ca545d6ce7ef9734d75", - "sha256": "908c78e6bc29b676ede1c4d57981d490cb892eb45cd8c214ab6298125119e077", + "md5": "6123dc5fc3483ebb12becce7faa4cd28", + "sha256": "1daab4b8d3b97d1d763caeb01a4640a2250a0ea899e257b1e44b9eded91e15ab", "sha512": null, "bug_tracking_url": null, "code_view_url": "https://github.com/pypa/pip", @@ -6068,20 +6068,20 @@ "dependencies": [], "repository_homepage_url": null, "repository_download_url": null, - "api_data_url": "https://pypi.org/pypi/pip/22.3.1/json", + "api_data_url": "https://pypi.org/pypi/pip/22.3/json", "datasource_id": null, - "purl": "pkg:pypi/pip@22.3.1" + "purl": "pkg:pypi/pip@22.3" }, { "type": "pypi", "namespace": null, "name": "pip", - "version": "22.3.1", + "version": "22.3", "qualifiers": {}, "subpath": null, "primary_language": "Python", "description": "The PyPA recommended tool for installing Python packages.\npip - The Python Package Installer\n==================================\n\n.. image:: https://img.shields.io/pypi/v/pip.svg\n :target: https://pypi.org/project/pip/\n\n.. image:: https://readthedocs.org/projects/pip/badge/?version=latest\n :target: https://pip.pypa.io/en/latest\n\npip is the `package installer`_ for Python. You can use pip to install packages from the `Python Package Index`_ and other indexes.\n\nPlease take a look at our documentation for how to install and use pip:\n\n* `Installation`_\n* `Usage`_\n\nWe release updates regularly, with a new version every 3 months. Find more details in our documentation:\n\n* `Release notes`_\n* `Release process`_\n\nIn pip 20.3, we've `made a big improvement to the heart of pip`_; `learn more`_. We want your input, so `sign up for our user experience research studies`_ to help us do it right.\n\n**Note**: pip 21.0, in January 2021, removed Python 2 support, per pip's `Python 2 support policy`_. Please migrate to Python 3.\n\nIf you find bugs, need help, or want to talk to the developers, please use our mailing lists or chat rooms:\n\n* `Issue tracking`_\n* `Discourse channel`_\n* `User IRC`_\n\nIf you want to get involved head over to GitHub to get the source code, look at our development documentation and feel free to jump on the developer mailing lists and chat rooms:\n\n* `GitHub page`_\n* `Development documentation`_\n* `Development IRC`_\n\nCode of Conduct\n---------------\n\nEveryone interacting in the pip project's codebases, issue trackers, chat\nrooms, and mailing lists is expected to follow the `PSF Code of Conduct`_.\n\n.. _package installer: https://packaging.python.org/guides/tool-recommendations/\n.. _Python Package Index: https://pypi.org\n.. _Installation: https://pip.pypa.io/en/stable/installation/\n.. _Usage: https://pip.pypa.io/en/stable/\n.. _Release notes: https://pip.pypa.io/en/stable/news.html\n.. _Release process: https://pip.pypa.io/en/latest/development/release-process/\n.. _GitHub page: https://github.com/pypa/pip\n.. _Development documentation: https://pip.pypa.io/en/latest/development\n.. _made a big improvement to the heart of pip: https://pyfound.blogspot.com/2020/11/pip-20-3-new-resolver.html\n.. _learn more: https://pip.pypa.io/en/latest/user_guide/#changes-to-the-pip-dependency-resolver-in-20-3-2020\n.. _sign up for our user experience research studies: https://pyfound.blogspot.com/2020/03/new-pip-resolver-to-roll-out-this-year.html\n.. _Python 2 support policy: https://pip.pypa.io/en/latest/development/release-process/#python-2-support\n.. _Issue tracking: https://github.com/pypa/pip/issues\n.. _Discourse channel: https://discuss.python.org/c/packaging\n.. _User IRC: https://kiwiirc.com/nextclient/#ircs://irc.libera.chat:+6697/pypa\n.. _Development IRC: https://kiwiirc.com/nextclient/#ircs://irc.libera.chat:+6697/pypa-dev\n.. _PSF Code of Conduct: https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md", - "release_date": "2022-11-05T15:56:20", + "release_date": "2022-10-15T11:41:17", "parties": [ { "type": "person", @@ -6107,11 +6107,11 @@ "Topic :: Software Development :: Build Tools" ], "homepage_url": "https://pip.pypa.io/", - "download_url": "https://files.pythonhosted.org/packages/a3/50/c4d2727b99052780aad92c7297465af5fe6eec2dbae490aa9763273ffdc1/pip-22.3.1.tar.gz", - "size": 2078129, + "download_url": "https://files.pythonhosted.org/packages/f8/08/7f92782ff571c7c7cb6c5eeb8ebbb1f68cb02bdb24e55c5de4dd9ce98bc3/pip-22.3.tar.gz", + "size": 2077961, "sha1": null, - "md5": "996f58a94fe0b8b82b6795c42bd171ba", - "sha256": "65fd48317359f3af8e593943e6ae1506b66325085ea64b706a998c6e83eeaf38", + "md5": "f0dd02265e7ccd2f8758c840fba64810", + "sha256": "8182aec21dad6c0a49a2a3d121a87cd524b950e0b6092b181625f07ebdde7530", "sha512": null, "bug_tracking_url": null, "code_view_url": "https://github.com/pypa/pip", @@ -6131,9 +6131,9 @@ "dependencies": [], "repository_homepage_url": null, "repository_download_url": null, - "api_data_url": "https://pypi.org/pypi/pip/22.3.1/json", + "api_data_url": "https://pypi.org/pypi/pip/22.3/json", "datasource_id": null, - "purl": "pkg:pypi/pip@22.3.1" + "purl": "pkg:pypi/pip@22.3" }, { "type": "pypi", @@ -10940,7 +10940,7 @@ { "key": "pip", "package_name": "pip", - "installed_version": "22.3.1", + "installed_version": "22.3", "dependencies": [] } ] diff --git a/tests/data/test-api-with-python-311.json b/tests/data/test-api-with-python-311.json deleted file mode 100644 index 563efacf..00000000 --- a/tests/data/test-api-with-python-311.json +++ /dev/null @@ -1,424 +0,0 @@ -{ - "files": [], - "packages": [ - { - "type": "pypi", - "namespace": null, - "name": "click", - "version": "8.1.3", - "qualifiers": {}, - "subpath": null, - "primary_language": "Python", - "description": "Composable command line interface toolkit\n\\$ click\\_\n==========\n\nClick is a Python package for creating beautiful command line interfaces\nin a composable way with as little code as necessary. It's the \"Command\nLine Interface Creation Kit\". It's highly configurable but comes with\nsensible defaults out of the box.\n\nIt aims to make the process of writing command line tools quick and fun\nwhile also preventing any frustration caused by the inability to\nimplement an intended CLI API.\n\nClick in three points:\n\n- Arbitrary nesting of commands\n- Automatic help page generation\n- Supports lazy loading of subcommands at runtime\n\n\nInstalling\n----------\n\nInstall and update using `pip`_:\n\n.. code-block:: text\n\n $ pip install -U click\n\n.. _pip: https://pip.pypa.io/en/stable/getting-started/\n\n\nA Simple Example\n----------------\n\n.. code-block:: python\n\n import click\n\n @click.command()\n @click.option(\"--count\", default=1, help=\"Number of greetings.\")\n @click.option(\"--name\", prompt=\"Your name\", help=\"The person to greet.\")\n def hello(count, name):\n \"\"\"Simple program that greets NAME for a total of COUNT times.\"\"\"\n for _ in range(count):\n click.echo(f\"Hello, {name}!\")\n\n if __name__ == '__main__':\n hello()\n\n.. code-block:: text\n\n $ python hello.py --count=3\n Your name: Click\n Hello, Click!\n Hello, Click!\n Hello, Click!\n\n\nDonate\n------\n\nThe Pallets organization develops and supports Click and other popular\npackages. In order to grow the community of contributors and users, and\nallow the maintainers to devote more time to the projects, `please\ndonate today`_.\n\n.. _please donate today: https://palletsprojects.com/donate\n\n\nLinks\n-----\n\n- Documentation: https://click.palletsprojects.com/\n- Changes: https://click.palletsprojects.com/changes/\n- PyPI Releases: https://pypi.org/project/click/\n- Source Code: https://github.com/pallets/click\n- Issue Tracker: https://github.com/pallets/click/issues\n- Website: https://palletsprojects.com/p/click\n- Twitter: https://twitter.com/PalletsTeam\n- Chat: https://discord.gg/pallets", - "release_date": "2022-04-28T17:36:09", - "parties": [ - { - "type": "person", - "role": "author", - "name": "Armin Ronacher", - "email": "armin.ronacher@active-4.com", - "url": null - }, - { - "type": "person", - "role": "maintainer", - "name": "Pallets", - "email": "contact@palletsprojects.com", - "url": null - } - ], - "keywords": [ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "Operating System :: OS Independent", - "Programming Language :: Python" - ], - "homepage_url": "https://palletsprojects.com/p/click/", - "download_url": "https://files.pythonhosted.org/packages/59/87/84326af34517fca8c58418d148f2403df25303e02736832403587318e9e8/click-8.1.3.tar.gz", - "size": 331147, - "sha1": null, - "md5": "a804b085de7a3ff96968e38e0f6f2e05", - "sha256": "7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e", - "sha512": null, - "bug_tracking_url": "https://github.com/pallets/click/issues/", - "code_view_url": "https://github.com/pallets/click/", - "vcs_url": null, - "copyright": null, - "license_expression": null, - "declared_license": { - "license": "BSD-3-Clause", - "classifiers": [ - "License :: OSI Approved :: BSD License" - ] - }, - "notice_text": null, - "source_packages": [], - "file_references": [], - "extra_data": {}, - "dependencies": [], - "repository_homepage_url": null, - "repository_download_url": null, - "api_data_url": "https://pypi.org/pypi/click/8.1.3/json", - "datasource_id": null, - "purl": "pkg:pypi/click@8.1.3" - }, - { - "type": "pypi", - "namespace": null, - "name": "flask", - "version": "2.1.2", - "qualifiers": {}, - "subpath": null, - "primary_language": "Python", - "description": "A simple framework for building complex web applications.\nFlask\n=====\n\nFlask is a lightweight `WSGI`_ web application framework. It is designed\nto make getting started quick and easy, with the ability to scale up to\ncomplex applications. It began as a simple wrapper around `Werkzeug`_\nand `Jinja`_ and has become one of the most popular Python web\napplication frameworks.\n\nFlask offers suggestions, but doesn't enforce any dependencies or\nproject layout. It is up to the developer to choose the tools and\nlibraries they want to use. There are many extensions provided by the\ncommunity that make adding new functionality easy.\n\n.. _WSGI: https://wsgi.readthedocs.io/\n.. _Werkzeug: https://werkzeug.palletsprojects.com/\n.. _Jinja: https://jinja.palletsprojects.com/\n\n\nInstalling\n----------\n\nInstall and update using `pip`_:\n\n.. code-block:: text\n\n $ pip install -U Flask\n\n.. _pip: https://pip.pypa.io/en/stable/getting-started/\n\n\nA Simple Example\n----------------\n\n.. code-block:: python\n\n # save this as app.py\n from flask import Flask\n\n app = Flask(__name__)\n\n @app.route(\"/\")\n def hello():\n return \"Hello, World!\"\n\n.. code-block:: text\n\n $ flask run\n * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)\n\n\nContributing\n------------\n\nFor guidance on setting up a development environment and how to make a\ncontribution to Flask, see the `contributing guidelines`_.\n\n.. _contributing guidelines: https://github.com/pallets/flask/blob/main/CONTRIBUTING.rst\n\n\nDonate\n------\n\nThe Pallets organization develops and supports Flask and the libraries\nit uses. In order to grow the community of contributors and users, and\nallow the maintainers to devote more time to the projects, `please\ndonate today`_.\n\n.. _please donate today: https://palletsprojects.com/donate\n\n\nLinks\n-----\n\n- Documentation: https://flask.palletsprojects.com/\n- Changes: https://flask.palletsprojects.com/changes/\n- PyPI Releases: https://pypi.org/project/Flask/\n- Source Code: https://github.com/pallets/flask/\n- Issue Tracker: https://github.com/pallets/flask/issues/\n- Website: https://palletsprojects.com/p/flask/\n- Twitter: https://twitter.com/PalletsTeam\n- Chat: https://discord.gg/pallets", - "release_date": "2022-04-28T17:47:40", - "parties": [ - { - "type": "person", - "role": "author", - "name": "Armin Ronacher", - "email": "armin.ronacher@active-4.com", - "url": null - }, - { - "type": "person", - "role": "maintainer", - "name": "Pallets", - "email": "contact@palletsprojects.com", - "url": null - } - ], - "keywords": [ - "Development Status :: 5 - Production/Stable", - "Environment :: Web Environment", - "Framework :: Flask", - "Intended Audience :: Developers", - "Operating System :: OS Independent", - "Programming Language :: Python", - "Topic :: Internet :: WWW/HTTP :: Dynamic Content", - "Topic :: Internet :: WWW/HTTP :: WSGI", - "Topic :: Internet :: WWW/HTTP :: WSGI :: Application", - "Topic :: Software Development :: Libraries :: Application Frameworks" - ], - "homepage_url": "https://palletsprojects.com/p/flask", - "download_url": "https://files.pythonhosted.org/packages/d3/3c/94f38d4db919a9326a706ad56f05a7e6f0c8f7b7d93e2997cca54d3bc14b/Flask-2.1.2.tar.gz", - "size": 631846, - "sha1": null, - "md5": "93f1832e5be704ef6ff2a4124579cd85", - "sha256": "315ded2ddf8a6281567edb27393010fe3406188bafbfe65a3339d5787d89e477", - "sha512": null, - "bug_tracking_url": "https://github.com/pallets/flask/issues/", - "code_view_url": "https://github.com/pallets/flask/", - "vcs_url": null, - "copyright": null, - "license_expression": null, - "declared_license": { - "license": "BSD-3-Clause", - "classifiers": [ - "License :: OSI Approved :: BSD License" - ] - }, - "notice_text": null, - "source_packages": [], - "file_references": [], - "extra_data": {}, - "dependencies": [], - "repository_homepage_url": null, - "repository_download_url": null, - "api_data_url": "https://pypi.org/pypi/flask/2.1.2/json", - "datasource_id": null, - "purl": "pkg:pypi/flask@2.1.2" - }, - { - "type": "pypi", - "namespace": null, - "name": "itsdangerous", - "version": "2.1.2", - "qualifiers": {}, - "subpath": null, - "primary_language": "Python", - "description": "Safely pass data to untrusted environments and back.\nItsDangerous\n============\n\n... so better sign this\n\nVarious helpers to pass data to untrusted environments and to get it\nback safe and sound. Data is cryptographically signed to ensure that a\ntoken has not been tampered with.\n\nIt's possible to customize how data is serialized. Data is compressed as\nneeded. A timestamp can be added and verified automatically while\nloading a token.\n\n\nInstalling\n----------\n\nInstall and update using `pip`_:\n\n.. code-block:: text\n\n pip install -U itsdangerous\n\n.. _pip: https://pip.pypa.io/en/stable/getting-started/\n\n\nA Simple Example\n----------------\n\nHere's how you could generate a token for transmitting a user's id and\nname between web requests.\n\n.. code-block:: python\n\n from itsdangerous import URLSafeSerializer\n auth_s = URLSafeSerializer(\"secret key\", \"auth\")\n token = auth_s.dumps({\"id\": 5, \"name\": \"itsdangerous\"})\n\n print(token)\n # eyJpZCI6NSwibmFtZSI6Iml0c2Rhbmdlcm91cyJ9.6YP6T0BaO67XP--9UzTrmurXSmg\n\n data = auth_s.loads(token)\n print(data[\"name\"])\n # itsdangerous\n\n\nDonate\n------\n\nThe Pallets organization develops and supports ItsDangerous and other\npopular packages. In order to grow the community of contributors and\nusers, and allow the maintainers to devote more time to the projects,\n`please donate today`_.\n\n.. _please donate today: https://palletsprojects.com/donate\n\n\nLinks\n-----\n\n- Documentation: https://itsdangerous.palletsprojects.com/\n- Changes: https://itsdangerous.palletsprojects.com/changes/\n- PyPI Releases: https://pypi.org/project/ItsDangerous/\n- Source Code: https://github.com/pallets/itsdangerous/\n- Issue Tracker: https://github.com/pallets/itsdangerous/issues/\n- Website: https://palletsprojects.com/p/itsdangerous/\n- Twitter: https://twitter.com/PalletsTeam\n- Chat: https://discord.gg/pallets", - "release_date": "2022-03-24T15:12:15", - "parties": [ - { - "type": "person", - "role": "author", - "name": "Armin Ronacher", - "email": "armin.ronacher@active-4.com", - "url": null - }, - { - "type": "person", - "role": "maintainer", - "name": "Pallets", - "email": "contact@palletsprojects.com", - "url": null - } - ], - "keywords": [ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "Operating System :: OS Independent", - "Programming Language :: Python" - ], - "homepage_url": "https://palletsprojects.com/p/itsdangerous/", - "download_url": "https://files.pythonhosted.org/packages/7f/a1/d3fb83e7a61fa0c0d3d08ad0a94ddbeff3731c05212617dff3a94e097f08/itsdangerous-2.1.2.tar.gz", - "size": 56143, - "sha1": null, - "md5": "c1bc730ddf53b8374eaa823f24eb6438", - "sha256": "5dbbc68b317e5e42f327f9021763545dc3fc3bfe22e6deb96aaf1fc38874156a", - "sha512": null, - "bug_tracking_url": "https://github.com/pallets/itsdangerous/issues/", - "code_view_url": "https://github.com/pallets/itsdangerous/", - "vcs_url": null, - "copyright": null, - "license_expression": null, - "declared_license": { - "license": "BSD-3-Clause", - "classifiers": [ - "License :: OSI Approved :: BSD License" - ] - }, - "notice_text": null, - "source_packages": [], - "file_references": [], - "extra_data": {}, - "dependencies": [], - "repository_homepage_url": null, - "repository_download_url": null, - "api_data_url": "https://pypi.org/pypi/itsdangerous/2.1.2/json", - "datasource_id": null, - "purl": "pkg:pypi/itsdangerous@2.1.2" - }, - { - "type": "pypi", - "namespace": null, - "name": "jinja2", - "version": "3.1.2", - "qualifiers": {}, - "subpath": null, - "primary_language": "Python", - "description": "A very fast and expressive template engine.\nJinja\n=====\n\nJinja is a fast, expressive, extensible templating engine. Special\nplaceholders in the template allow writing code similar to Python\nsyntax. Then the template is passed data to render the final document.\n\nIt includes:\n\n- Template inheritance and inclusion.\n- Define and import macros within templates.\n- HTML templates can use autoescaping to prevent XSS from untrusted\n user input.\n- A sandboxed environment can safely render untrusted templates.\n- AsyncIO support for generating templates and calling async\n functions.\n- I18N support with Babel.\n- Templates are compiled to optimized Python code just-in-time and\n cached, or can be compiled ahead-of-time.\n- Exceptions point to the correct line in templates to make debugging\n easier.\n- Extensible filters, tests, functions, and even syntax.\n\nJinja's philosophy is that while application logic belongs in Python if\npossible, it shouldn't make the template designer's job difficult by\nrestricting functionality too much.\n\n\nInstalling\n----------\n\nInstall and update using `pip`_:\n\n.. code-block:: text\n\n $ pip install -U Jinja2\n\n.. _pip: https://pip.pypa.io/en/stable/getting-started/\n\n\nIn A Nutshell\n-------------\n\n.. code-block:: jinja\n\n {% extends \"base.html\" %}\n {% block title %}Members{% endblock %}\n {% block content %}\n \n {% endblock %}\n\n\nDonate\n------\n\nThe Pallets organization develops and supports Jinja and other popular\npackages. In order to grow the community of contributors and users, and\nallow the maintainers to devote more time to the projects, `please\ndonate today`_.\n\n.. _please donate today: https://palletsprojects.com/donate\n\n\nLinks\n-----\n\n- Documentation: https://jinja.palletsprojects.com/\n- Changes: https://jinja.palletsprojects.com/changes/\n- PyPI Releases: https://pypi.org/project/Jinja2/\n- Source Code: https://github.com/pallets/jinja/\n- Issue Tracker: https://github.com/pallets/jinja/issues/\n- Website: https://palletsprojects.com/p/jinja/\n- Twitter: https://twitter.com/PalletsTeam\n- Chat: https://discord.gg/pallets", - "release_date": "2022-04-28T17:21:27", - "parties": [ - { - "type": "person", - "role": "author", - "name": "Armin Ronacher", - "email": "armin.ronacher@active-4.com", - "url": null - }, - { - "type": "person", - "role": "maintainer", - "name": "Pallets", - "email": "contact@palletsprojects.com", - "url": null - } - ], - "keywords": [ - "Development Status :: 5 - Production/Stable", - "Environment :: Web Environment", - "Intended Audience :: Developers", - "Operating System :: OS Independent", - "Programming Language :: Python", - "Topic :: Internet :: WWW/HTTP :: Dynamic Content", - "Topic :: Text Processing :: Markup :: HTML" - ], - "homepage_url": "https://palletsprojects.com/p/jinja/", - "download_url": "https://files.pythonhosted.org/packages/7a/ff/75c28576a1d900e87eb6335b063fab47a8ef3c8b4d88524c4bf78f670cce/Jinja2-3.1.2.tar.gz", - "size": 268239, - "sha1": null, - "md5": "d31148abd89c1df1cdb077a55db27d02", - "sha256": "31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852", - "sha512": null, - "bug_tracking_url": "https://github.com/pallets/jinja/issues/", - "code_view_url": "https://github.com/pallets/jinja/", - "vcs_url": null, - "copyright": null, - "license_expression": null, - "declared_license": { - "license": "BSD-3-Clause", - "classifiers": [ - "License :: OSI Approved :: BSD License" - ] - }, - "notice_text": null, - "source_packages": [], - "file_references": [], - "extra_data": {}, - "dependencies": [], - "repository_homepage_url": null, - "repository_download_url": null, - "api_data_url": "https://pypi.org/pypi/jinja2/3.1.2/json", - "datasource_id": null, - "purl": "pkg:pypi/jinja2@3.1.2" - }, - { - "type": "pypi", - "namespace": null, - "name": "markupsafe", - "version": "2.1.1", - "qualifiers": {}, - "subpath": null, - "primary_language": "Python", - "description": "Safely add untrusted strings to HTML/XML markup.\nMarkupSafe\n==========\n\nMarkupSafe implements a text object that escapes characters so it is\nsafe to use in HTML and XML. Characters that have special meanings are\nreplaced so that they display as the actual characters. This mitigates\ninjection attacks, meaning untrusted user input can safely be displayed\non a page.\n\n\nInstalling\n----------\n\nInstall and update using `pip`_:\n\n.. code-block:: text\n\n pip install -U MarkupSafe\n\n.. _pip: https://pip.pypa.io/en/stable/getting-started/\n\n\nExamples\n--------\n\n.. code-block:: pycon\n\n >>> from markupsafe import Markup, escape\n\n >>> # escape replaces special characters and wraps in Markup\n >>> escape(\"\")\n Markup('<script>alert(document.cookie);</script>')\n\n >>> # wrap in Markup to mark text \"safe\" and prevent escaping\n >>> Markup(\"Hello\")\n Markup('hello')\n\n >>> escape(Markup(\"Hello\"))\n Markup('hello')\n\n >>> # Markup is a str subclass\n >>> # methods and operators escape their arguments\n >>> template = Markup(\"Hello {name}\")\n >>> template.format(name='\"World\"')\n Markup('Hello "World"')\n\n\nDonate\n------\n\nThe Pallets organization develops and supports MarkupSafe and other\npopular packages. In order to grow the community of contributors and\nusers, and allow the maintainers to devote more time to the projects,\n`please donate today`_.\n\n.. _please donate today: https://palletsprojects.com/donate\n\n\nLinks\n-----\n\n- Documentation: https://markupsafe.palletsprojects.com/\n- Changes: https://markupsafe.palletsprojects.com/changes/\n- PyPI Releases: https://pypi.org/project/MarkupSafe/\n- Source Code: https://github.com/pallets/markupsafe/\n- Issue Tracker: https://github.com/pallets/markupsafe/issues/\n- Website: https://palletsprojects.com/p/markupsafe/\n- Twitter: https://twitter.com/PalletsTeam\n- Chat: https://discord.gg/pallets", - "release_date": "2022-03-15T13:23:27", - "parties": [ - { - "type": "person", - "role": "author", - "name": "Armin Ronacher", - "email": "armin.ronacher@active-4.com", - "url": null - }, - { - "type": "person", - "role": "maintainer", - "name": "Pallets", - "email": "contact@palletsprojects.com", - "url": null - } - ], - "keywords": [ - "Development Status :: 5 - Production/Stable", - "Environment :: Web Environment", - "Intended Audience :: Developers", - "Operating System :: OS Independent", - "Programming Language :: Python", - "Topic :: Internet :: WWW/HTTP :: Dynamic Content", - "Topic :: Text Processing :: Markup :: HTML" - ], - "homepage_url": "https://palletsprojects.com/p/markupsafe/", - "download_url": "https://files.pythonhosted.org/packages/1d/97/2288fe498044284f39ab8950703e88abbac2abbdf65524d576157af70556/MarkupSafe-2.1.1.tar.gz", - "size": 18668, - "sha1": null, - "md5": "9809f9fdd98bc835b0c21aa8f79cbf30", - "sha256": "7f91197cc9e48f989d12e4e6fbc46495c446636dfc81b9ccf50bb0ec74b91d4b", - "sha512": null, - "bug_tracking_url": "https://github.com/pallets/markupsafe/issues/", - "code_view_url": "https://github.com/pallets/markupsafe/", - "vcs_url": null, - "copyright": null, - "license_expression": null, - "declared_license": { - "license": "BSD-3-Clause", - "classifiers": [ - "License :: OSI Approved :: BSD License" - ] - }, - "notice_text": null, - "source_packages": [], - "file_references": [], - "extra_data": {}, - "dependencies": [], - "repository_homepage_url": null, - "repository_download_url": null, - "api_data_url": "https://pypi.org/pypi/markupsafe/2.1.1/json", - "datasource_id": null, - "purl": "pkg:pypi/markupsafe@2.1.1" - }, - { - "type": "pypi", - "namespace": null, - "name": "werkzeug", - "version": "2.2.2", - "qualifiers": {}, - "subpath": null, - "primary_language": "Python", - "description": "The comprehensive WSGI web application library.\nWerkzeug\n========\n\n*werkzeug* German noun: \"tool\". Etymology: *werk* (\"work\"), *zeug* (\"stuff\")\n\nWerkzeug is a comprehensive `WSGI`_ web application library. It began as\na simple collection of various utilities for WSGI applications and has\nbecome one of the most advanced WSGI utility libraries.\n\nIt includes:\n\n- An interactive debugger that allows inspecting stack traces and\n source code in the browser with an interactive interpreter for any\n frame in the stack.\n- A full-featured request object with objects to interact with\n headers, query args, form data, files, and cookies.\n- A response object that can wrap other WSGI applications and handle\n streaming data.\n- A routing system for matching URLs to endpoints and generating URLs\n for endpoints, with an extensible system for capturing variables\n from URLs.\n- HTTP utilities to handle entity tags, cache control, dates, user\n agents, cookies, files, and more.\n- A threaded WSGI server for use while developing applications\n locally.\n- A test client for simulating HTTP requests during testing without\n requiring running a server.\n\nWerkzeug doesn't enforce any dependencies. It is up to the developer to\nchoose a template engine, database adapter, and even how to handle\nrequests. It can be used to build all sorts of end user applications\nsuch as blogs, wikis, or bulletin boards.\n\n`Flask`_ wraps Werkzeug, using it to handle the details of WSGI while\nproviding more structure and patterns for defining powerful\napplications.\n\n.. _WSGI: https://wsgi.readthedocs.io/en/latest/\n.. _Flask: https://www.palletsprojects.com/p/flask/\n\n\nInstalling\n----------\n\nInstall and update using `pip`_:\n\n.. code-block:: text\n\n pip install -U Werkzeug\n\n.. _pip: https://pip.pypa.io/en/stable/getting-started/\n\n\nA Simple Example\n----------------\n\n.. code-block:: python\n\n from werkzeug.wrappers import Request, Response\n\n @Request.application\n def application(request):\n return Response('Hello, World!')\n\n if __name__ == '__main__':\n from werkzeug.serving import run_simple\n run_simple('localhost', 4000, application)\n\n\nDonate\n------\n\nThe Pallets organization develops and supports Werkzeug and other\npopular packages. In order to grow the community of contributors and\nusers, and allow the maintainers to devote more time to the projects,\n`please donate today`_.\n\n.. _please donate today: https://palletsprojects.com/donate\n\n\nLinks\n-----\n\n- Documentation: https://werkzeug.palletsprojects.com/\n- Changes: https://werkzeug.palletsprojects.com/changes/\n- PyPI Releases: https://pypi.org/project/Werkzeug/\n- Source Code: https://github.com/pallets/werkzeug/\n- Issue Tracker: https://github.com/pallets/werkzeug/issues/\n- Website: https://palletsprojects.com/p/werkzeug/\n- Twitter: https://twitter.com/PalletsTeam\n- Chat: https://discord.gg/pallets", - "release_date": "2022-08-08T21:44:15", - "parties": [ - { - "type": "person", - "role": "author", - "name": "Armin Ronacher", - "email": "armin.ronacher@active-4.com", - "url": null - }, - { - "type": "person", - "role": "maintainer", - "name": "Pallets", - "email": "contact@palletsprojects.com", - "url": null - } - ], - "keywords": [ - "Development Status :: 5 - Production/Stable", - "Environment :: Web Environment", - "Intended Audience :: Developers", - "Operating System :: OS Independent", - "Programming Language :: Python", - "Topic :: Internet :: WWW/HTTP :: Dynamic Content", - "Topic :: Internet :: WWW/HTTP :: WSGI", - "Topic :: Internet :: WWW/HTTP :: WSGI :: Application", - "Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware", - "Topic :: Software Development :: Libraries :: Application Frameworks" - ], - "homepage_url": "https://palletsprojects.com/p/werkzeug/", - "download_url": "https://files.pythonhosted.org/packages/f8/c1/1c8e539f040acd80f844c69a5ef8e2fccdf8b442dabb969e497b55d544e1/Werkzeug-2.2.2.tar.gz", - "size": 844378, - "sha1": null, - "md5": "9d7e50c5bb3a9fc12823b5faf374b90e", - "sha256": "7ea2d48322cc7c0f8b3a215ed73eabd7b5d75d0b50e31ab006286ccff9e00b8f", - "sha512": null, - "bug_tracking_url": "https://github.com/pallets/werkzeug/issues/", - "code_view_url": "https://github.com/pallets/werkzeug/", - "vcs_url": null, - "copyright": null, - "license_expression": null, - "declared_license": { - "license": "BSD-3-Clause", - "classifiers": [ - "License :: OSI Approved :: BSD License" - ] - }, - "notice_text": null, - "source_packages": [], - "file_references": [], - "extra_data": {}, - "dependencies": [], - "repository_homepage_url": null, - "repository_download_url": null, - "api_data_url": "https://pypi.org/pypi/werkzeug/2.2.2/json", - "datasource_id": null, - "purl": "pkg:pypi/werkzeug@2.2.2" - } - ], - "resolution": [ - { - "package": "pkg:pypi/click@8.1.3", - "dependencies": [] - }, - { - "package": "pkg:pypi/flask@2.1.2", - "dependencies": [ - "pkg:pypi/click@8.1.3", - "pkg:pypi/itsdangerous@2.1.2", - "pkg:pypi/jinja2@3.1.2", - "pkg:pypi/werkzeug@2.2.2" - ] - }, - { - "package": "pkg:pypi/itsdangerous@2.1.2", - "dependencies": [] - }, - { - "package": "pkg:pypi/jinja2@3.1.2", - "dependencies": [ - "pkg:pypi/markupsafe@2.1.1" - ] - }, - { - "package": "pkg:pypi/markupsafe@2.1.1", - "dependencies": [] - }, - { - "package": "pkg:pypi/werkzeug@2.2.2", - "dependencies": [ - "pkg:pypi/markupsafe@2.1.1" - ] - } - ] -} \ No newline at end of file diff --git a/tests/data/test-api-with-requirement-file.json b/tests/data/test-api-with-requirement-file.json index 5d55a3a3..5dd9148a 100644 --- a/tests/data/test-api-with-requirement-file.json +++ b/tests/data/test-api-with-requirement-file.json @@ -5998,12 +5998,12 @@ "type": "pypi", "namespace": null, "name": "pip", - "version": "22.3.1", + "version": "22.3", "qualifiers": {}, "subpath": null, "primary_language": "Python", "description": "The PyPA recommended tool for installing Python packages.\npip - The Python Package Installer\n==================================\n\n.. image:: https://img.shields.io/pypi/v/pip.svg\n :target: https://pypi.org/project/pip/\n\n.. image:: https://readthedocs.org/projects/pip/badge/?version=latest\n :target: https://pip.pypa.io/en/latest\n\npip is the `package installer`_ for Python. You can use pip to install packages from the `Python Package Index`_ and other indexes.\n\nPlease take a look at our documentation for how to install and use pip:\n\n* `Installation`_\n* `Usage`_\n\nWe release updates regularly, with a new version every 3 months. Find more details in our documentation:\n\n* `Release notes`_\n* `Release process`_\n\nIn pip 20.3, we've `made a big improvement to the heart of pip`_; `learn more`_. We want your input, so `sign up for our user experience research studies`_ to help us do it right.\n\n**Note**: pip 21.0, in January 2021, removed Python 2 support, per pip's `Python 2 support policy`_. Please migrate to Python 3.\n\nIf you find bugs, need help, or want to talk to the developers, please use our mailing lists or chat rooms:\n\n* `Issue tracking`_\n* `Discourse channel`_\n* `User IRC`_\n\nIf you want to get involved head over to GitHub to get the source code, look at our development documentation and feel free to jump on the developer mailing lists and chat rooms:\n\n* `GitHub page`_\n* `Development documentation`_\n* `Development IRC`_\n\nCode of Conduct\n---------------\n\nEveryone interacting in the pip project's codebases, issue trackers, chat\nrooms, and mailing lists is expected to follow the `PSF Code of Conduct`_.\n\n.. _package installer: https://packaging.python.org/guides/tool-recommendations/\n.. _Python Package Index: https://pypi.org\n.. _Installation: https://pip.pypa.io/en/stable/installation/\n.. _Usage: https://pip.pypa.io/en/stable/\n.. _Release notes: https://pip.pypa.io/en/stable/news.html\n.. _Release process: https://pip.pypa.io/en/latest/development/release-process/\n.. _GitHub page: https://github.com/pypa/pip\n.. _Development documentation: https://pip.pypa.io/en/latest/development\n.. _made a big improvement to the heart of pip: https://pyfound.blogspot.com/2020/11/pip-20-3-new-resolver.html\n.. _learn more: https://pip.pypa.io/en/latest/user_guide/#changes-to-the-pip-dependency-resolver-in-20-3-2020\n.. _sign up for our user experience research studies: https://pyfound.blogspot.com/2020/03/new-pip-resolver-to-roll-out-this-year.html\n.. _Python 2 support policy: https://pip.pypa.io/en/latest/development/release-process/#python-2-support\n.. _Issue tracking: https://github.com/pypa/pip/issues\n.. _Discourse channel: https://discuss.python.org/c/packaging\n.. _User IRC: https://kiwiirc.com/nextclient/#ircs://irc.libera.chat:+6697/pypa\n.. _Development IRC: https://kiwiirc.com/nextclient/#ircs://irc.libera.chat:+6697/pypa-dev\n.. _PSF Code of Conduct: https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md", - "release_date": "2022-11-05T15:56:17", + "release_date": "2022-10-15T11:41:14", "parties": [ { "type": "person", @@ -6029,11 +6029,11 @@ "Topic :: Software Development :: Build Tools" ], "homepage_url": "https://pip.pypa.io/", - "download_url": "https://files.pythonhosted.org/packages/09/bd/2410905c76ee14c62baf69e3f4aa780226c1bbfc9485731ad018e35b0cb5/pip-22.3.1-py3-none-any.whl", - "size": 2051534, + "download_url": "https://files.pythonhosted.org/packages/47/ef/8b5470b5b94b36231ed9c0bde90caa71c0d4322d4a15f009b2b7f4287fe0/pip-22.3-py3-none-any.whl", + "size": 2051507, "sha1": null, - "md5": "74d0d338e0af6ca545d6ce7ef9734d75", - "sha256": "908c78e6bc29b676ede1c4d57981d490cb892eb45cd8c214ab6298125119e077", + "md5": "6123dc5fc3483ebb12becce7faa4cd28", + "sha256": "1daab4b8d3b97d1d763caeb01a4640a2250a0ea899e257b1e44b9eded91e15ab", "sha512": null, "bug_tracking_url": null, "code_view_url": "https://github.com/pypa/pip", @@ -6053,20 +6053,20 @@ "dependencies": [], "repository_homepage_url": null, "repository_download_url": null, - "api_data_url": "https://pypi.org/pypi/pip/22.3.1/json", + "api_data_url": "https://pypi.org/pypi/pip/22.3/json", "datasource_id": null, - "purl": "pkg:pypi/pip@22.3.1" + "purl": "pkg:pypi/pip@22.3" }, { "type": "pypi", "namespace": null, "name": "pip", - "version": "22.3.1", + "version": "22.3", "qualifiers": {}, "subpath": null, "primary_language": "Python", "description": "The PyPA recommended tool for installing Python packages.\npip - The Python Package Installer\n==================================\n\n.. image:: https://img.shields.io/pypi/v/pip.svg\n :target: https://pypi.org/project/pip/\n\n.. image:: https://readthedocs.org/projects/pip/badge/?version=latest\n :target: https://pip.pypa.io/en/latest\n\npip is the `package installer`_ for Python. You can use pip to install packages from the `Python Package Index`_ and other indexes.\n\nPlease take a look at our documentation for how to install and use pip:\n\n* `Installation`_\n* `Usage`_\n\nWe release updates regularly, with a new version every 3 months. Find more details in our documentation:\n\n* `Release notes`_\n* `Release process`_\n\nIn pip 20.3, we've `made a big improvement to the heart of pip`_; `learn more`_. We want your input, so `sign up for our user experience research studies`_ to help us do it right.\n\n**Note**: pip 21.0, in January 2021, removed Python 2 support, per pip's `Python 2 support policy`_. Please migrate to Python 3.\n\nIf you find bugs, need help, or want to talk to the developers, please use our mailing lists or chat rooms:\n\n* `Issue tracking`_\n* `Discourse channel`_\n* `User IRC`_\n\nIf you want to get involved head over to GitHub to get the source code, look at our development documentation and feel free to jump on the developer mailing lists and chat rooms:\n\n* `GitHub page`_\n* `Development documentation`_\n* `Development IRC`_\n\nCode of Conduct\n---------------\n\nEveryone interacting in the pip project's codebases, issue trackers, chat\nrooms, and mailing lists is expected to follow the `PSF Code of Conduct`_.\n\n.. _package installer: https://packaging.python.org/guides/tool-recommendations/\n.. _Python Package Index: https://pypi.org\n.. _Installation: https://pip.pypa.io/en/stable/installation/\n.. _Usage: https://pip.pypa.io/en/stable/\n.. _Release notes: https://pip.pypa.io/en/stable/news.html\n.. _Release process: https://pip.pypa.io/en/latest/development/release-process/\n.. _GitHub page: https://github.com/pypa/pip\n.. _Development documentation: https://pip.pypa.io/en/latest/development\n.. _made a big improvement to the heart of pip: https://pyfound.blogspot.com/2020/11/pip-20-3-new-resolver.html\n.. _learn more: https://pip.pypa.io/en/latest/user_guide/#changes-to-the-pip-dependency-resolver-in-20-3-2020\n.. _sign up for our user experience research studies: https://pyfound.blogspot.com/2020/03/new-pip-resolver-to-roll-out-this-year.html\n.. _Python 2 support policy: https://pip.pypa.io/en/latest/development/release-process/#python-2-support\n.. _Issue tracking: https://github.com/pypa/pip/issues\n.. _Discourse channel: https://discuss.python.org/c/packaging\n.. _User IRC: https://kiwiirc.com/nextclient/#ircs://irc.libera.chat:+6697/pypa\n.. _Development IRC: https://kiwiirc.com/nextclient/#ircs://irc.libera.chat:+6697/pypa-dev\n.. _PSF Code of Conduct: https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md", - "release_date": "2022-11-05T15:56:20", + "release_date": "2022-10-15T11:41:17", "parties": [ { "type": "person", @@ -6092,11 +6092,11 @@ "Topic :: Software Development :: Build Tools" ], "homepage_url": "https://pip.pypa.io/", - "download_url": "https://files.pythonhosted.org/packages/a3/50/c4d2727b99052780aad92c7297465af5fe6eec2dbae490aa9763273ffdc1/pip-22.3.1.tar.gz", - "size": 2078129, + "download_url": "https://files.pythonhosted.org/packages/f8/08/7f92782ff571c7c7cb6c5eeb8ebbb1f68cb02bdb24e55c5de4dd9ce98bc3/pip-22.3.tar.gz", + "size": 2077961, "sha1": null, - "md5": "996f58a94fe0b8b82b6795c42bd171ba", - "sha256": "65fd48317359f3af8e593943e6ae1506b66325085ea64b706a998c6e83eeaf38", + "md5": "f0dd02265e7ccd2f8758c840fba64810", + "sha256": "8182aec21dad6c0a49a2a3d121a87cd524b950e0b6092b181625f07ebdde7530", "sha512": null, "bug_tracking_url": null, "code_view_url": "https://github.com/pypa/pip", @@ -6116,9 +6116,9 @@ "dependencies": [], "repository_homepage_url": null, "repository_download_url": null, - "api_data_url": "https://pypi.org/pypi/pip/22.3.1/json", + "api_data_url": "https://pypi.org/pypi/pip/22.3/json", "datasource_id": null, - "purl": "pkg:pypi/pip@22.3.1" + "purl": "pkg:pypi/pip@22.3" }, { "type": "pypi", @@ -10788,13 +10788,13 @@ ] }, { - "package": "pkg:pypi/pip@22.3.1", + "package": "pkg:pypi/pip@22.3", "dependencies": [] }, { "package": "pkg:pypi/pipdeptree@2.2.1", "dependencies": [ - "pkg:pypi/pip@22.3.1" + "pkg:pypi/pip@22.3" ] }, { diff --git a/tests/test_api.py b/tests/test_api.py index a554af1a..4df13f57 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -160,24 +160,3 @@ def test_api_with_wrong_pyver(): python_version="3.12", operating_system="linux", ) - - -def test_api_with_python_311(): - result_file = test_env.get_temp_file("json") - expected_file = test_env.get_test_loc("test-api-with-python-311.json", must_exist=False) - with open(result_file, "w") as result: - result.write( - json.dumps( - resolver_api( - specifiers=["flask==2.1.2"], - python_version="3.11", - operating_system="linux", - prefer_source=True, - ).to_dict() - ) - ) - check_json_results( - result_file=result_file, - expected_file=expected_file, - clean=True, - ) diff --git a/tests/test_cli.py b/tests/test_cli.py index d5ba5ef2..471ac647 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -399,12 +399,18 @@ def test_passing_of_no_json_output_flag(): def test_passing_of_no_os(): options = ["--specifier", "foo", "--json", "-", "--python-version", "38"] - run_cli(options=options, expected_rc=2, get_env=False) + message = "No operating system" + result = run_cli(options=options, expected_rc=1, get_env=False) + if message: + assert message in result.output def test_passing_of_no_pyver(): options = ["--specifier", "foo", "--json", "-", "--operating-system", "linux"] - run_cli(options=options, expected_rc=2, get_env=False) + message = "No python version" + result = run_cli(options=options, expected_rc=1, get_env=False) + if message: + assert message in result.output def test_passing_of_wrong_pyver(): diff --git a/tests/test_resolution.py b/tests/test_resolution.py index d470b084..99dabc9e 100644 --- a/tests/test_resolution.py +++ b/tests/test_resolution.py @@ -11,10 +11,10 @@ import os from unittest.mock import patch -import packaging +import packvers import pytest from commoncode.testcase import FileDrivenTesting -from packaging.requirements import Requirement +from packvers.requirements import Requirement from _packagedcode import models from python_inspector.api import get_resolved_dependencies @@ -150,13 +150,13 @@ def test_without_supported_wheels(): "pkg:pypi/hyperlink@21.0.0", "pkg:pypi/idna@3.4", "pkg:pypi/pycparser@2.21", - "pkg:pypi/setuptools@65.5.1", + "pkg:pypi/setuptools@65.5.0", "pkg:pypi/txaio@22.2.1", ] def test_is_valid_version(): - parsed_version = packaging.version.parse("2.1.2") + parsed_version = packvers.version.parse("2.1.2") requirements = {"flask": [Requirement("flask>2.0.0")]} bad_versions = [] identifier = "flask" @@ -164,7 +164,7 @@ def test_is_valid_version(): def test_is_valid_version_with_no_specifier(): - parsed_version = packaging.version.parse("2.1.2") + parsed_version = packvers.version.parse("2.1.2") requirements = {"flask": [Requirement("flask")]} bad_versions = [] identifier = "flask" @@ -172,7 +172,7 @@ def test_is_valid_version_with_no_specifier(): def test_is_valid_version_with_no_specifier_and_pre_release(): - parsed_version = packaging.version.parse("1.0.0b4") + parsed_version = packvers.version.parse("1.0.0b4") requirements = {"flask": [Requirement("flask")]} bad_versions = [] identifier = "flask"