From 5ad1f2fdd6cf956b96d7ae98a8bfc4cb7d4f5e1a Mon Sep 17 00:00:00 2001 From: mathbou Date: Mon, 31 Jan 2022 16:12:12 +0100 Subject: [PATCH 01/12] =?UTF-8?q?=E2=9C=A8=20query=20objects.inv=20from=20?= =?UTF-8?q?homepage=20url?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seed_intersphinx_mapping/__init__.py | 43 ++++++++++++++++------------ 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/seed_intersphinx_mapping/__init__.py b/seed_intersphinx_mapping/__init__.py index a983f40..700b0ea 100644 --- a/seed_intersphinx_mapping/__init__.py +++ b/seed_intersphinx_mapping/__init__.py @@ -33,13 +33,15 @@ # stdlib import functools import json +import os.path import re +from urllib.parse import urlparse from typing import Dict, Optional, Tuple, Union # 3rd party + import dist_meta import requests -from dist_meta.metadata_mapping import MetadataMapping from domdf_python_tools.compat import importlib_resources from domdf_python_tools.utils import stderr_writer from packaging.requirements import Requirement @@ -60,7 +62,7 @@ _DOCUMENTATION_RE = re.compile(r"^[dD]oc(s|umentation)") -def _get_project_links(project_name: str) -> MetadataMapping: +def _get_project_links(project_name: str) -> list: """ Returns the web links for the given project. @@ -69,7 +71,7 @@ def _get_project_links(project_name: str) -> MetadataMapping: :param project_name: """ - urls = MetadataMapping() + urls = [] # Try a local package first try: @@ -77,9 +79,11 @@ def _get_project_links(project_name: str) -> MetadataMapping: raw_urls = dist.get_metadata().get_all("Project-URL", default=()) for url in raw_urls: - label, url, *_ = map(str.strip, url.split(',')) + label, url = url.split(",", 1) if _DOCUMENTATION_RE.match(label): - urls[label] = url + urls.append(url) + + urls.append(dist.get_metadata().get("Home-Page")) except dist_meta.distributions.DistributionNotFoundError: # Fall back to PyPI @@ -90,8 +94,11 @@ def _get_project_links(project_name: str) -> MetadataMapping: if "project_urls" in metadata and metadata["project_urls"]: for label, url in metadata["project_urls"].items(): if _DOCUMENTATION_RE.match(label): - urls[label] = url + urls.append(url) + urls.append(metadata["home_page"]) + + urls = [url.strip() for url in filter(None, urls)] return urls @@ -126,26 +133,24 @@ def get_sphinx_doc_url(pypi_name: str) -> str: Now raises :exc:`~packaging.requirements.InvalidRequirement` rather than :exc:`apeye.slumber_url.exceptions.HttpNotFoundError` if the project could not be found on PyPI. """ - - for key, value in _get_project_links(pypi_name).items(): - + docs_urls = [] + for value in _get_project_links(pypi_name): # Follow redirects to get actual URL r = requests.head(value, allow_redirects=True, timeout=10) - if r.status_code != 200: # pragma: no cover - raise ValueError(f"Documentation URL not found: HTTP Status {r.status_code}.") - docs_url = r.url + if r.status_code == 200: + has_extension = os.path.splitext(urlparse(r.url).path)[-1] + url = os.path.dirname(r.url) if has_extension else r.url + docs_urls.append(url) - if docs_url.endswith('/'): - objects_inv_url = f"{docs_url}objects.inv" - else: # pragma: no cover - objects_inv_url = f"{docs_url}/objects.inv" + for docs_url in docs_urls: + objects_inv_url = f"{docs_url.rstrip('/')}/objects.inv" r = requests.head(objects_inv_url, allow_redirects=True, timeout=10) if r.status_code != 200: - raise ValueError(f"objects.inv not found at url {objects_inv_url}: HTTP Status {r.status_code}.") - - return docs_url + stderr_writer(f"WARNING: objects.inv not found at url {objects_inv_url}: HTTP Status {r.status_code}.") + else: + return docs_url raise ValueError("Documentation URL not found in data from PyPI.") From 767f4d79a9ba84c07b74c8597051e5f559d26f86 Mon Sep 17 00:00:00 2001 From: mathbou Date: Mon, 31 Jan 2022 16:27:50 +0100 Subject: [PATCH 02/12] =?UTF-8?q?=F0=9F=8E=A8=20pre-commit=20run?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seed_intersphinx_mapping/__init__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/seed_intersphinx_mapping/__init__.py b/seed_intersphinx_mapping/__init__.py index 700b0ea..0dc1cef 100644 --- a/seed_intersphinx_mapping/__init__.py +++ b/seed_intersphinx_mapping/__init__.py @@ -35,11 +35,10 @@ import json import os.path import re -from urllib.parse import urlparse from typing import Dict, Optional, Tuple, Union +from urllib.parse import urlparse # 3rd party - import dist_meta import requests from domdf_python_tools.compat import importlib_resources @@ -79,7 +78,7 @@ def _get_project_links(project_name: str) -> list: raw_urls = dist.get_metadata().get_all("Project-URL", default=()) for url in raw_urls: - label, url = url.split(",", 1) + label, url = url.split(',', 1) if _DOCUMENTATION_RE.match(label): urls.append(url) From 857bacf126db60b4295e72b5506090da93f3ce84 Mon Sep 17 00:00:00 2001 From: mathbou Date: Tue, 1 Feb 2022 11:15:02 +0100 Subject: [PATCH 03/12] =?UTF-8?q?=F0=9F=92=A1=20fix=20typehints?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seed_intersphinx_mapping/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed_intersphinx_mapping/__init__.py b/seed_intersphinx_mapping/__init__.py index 0dc1cef..d6fa7de 100644 --- a/seed_intersphinx_mapping/__init__.py +++ b/seed_intersphinx_mapping/__init__.py @@ -35,7 +35,7 @@ import json import os.path import re -from typing import Dict, Optional, Tuple, Union +from typing import Dict, Optional, Tuple, Union, List from urllib.parse import urlparse # 3rd party @@ -61,7 +61,7 @@ _DOCUMENTATION_RE = re.compile(r"^[dD]oc(s|umentation)") -def _get_project_links(project_name: str) -> list: +def _get_project_links(project_name: str) -> List[str]: """ Returns the web links for the given project. From 29674f8eabe1047e390189f336b0aff909698730 Mon Sep 17 00:00:00 2001 From: mathbou Date: Tue, 1 Feb 2022 11:17:11 +0100 Subject: [PATCH 04/12] =?UTF-8?q?=E2=9A=A1=20cache=20metadata?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seed_intersphinx_mapping/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/seed_intersphinx_mapping/__init__.py b/seed_intersphinx_mapping/__init__.py index d6fa7de..1d92d57 100644 --- a/seed_intersphinx_mapping/__init__.py +++ b/seed_intersphinx_mapping/__init__.py @@ -75,14 +75,15 @@ def _get_project_links(project_name: str) -> List[str]: # Try a local package first try: dist = dist_meta.distributions.get_distribution(project_name) - raw_urls = dist.get_metadata().get_all("Project-URL", default=()) + metadata = dist.get_metadata() + raw_urls = metadata.get_all("Project-URL", default=()) for url in raw_urls: label, url = url.split(',', 1) if _DOCUMENTATION_RE.match(label): urls.append(url) - urls.append(dist.get_metadata().get("Home-Page")) + urls.append(metadata.get("Home-Page")) except dist_meta.distributions.DistributionNotFoundError: # Fall back to PyPI From 623f82fa69d2f767d47121e03dad8c5b1cb4f84f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 1 Feb 2022 10:45:14 +0000 Subject: [PATCH 05/12] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- seed_intersphinx_mapping/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed_intersphinx_mapping/__init__.py b/seed_intersphinx_mapping/__init__.py index 1d92d57..a588e1f 100644 --- a/seed_intersphinx_mapping/__init__.py +++ b/seed_intersphinx_mapping/__init__.py @@ -35,7 +35,7 @@ import json import os.path import re -from typing import Dict, Optional, Tuple, Union, List +from typing import Dict, List, Optional, Tuple, Union from urllib.parse import urlparse # 3rd party From c62fe918fdf0535d24bf1d808c481bbd9410ae22 Mon Sep 17 00:00:00 2001 From: mathbou Date: Tue, 1 Feb 2022 11:48:11 +0100 Subject: [PATCH 06/12] =?UTF-8?q?=F0=9F=8E=A8=20add=20blank=20line=20after?= =?UTF-8?q?=20docstring?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seed_intersphinx_mapping/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/seed_intersphinx_mapping/__init__.py b/seed_intersphinx_mapping/__init__.py index a588e1f..e551c96 100644 --- a/seed_intersphinx_mapping/__init__.py +++ b/seed_intersphinx_mapping/__init__.py @@ -133,6 +133,7 @@ def get_sphinx_doc_url(pypi_name: str) -> str: Now raises :exc:`~packaging.requirements.InvalidRequirement` rather than :exc:`apeye.slumber_url.exceptions.HttpNotFoundError` if the project could not be found on PyPI. """ + docs_urls = [] for value in _get_project_links(pypi_name): # Follow redirects to get actual URL From 4e5ad610827249b0bc4808bded23ae3e1cb14096 Mon Sep 17 00:00:00 2001 From: Mathieu <13415583+mathbou@users.noreply.github.com> Date: Tue, 15 Mar 2022 01:09:42 +0100 Subject: [PATCH 07/12] =?UTF-8?q?=E2=9C=85=20fix=20seeding=20test=20assert?= =?UTF-8?q?ion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seed_intersphinx_mapping/fallback_mapping.json | 2 +- tests/test_seeding.py | 17 +++++++++-------- ...inx_seed_intersphinx_mapping_list_mocked.yml | 2 +- ...ng_mocked_bad_example_requirements_flit_.yml | 2 +- ...cked_bad_example_requirements_pyproject_.yml | 2 +- ...bad_example_requirements_pyproject_toml_.yml | 2 +- ...d_bad_example_requirements_requirements_.yml | 2 +- ...ping_mocked_example_requirements_a_flit_.yml | 2 +- ...mocked_example_requirements_a_pyproject_.yml | 2 +- ...d_example_requirements_a_pyproject_toml_.yml | 2 +- ...ked_example_requirements_a_requirements_.yml | 2 +- 11 files changed, 19 insertions(+), 18 deletions(-) diff --git a/seed_intersphinx_mapping/fallback_mapping.json b/seed_intersphinx_mapping/fallback_mapping.json index 42472b1..7544199 100644 --- a/seed_intersphinx_mapping/fallback_mapping.json +++ b/seed_intersphinx_mapping/fallback_mapping.json @@ -29,7 +29,7 @@ "scikit-learn": "https://scikit-learn.org/stable/", "six": "https://six.readthedocs.io/", "slumber": "https://slumber.readthedocs.io/en/v0.6.0/", - "sphinx": "https://www.sphinx-doc.org/en/3.x/", + "sphinx": "https://www.sphinx-doc.org/en/master/", "typing": "https://docs.python.org/3/", "typing-extensions": "https://typing-extensions.readthedocs.io/en/latest/", "typing_extensions": "https://typing-extensions.readthedocs.io/en/latest/", diff --git a/tests/test_seeding.py b/tests/test_seeding.py index 0200435..127b93d 100644 --- a/tests/test_seeding.py +++ b/tests/test_seeding.py @@ -25,12 +25,12 @@ "packaging": ("https://packaging.pypa.io/en/stable/", None), "requests": ("https://requests.readthedocs.io/en/latest/", None), "slumber": ("https://slumber.readthedocs.io/en/v0.6.0/", None), - "sphinx": ("https://www.sphinx-doc.org/en/3.x/", None), + "sphinx": ("https://www.sphinx-doc.org/en/master/", None), } bad_expected_mapping = { "domdf-python-tools": ("https://domdf-python-tools.readthedocs.io/en/latest/", None), - "packaging": ("https://packaging.pypa.io/en/stable/", None), - "sphinx": ("https://www.sphinx-doc.org/en/3.x/", None), + "packaging": ("https://packaging.pypa.io/en/latest/", None), + "sphinx": ("https://www.sphinx-doc.org/en/master/", None), } @@ -50,12 +50,12 @@ def test_seed_intersphinx_mapping( assert seed_intersphinx_mapping(*parse_requirements_txt(tmp_pathplus)) == expects err = capsys.readouterr().err - assert err == "WARNING: Unable to determine documentation url for project sphinxcontrib-domaintools\n" + assert "WARNING: Unable to determine documentation url for project sphinxcontrib-domaintools\n" in err requirements, comments, invalid = read_requirements(tmp_pathplus / "requirements.txt", include_invalid=True) assert seed_intersphinx_mapping(*requirements) == expects err = capsys.readouterr().err - assert err == "WARNING: Unable to determine documentation url for project sphinxcontrib-domaintools\n" + assert "WARNING: Unable to determine documentation url for project sphinxcontrib-domaintools\n" in err @pytest.mark.parametrize( @@ -70,7 +70,7 @@ def test_seed_intersphinx_mapping_pyproject(tmp_pathplus: PathPlus, contents: st assert seed_intersphinx_mapping(*parse_pyproject_toml(tmp_pathplus)) == expects err = capsys.readouterr().err - assert err == "WARNING: Unable to determine documentation url for project sphinxcontrib-domaintools\n" + assert err.endswith("WARNING: Unable to determine documentation url for project sphinxcontrib-domaintools\n") @pytest.mark.parametrize( @@ -85,7 +85,7 @@ def test_seed_intersphinx_mapping_flit(tmp_pathplus: PathPlus, contents: str, ex assert seed_intersphinx_mapping(*parse_flit_requirements(tmp_pathplus)) == expects err = capsys.readouterr().err - assert err == "WARNING: Unable to determine documentation url for project sphinxcontrib-domaintools\n" + assert err.endswith("WARNING: Unable to determine documentation url for project sphinxcontrib-domaintools\n") @pytest.mark.parametrize("pkg_requirements_source", ["requirements", "flit", "pyproject", "pyproject.toml"]) @@ -125,7 +125,8 @@ def test_sphinx_seed_intersphinx_mapping_mocked( advanced_data_regression.check(config.intersphinx_mapping) err = capsys.readouterr().err - assert err == "WARNING: Unable to determine documentation url for project sphinxcontrib-domaintools\n" + + assert err.endswith("WARNING: Unable to determine documentation url for project sphinxcontrib-domaintools\n") def test_sphinx_seed_intersphinx_mapping_list_mocked( diff --git a/tests/test_seeding_/test_sphinx_seed_intersphinx_mapping_list_mocked.yml b/tests/test_seeding_/test_sphinx_seed_intersphinx_mapping_list_mocked.yml index 8a05a51..3f71b14 100644 --- a/tests/test_seeding_/test_sphinx_seed_intersphinx_mapping_list_mocked.yml +++ b/tests/test_seeding_/test_sphinx_seed_intersphinx_mapping_list_mocked.yml @@ -16,5 +16,5 @@ slumber: - - null sphinx: - sphinx -- - https://www.sphinx-doc.org/en/3.x/ +- - https://www.sphinx-doc.org/en/master/ - - null diff --git a/tests/test_seeding_/test_sphinx_seed_intersphinx_mapping_mocked_bad_example_requirements_flit_.yml b/tests/test_seeding_/test_sphinx_seed_intersphinx_mapping_mocked_bad_example_requirements_flit_.yml index 58fcd50..4c54c69 100644 --- a/tests/test_seeding_/test_sphinx_seed_intersphinx_mapping_mocked_bad_example_requirements_flit_.yml +++ b/tests/test_seeding_/test_sphinx_seed_intersphinx_mapping_mocked_bad_example_requirements_flit_.yml @@ -8,5 +8,5 @@ packaging: - - null sphinx: - sphinx -- - https://www.sphinx-doc.org/en/3.x/ +- - https://www.sphinx-doc.org/en/master/ - - null diff --git a/tests/test_seeding_/test_sphinx_seed_intersphinx_mapping_mocked_bad_example_requirements_pyproject_.yml b/tests/test_seeding_/test_sphinx_seed_intersphinx_mapping_mocked_bad_example_requirements_pyproject_.yml index 58fcd50..4c54c69 100644 --- a/tests/test_seeding_/test_sphinx_seed_intersphinx_mapping_mocked_bad_example_requirements_pyproject_.yml +++ b/tests/test_seeding_/test_sphinx_seed_intersphinx_mapping_mocked_bad_example_requirements_pyproject_.yml @@ -8,5 +8,5 @@ packaging: - - null sphinx: - sphinx -- - https://www.sphinx-doc.org/en/3.x/ +- - https://www.sphinx-doc.org/en/master/ - - null diff --git a/tests/test_seeding_/test_sphinx_seed_intersphinx_mapping_mocked_bad_example_requirements_pyproject_toml_.yml b/tests/test_seeding_/test_sphinx_seed_intersphinx_mapping_mocked_bad_example_requirements_pyproject_toml_.yml index 58fcd50..4c54c69 100644 --- a/tests/test_seeding_/test_sphinx_seed_intersphinx_mapping_mocked_bad_example_requirements_pyproject_toml_.yml +++ b/tests/test_seeding_/test_sphinx_seed_intersphinx_mapping_mocked_bad_example_requirements_pyproject_toml_.yml @@ -8,5 +8,5 @@ packaging: - - null sphinx: - sphinx -- - https://www.sphinx-doc.org/en/3.x/ +- - https://www.sphinx-doc.org/en/master/ - - null diff --git a/tests/test_seeding_/test_sphinx_seed_intersphinx_mapping_mocked_bad_example_requirements_requirements_.yml b/tests/test_seeding_/test_sphinx_seed_intersphinx_mapping_mocked_bad_example_requirements_requirements_.yml index 58fcd50..4c54c69 100644 --- a/tests/test_seeding_/test_sphinx_seed_intersphinx_mapping_mocked_bad_example_requirements_requirements_.yml +++ b/tests/test_seeding_/test_sphinx_seed_intersphinx_mapping_mocked_bad_example_requirements_requirements_.yml @@ -8,5 +8,5 @@ packaging: - - null sphinx: - sphinx -- - https://www.sphinx-doc.org/en/3.x/ +- - https://www.sphinx-doc.org/en/master/ - - null diff --git a/tests/test_seeding_/test_sphinx_seed_intersphinx_mapping_mocked_example_requirements_a_flit_.yml b/tests/test_seeding_/test_sphinx_seed_intersphinx_mapping_mocked_example_requirements_a_flit_.yml index 8a05a51..3f71b14 100644 --- a/tests/test_seeding_/test_sphinx_seed_intersphinx_mapping_mocked_example_requirements_a_flit_.yml +++ b/tests/test_seeding_/test_sphinx_seed_intersphinx_mapping_mocked_example_requirements_a_flit_.yml @@ -16,5 +16,5 @@ slumber: - - null sphinx: - sphinx -- - https://www.sphinx-doc.org/en/3.x/ +- - https://www.sphinx-doc.org/en/master/ - - null diff --git a/tests/test_seeding_/test_sphinx_seed_intersphinx_mapping_mocked_example_requirements_a_pyproject_.yml b/tests/test_seeding_/test_sphinx_seed_intersphinx_mapping_mocked_example_requirements_a_pyproject_.yml index 8a05a51..3f71b14 100644 --- a/tests/test_seeding_/test_sphinx_seed_intersphinx_mapping_mocked_example_requirements_a_pyproject_.yml +++ b/tests/test_seeding_/test_sphinx_seed_intersphinx_mapping_mocked_example_requirements_a_pyproject_.yml @@ -16,5 +16,5 @@ slumber: - - null sphinx: - sphinx -- - https://www.sphinx-doc.org/en/3.x/ +- - https://www.sphinx-doc.org/en/master/ - - null diff --git a/tests/test_seeding_/test_sphinx_seed_intersphinx_mapping_mocked_example_requirements_a_pyproject_toml_.yml b/tests/test_seeding_/test_sphinx_seed_intersphinx_mapping_mocked_example_requirements_a_pyproject_toml_.yml index 8a05a51..3f71b14 100644 --- a/tests/test_seeding_/test_sphinx_seed_intersphinx_mapping_mocked_example_requirements_a_pyproject_toml_.yml +++ b/tests/test_seeding_/test_sphinx_seed_intersphinx_mapping_mocked_example_requirements_a_pyproject_toml_.yml @@ -16,5 +16,5 @@ slumber: - - null sphinx: - sphinx -- - https://www.sphinx-doc.org/en/3.x/ +- - https://www.sphinx-doc.org/en/master/ - - null diff --git a/tests/test_seeding_/test_sphinx_seed_intersphinx_mapping_mocked_example_requirements_a_requirements_.yml b/tests/test_seeding_/test_sphinx_seed_intersphinx_mapping_mocked_example_requirements_a_requirements_.yml index 8a05a51..3f71b14 100644 --- a/tests/test_seeding_/test_sphinx_seed_intersphinx_mapping_mocked_example_requirements_a_requirements_.yml +++ b/tests/test_seeding_/test_sphinx_seed_intersphinx_mapping_mocked_example_requirements_a_requirements_.yml @@ -16,5 +16,5 @@ slumber: - - null sphinx: - sphinx -- - https://www.sphinx-doc.org/en/3.x/ +- - https://www.sphinx-doc.org/en/master/ - - null From 6e1429f5c1848809df9d1fa88f2853d377ecdeab Mon Sep 17 00:00:00 2001 From: Mathieu <13415583+mathbou@users.noreply.github.com> Date: Tue, 15 Mar 2022 23:29:37 +0100 Subject: [PATCH 08/12] =?UTF-8?q?=F0=9F=9A=A8=20make=20mypy=20happy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seed_intersphinx_mapping/__init__.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/seed_intersphinx_mapping/__init__.py b/seed_intersphinx_mapping/__init__.py index e551c96..10201b9 100644 --- a/seed_intersphinx_mapping/__init__.py +++ b/seed_intersphinx_mapping/__init__.py @@ -83,20 +83,21 @@ def _get_project_links(project_name: str) -> List[str]: if _DOCUMENTATION_RE.match(label): urls.append(url) - urls.append(metadata.get("Home-Page")) + urls.append(metadata.get("Home-Page", "")) except dist_meta.distributions.DistributionNotFoundError: # Fall back to PyPI with PyPIJSON() as client: - metadata = client.get_metadata(project_name).info + pypi_metadata = client.get_metadata(project_name).info - if "project_urls" in metadata and metadata["project_urls"]: - for label, url in metadata["project_urls"].items(): - if _DOCUMENTATION_RE.match(label): - urls.append(url) + if "project_urls" in pypi_metadata and pypi_metadata["project_urls"]: - urls.append(metadata["home_page"]) + for label, url in pypi_metadata["project_urls"].items(): + if _DOCUMENTATION_RE.match(label): + urls.append(url) + + urls.append(pypi_metadata["home_page"]) urls = [url.strip() for url in filter(None, urls)] return urls From 6763c54f6b112d85f772c2b5d210eb43c8d5ec34 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 15 Mar 2022 23:03:28 +0000 Subject: [PATCH 09/12] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- seed_intersphinx_mapping/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed_intersphinx_mapping/__init__.py b/seed_intersphinx_mapping/__init__.py index 10201b9..17d0eff 100644 --- a/seed_intersphinx_mapping/__init__.py +++ b/seed_intersphinx_mapping/__init__.py @@ -83,7 +83,7 @@ def _get_project_links(project_name: str) -> List[str]: if _DOCUMENTATION_RE.match(label): urls.append(url) - urls.append(metadata.get("Home-Page", "")) + urls.append(metadata.get("Home-Page", '')) except dist_meta.distributions.DistributionNotFoundError: # Fall back to PyPI From 7dc9e8e688dc0a1e1726b338ff80d85829313355 Mon Sep 17 00:00:00 2001 From: Mathieu <923463-mathbou@users.noreply.gitlab.com> Date: Sat, 18 May 2024 21:11:56 +0200 Subject: [PATCH 10/12] =?UTF-8?q?=E2=9C=85=20fix=20packaging=20url=20for?= =?UTF-8?q?=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_seeding.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_seeding.py b/tests/test_seeding.py index 127b93d..cd34121 100644 --- a/tests/test_seeding.py +++ b/tests/test_seeding.py @@ -29,7 +29,7 @@ } bad_expected_mapping = { "domdf-python-tools": ("https://domdf-python-tools.readthedocs.io/en/latest/", None), - "packaging": ("https://packaging.pypa.io/en/latest/", None), + "packaging": ("https://packaging.pypa.io/en/stable/", None), "sphinx": ("https://www.sphinx-doc.org/en/master/", None), } From 739a0189df827a472666360b816647182dcad54d Mon Sep 17 00:00:00 2001 From: Mathieu <923463-mathbou@users.noreply.gitlab.com> Date: Sat, 18 May 2024 21:12:07 +0200 Subject: [PATCH 11/12] =?UTF-8?q?=E2=9C=85=20fix=20numpy=20error=20check?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_core.py b/tests/test_core.py index 77059aa..bea5c1f 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -24,7 +24,7 @@ def test_get_sphinx_doc_url(): with pytest.raises(ValueError, match="Documentation URL not found in data from PyPI."): get_sphinx_doc_url("slumber") - with pytest.raises(ValueError, match="objects.inv not found at url .*: HTTP Status 404"): + with pytest.raises(ValueError, match="Documentation URL not found in data from PyPI."): get_sphinx_doc_url("autodoc_pydantic") assert cache.clear(get_sphinx_doc_url) @@ -37,7 +37,7 @@ def test_get_sphinx_doc_url(): # Latest numpy's "Documentation" url doesn't point to Sphinx docs. with pytest.raises( ValueError, - match="objects.inv not found at url https://numpy.org/doc/objects.inv: HTTP Status 404." + match="Documentation URL not found in data from PyPI." ): get_sphinx_doc_url("numpy") else: From 49b93a7d4fcf804a55f6e970b5f934fe77e14a82 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 18 May 2024 19:12:22 +0000 Subject: [PATCH 12/12] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/test_core.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/test_core.py b/tests/test_core.py index bea5c1f..8f5e1fb 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -35,10 +35,7 @@ def test_get_sphinx_doc_url(): if sys.version_info[:2] != (3, 8): # Latest numpy's "Documentation" url doesn't point to Sphinx docs. - with pytest.raises( - ValueError, - match="Documentation URL not found in data from PyPI." - ): + with pytest.raises(ValueError, match="Documentation URL not found in data from PyPI."): get_sphinx_doc_url("numpy") else: assert re.match(r"https://numpy\.org/doc/1\.\d\d/", get_sphinx_doc_url("numpy"))