Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 12 additions & 39 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.10", "3.11", "3.12", "3.13"]
sphinx: ["~=8.0"] # temporary limit, bring it back to newest sphinx once we are sphinx9 compatible
python-version: ["3.11", "3.12", "3.13", "3.14"]
sphinx: [""] # Newest Sphinx
myst-parser: [""] # Newest MyST Parser (any)
include:
# Just check the other platforms once
Expand All @@ -39,6 +39,12 @@ jobs:
sphinx: "~=8.0"
myst-parser: "~=4.0"
pillow: "==11.0.0"
# Oldest known-compatible dependencies
- os: ubuntu-latest
python-version: "3.10"
sphinx: "==5.0.0"
myst-parser: "==1.0.0"
pillow: "==11.0.0"
# Mid-range dependencies
- os: ubuntu-latest
python-version: "3.11"
Expand All @@ -47,9 +53,9 @@ jobs:
pillow: "==11.0.0"
# Newest known-compatible dependencies
- os: ubuntu-latest
python-version: "3.13"
sphinx: "~=8.0"
myst-parser: "==4.0.0"
python-version: "3.14"
sphinx: "~=9.0"
myst-parser: "~=5.0"
pillow: "==11.0.0"

runs-on: ${{ matrix.os }}
Expand All @@ -71,42 +77,9 @@ jobs:
- name: Run pytest
run: pytest --durations=10

coverage:
needs: [tests]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: "3.11"
cache: pip
- name: Install dependencies
run: |
pip install -e .[testing]
pip freeze

- name: Run pytest
run: pytest --durations=10 --cov=myst_nb --cov-report=xml --cov-report=term-missing

- name: Create cov
run: coverage xml
# for some reason the tests/conftest.py::check_nbs fixture breaks pytest-cov's cov-report outputting
# this is why we run `coverage xml` afterwards (required by codecov)

# TEMPORARY FIX: Disable codecov until we can get it working again
- name: Upload to Codecov
uses: codecov/codecov-action@v5
if: false
with:
name: myst-nb-pytests
flags: pytests
files: ./coverage.xml

publish:

name: Publish to PyPi
name: Publish to PyPI
needs: [tests]
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
runs-on: ubuntu-latest
Expand Down
13 changes: 4 additions & 9 deletions myst_nb/sphinx_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from importlib import resources as import_resources
import os
from pathlib import Path
import sys
from types import ModuleType
from typing import Any, Iterator, cast

Expand Down Expand Up @@ -194,14 +193,10 @@ def _get_file_hash(path: Path):

@contextlib.contextmanager
def _import_resources_path(package: ModuleType, resource: str) -> Iterator[Path]:
if sys.version_info < (3, 9):
with import_resources.path(package, resource) as path:
yield path
else:
with import_resources.as_file(
import_resources.files(package).joinpath(resource)
) as path:
yield path
with import_resources.as_file(
import_resources.files(package).joinpath(resource)
) as path:
yield path


def add_css(app: Sphinx):
Expand Down
9 changes: 5 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[build-system]
[build-system]
requires = ["flit_core >=3.11,<4"]
build-backend = "flit_core.buildapi"

Expand All @@ -20,6 +20,7 @@ classifiers = [
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Libraries :: Python Modules",
Expand All @@ -42,7 +43,7 @@ dependencies = [
"myst-parser>=1.0.0",
"nbformat>=5.0",
"pyyaml",
"sphinx>=5,<9", # If we get bugs for older versions, just pin this higher
"sphinx>=5", # If we get bugs for older versions, just pin this higher
"typing-extensions",
# ipykernel is not a requirement of the library,
# but is a common requirement for users (registers the python3 kernel)
Expand Down Expand Up @@ -174,8 +175,8 @@ filterwarnings = [
'ignore:datetime.datetime.utcnow\(\) is deprecated:DeprecationWarning:jupyter_cache',
# From matplotlib’s dependencies
'ignore::DeprecationWarning:pyparsing', # imports deprecated `sre_constants`
# From myst-parser on Sphinx 9
'ignore:.*MystReferenceResolver.app.*:DeprecationWarning',
# From myst-parser on Sphinx 9 we hit RemovedInSphinx11Warning
'ignore:.*MystReferenceResolver.app.*',
# Upstream myst-parser still hits env.app deprecations under Sphinx 9
'ignore:.*env\\.app.*:DeprecationWarning:myst_parser',
# Windows issues, some may need to be fixed in MyST-NB, others are upstream
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ envlist = py313-sphinx8
[testenv]
usedevelop = true

[testenv:py{310,311,312,313}-sphinx{5,6,7,8}]
[testenv:py{310,311,312,313,314}-sphinx{5,6,7,8}]
extras = testing
deps =
sphinx5: sphinx>=5,<6
Expand Down
Loading