Skip to content

Commit

Permalink
MAINT: fix sphinx 8.0 compatibility (#620)
Browse files Browse the repository at this point in the history
* MAINT: fix sphinx 8.0 compatibility

* CI: adding sphinx 8 to the test matrix

* MAINT: fix it for older sphinx versions

* CI: some more version magic

* ci: add mid-range case, bump Python version

---------

Co-authored-by: Angus Hollands <[email protected]>
  • Loading branch information
bsipocz and agoose77 authored Aug 28, 2024
1 parent 6ce30cd commit 248151e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
23 changes: 14 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,33 @@ jobs:
matrix:
os: [ubuntu-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]
sphinx: [">=5,<8"] # Newest Sphinx (any)
sphinx: [">=5,<9"] # Newest Sphinx (any)
myst-parser: [">=1,<3"] # Newest MyST Parser (any)
include:
# Just check the other platforms once
- os: windows-latest
python-version: "3.10"
sphinx: "~=7.0"
myst-parser: "~=2.0"
python-version: "3.12"
sphinx: "~=8.0"
myst-parser: "~=4.0"
- os: macos-latest
python-version: "3.10"
sphinx: "~=7.0"
myst-parser: "~=2.0"
python-version: "3.12"
sphinx: "~=8.0"
myst-parser: "~=4.0"
# Oldest known-compatible dependencies
- os: ubuntu-latest
python-version: "3.9"
sphinx: "==5.0.0"
myst-parser: "==1.0.0"
# Newest known-compatible dependencies
# Mid-range dependencies
- os: ubuntu-latest
python-version: "3.12"
python-version: "3.11"
sphinx: "==7.0.0"
myst-parser: "==2.0.0"
# Newest known-compatible dependencies
- os: ubuntu-latest
python-version: "3.12"
sphinx: "==8.0.2"
myst-parser: "==4.0.0"

runs-on: ${{ matrix.os }}

Expand Down
2 changes: 1 addition & 1 deletion myst_nb/core/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def create_nb_reader(
# we check suffixes ordered by longest first, to ensure we get the "closest" match
iterator = sorted(readers.items(), key=lambda x: len(x[0]), reverse=True)
for suffix, (reader, reader_kwargs, commonmark_only) in iterator:
if path.endswith(suffix):
if Path(path).suffix == suffix:
if isinstance(reader, str):
# attempt to load the reader as an object path
reader = import_object(reader)
Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ envlist = py311-sphinx7
[testenv]
usedevelop = true

[testenv:py{39,310,311,312}-sphinx{5,6,7}]
[testenv:py{39,310,311,312}-sphinx{5,6,7,8}]
extras = testing
deps =
sphinx5: sphinx>=5,<6
sphinx6: sphinx>=6,<7
sphinx7: sphinx>=7,<8
sphinx8: sphinx>=8,<9
commands = pytest {posargs}

[testenv:docs-{update,clean}]
Expand Down

0 comments on commit 248151e

Please sign in to comment.