Skip to content

Commit dd44ae1

Browse files
authored
build: upgrade sphinx and change flake8 and related to only install on python >=3.8 (#2288)
The main aim of this change is to get to a newer version of Sphinx. However, if just Sphinx is upgraded, poetry can't do version solving because of the version of `importlib-metadata` that flake8 needs: ```console $ poetry install Updating dependencies Resolving dependencies... (0.6s) Because no versions of flakeheaven match >3.2.1,<4.0.0 and flakeheaven (3.2.1) depends on flake8 (>=4.0.1,<5.0.0), flakeheaven (>=3.2.1,<4.0.0) requires flake8 (>=4.0.1,<5.0.0). And because no versions of flake8 match >4.0.1,<5.0.0 and flake8 (4.0.1) depends on importlib-metadata (<4.3), flakeheaven (>=3.2.1,<4.0.0) requires importlib-metadata (<4.3). And because sphinx (5.3.0) depends on importlib-metadata (>=4.8) and no versions of sphinx match >5.3.0,<6.0.0, flakeheaven (>=3.2.1,<4.0.0) is incompatible with sphinx (>=5.3.0,<6.0.0). So, because rdflib depends on both sphinx (^5.3.0) and flakeheaven (^3.2.1), version solving failed. ``` To make things work, flake8 and related is only installed for Python >=3.8, where the built-in `importlib.metadata` is used instead of the `importlib-metadata` package. This means no more flake8 on python 3.7, but it is a reasonable trade-off to get to a newer version of Sphinx, and Python 3.7 support will be dropped by 2023-06-27 anyway. Other changes: - Changed Read the Docs to use the Sphinx version from poetry instead of the custom version that was in `devtools/requirements-rtd.txt`. - Added `typing-extensions` to the poetry `docs` dependency group as it is needed for docs to build correctly. - Changed the tox `docs` environment to be closer to the Read the Docs environment. Closes <#2272>.
1 parent 5a80926 commit dd44ae1

File tree

6 files changed

+57
-59
lines changed

6 files changed

+57
-59
lines changed

.readthedocs.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@ build:
2424
- poetry config virtualenvs.create false
2525
- poetry install --only=main --only=docs --extras=html
2626
- poetry env info
27-
# This will patch Sphinx to a later version than is in poetry.lock so that
28-
# we build with a more up to date Sphinx. This should be eliminated when
29-
# possible in favor of having a more up to date Sphinx in poetry.lock.
30-
- pip install -r devtools/requirements-rtd.txt
31-
3227

3328
sphinx:
3429
fail_on_warning: true

devtools/requirements-rtd.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/conf.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,5 +322,9 @@ def find_version(filename):
322322
("py:class", "_TripleType"),
323323
("py:class", "_TripleOrTriplePathType"),
324324
("py:class", "TextIO"),
325+
("py:class", "Message"),
325326
]
326327
)
328+
329+
if sys.version_info < (3, 8):
330+
nitpick_ignore.extend([("py:class", "importlib_metadata.EntryPoint")])

poetry.lock

Lines changed: 44 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,16 @@ types-setuptools = ">=65.6.0.3,<68.0.0.0"
6262
setuptools = ">=65.6.3,<68.0.0"
6363

6464
[tool.poetry.group.docs.dependencies]
65-
sphinx = ">4.0.0"
66-
myst-parser = "^0.18.0"
65+
sphinx = "^5.3.0"
66+
myst-parser = "^1.0.0"
6767
sphinxcontrib-apidoc = "^0.3.0"
6868
sphinx-autodoc-typehints = "^1.17.1"
69+
typing-extensions = "^4.5.0"
6970

7071
[tool.poetry.group.flake8.dependencies]
71-
flake8 = ">=4.0.1" # flakeheaven is incompatible with flake8 >=5.0 (https://github.com/flakeheaven/flakeheaven/issues/132)
72-
flakeheaven = "^3.2.1"
73-
pep8-naming = "^0.13.2"
72+
flake8 = {version = ">=4.0.1", python = ">=3.8"} # flakeheaven is incompatible with flake8 >=5.0 (https://github.com/flakeheaven/flakeheaven/issues/132)
73+
flakeheaven = {version = "^3.2.1", python = ">=3.8"}
74+
pep8-naming = {version = "^0.13.2", python = ">=3.8"}
7475

7576
[tool.poetry.extras]
7677
berkeleydb = ["berkeleydb"]

tox.ini

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ passenv =
5454
setenv =
5555
PYTHONHASHSEED = 0
5656
commands_pre =
57-
poetry install --no-root --only=docs
57+
poetry lock --check
58+
poetry install --only=main --only=docs --extras=html
59+
poetry env info
5860
commands =
5961
poetry run sphinx-build -T -W -b html -d {envdir}/doctree docs docs/_build/html
6062

0 commit comments

Comments
 (0)