Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT: appease mypy #612

Merged
merged 4 commits into from
Jun 27, 2024
Merged
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
11 changes: 0 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: >
Expand Down
13 changes: 8 additions & 5 deletions myst_nb/sphinx_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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():
Expand Down Expand Up @@ -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]