From d9556d0ad8cf9fe33c8d31cf29ed16e1eb75f042 Mon Sep 17 00:00:00 2001 From: Angus Hollands Date: Thu, 27 Jun 2024 12:26:29 +0100 Subject: [PATCH] MAINT: appease mypy (#612) * maint: appease MyPy * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * chore: restore ignored type * ci: disable pre-commit --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .github/workflows/tests.yml | 11 ----------- .pre-commit-config.yaml | 2 +- myst_nb/sphinx_ext.py | 13 ++++++++----- 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 031e9c24..dee0ce05 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,17 +8,6 @@ on: pull_request: jobs: - pre-commit: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Set up Python 3.10 - uses: actions/setup-python@v5 - with: - python-version: "3.10" - - uses: pre-commit/action@v3.0.0 tests: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b3dd2508..b6021404 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -39,7 +39,7 @@ repos: additional_dependencies: - importlib_metadata - myst-parser~=2.0.0 - - "sphinx~=7.0" + - "sphinx~=7.3.7" - nbclient - types-PyYAML files: > diff --git a/myst_nb/sphinx_ext.py b/myst_nb/sphinx_ext.py index 780fbce5..7ad07e37 100644 --- a/myst_nb/sphinx_ext.py +++ b/myst_nb/sphinx_ext.py @@ -52,13 +52,16 @@ def sphinx_setup(app: Sphinx): for name, default, field in NbParserConfig().as_triple(): if not field.metadata.get("sphinx_exclude"): # TODO add types? - app.add_config_value(f"nb_{name}", default, "env", Any) + app.add_config_value(f"nb_{name}", default, "env", Any) # type: ignore[arg-type] if "legacy_name" in field.metadata: app.add_config_value( - f"{field.metadata['legacy_name']}", _UNSET, "env", Any + f"{field.metadata['legacy_name']}", + _UNSET, + "env", + Any, # type: ignore[arg-type] ) # Handle non-standard deprecation - app.add_config_value("nb_render_priority", _UNSET, "env", Any) + app.add_config_value("nb_render_priority", _UNSET, "env", Any) # type: ignore[arg-type] # generate notebook configuration from Sphinx configuration # this also validates the configuration values @@ -130,7 +133,7 @@ def create_mystnb_config(app): """Generate notebook configuration from Sphinx configuration""" # Ignore type checkers because the attribute is dynamically assigned - from sphinx.util.console import bold # type: ignore[attr-defined] + from sphinx.util.console import bold values = {} for name, _, field in NbParserConfig().as_triple(): @@ -227,4 +230,4 @@ def add_per_page_html_resources( return js_files = NbMetadataCollector.get_js_files(cast(SphinxEnvType, app.env), pagename) for path, kwargs in js_files.values(): - app.add_js_file(path, **kwargs) # type: ignore + app.add_js_file(path, **kwargs) # type: ignore[arg-type]