From 48b7fbfb7d3ba3c174cb47c421d9f8c63a1c45c4 Mon Sep 17 00:00:00 2001 From: George Hickman Date: Tue, 22 Apr 2025 11:27:48 +0100 Subject: [PATCH 1/2] Upgrade sphinx 1.2.2 -> 8.1.3 --- requirements.dev.txt | 9 +++------ requirements.prod.in | 3 +-- requirements.prod.txt | 42 +++++++++++++++++++++++++++++++++--------- 3 files changed, 37 insertions(+), 17 deletions(-) diff --git a/requirements.dev.txt b/requirements.dev.txt index f17b1810..1dfdfc7e 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -30,7 +30,7 @@ mypy-json-report==0.1.3 # via -r requirements.dev.in nodeenv==1.6.0 # via pre-commit -packaging==21.3 +packaging==25.0 # via # -c requirements.prod.txt # pytest @@ -42,10 +42,6 @@ pre-commit==2.15.0 # via -r requirements.dev.in py==1.11.0 # via pytest -pyparsing==3.0.6 - # via - # -c requirements.prod.txt - # packaging pytest==7.1.2 # via # -r requirements.dev.in @@ -65,8 +61,9 @@ text-unidecode==1.3 # via faker toml==0.10.2 # via pre-commit -tomli==2.0.0 +tomli==2.2.1 # via + # -c requirements.prod.txt # coverage # mypy # pytest diff --git a/requirements.prod.in b/requirements.prod.in index 1c2ebfa2..28642d4d 100644 --- a/requirements.prod.in +++ b/requirements.prod.in @@ -7,7 +7,6 @@ django-sans-db>=1.2.0 environs[django] gunicorn requests -# New versions aren't supported yet -sphinx==1.2.2 +sphinx werkzeug whitenoise diff --git a/requirements.prod.txt b/requirements.prod.txt index 4589eff4..ef5ee462 100644 --- a/requirements.prod.txt +++ b/requirements.prod.txt @@ -1,9 +1,13 @@ # This file was autogenerated by uv via the following command: # uv pip compile requirements.prod.in --output-file=requirements.prod.txt +alabaster==1.0.0 + # via sphinx asgiref==3.4.1 # via django attrs==21.4.0 # via -r requirements.prod.in +babel==2.17.0 + # via sphinx blessings==1.7 # via -r requirements.prod.in certifi==2022.12.7 @@ -26,7 +30,7 @@ django-pygmy==0.1.5 # via -r requirements.prod.in django-sans-db==1.2.0 # via -r requirements.prod.in -docutils==0.17.1 +docutils==0.21.2 # via sphinx environs==9.5.0 # via -r requirements.prod.in @@ -34,34 +38,54 @@ gunicorn==20.1.0 # via -r requirements.prod.in idna==3.3 # via requests -jinja2==3.0.2 +imagesize==1.4.1 + # via sphinx +jinja2==3.1.6 # via sphinx markupsafe==2.0.1 # via jinja2 marshmallow==3.18.0 # via environs -packaging==21.3 - # via marshmallow +packaging==25.0 + # via + # marshmallow + # sphinx pygments==2.19.1 # via # django-pygmy # sphinx -pyparsing==3.0.6 - # via packaging python-dotenv==0.21.0 # via environs pytz==2021.3 # via django -requests==2.26.0 - # via -r requirements.prod.in +requests==2.32.3 + # via + # -r requirements.prod.in + # sphinx setuptools==70.0.0 # via gunicorn six==1.16.0 # via blessings -sphinx==1.2.2 +snowballstemmer==2.2.0 + # via sphinx +sphinx==8.1.3 # via -r requirements.prod.in +sphinxcontrib-applehelp==2.0.0 + # via sphinx +sphinxcontrib-devhelp==2.0.0 + # via sphinx +sphinxcontrib-htmlhelp==2.1.0 + # via sphinx +sphinxcontrib-jsmath==1.0.1 + # via sphinx +sphinxcontrib-qthelp==2.0.0 + # via sphinx +sphinxcontrib-serializinghtml==2.0.0 + # via sphinx sqlparse==0.4.2 # via django +tomli==2.2.1 + # via sphinx urllib3==1.26.7 # via requests werkzeug==2.0.2 From 38cff45186d3ff0a551ba56850952a626053a7de Mon Sep 17 00:00:00 2001 From: George Hickman Date: Thu, 24 Apr 2025 14:56:17 +0100 Subject: [PATCH 2/2] Switch to Sphinx's InventoryFile when retrieving URLs The interface to fetch_inventory changed around the 7-8 major version to take a Sphinx config object. However, we're not working with a sphinx site and just want it to load and parse an inventory file for us. Luckily, the project ships the InventoryFile class which provides an interface to do exactly this. --- cbv/management/commands/fetch_docs_urls.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cbv/management/commands/fetch_docs_urls.py b/cbv/management/commands/fetch_docs_urls.py index fd42deae..8e23068e 100644 --- a/cbv/management/commands/fetch_docs_urls.py +++ b/cbv/management/commands/fetch_docs_urls.py @@ -1,8 +1,10 @@ +import posixpath + import requests from blessings import Terminal from django.conf import settings from django.core.management.base import BaseCommand -from sphinx.ext.intersphinx import fetch_inventory +from sphinx.util.inventory import InventoryFile from cbv.models import Klass, ProjectVersion @@ -51,7 +53,7 @@ def handle(self, *args, **options): # the arg `r.raw` should be a Sphinx instance object.. r = requests.get(ver_inv_url, stream=True) r.raise_for_status() - invdata = fetch_inventory(r.raw, ver_url, ver_inv_url) + invdata = InventoryFile.load(r.raw, ver_url, posixpath.join) # we only want classes.. for item in invdata["py:class"]: # ..which come from one of our sources