Skip to content

Commit 8d6e25d

Browse files
[pre-commit.ci] pre-commit autoupdate (#569)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/pre-commit/pre-commit-hooks: v4.5.0 → v5.0.0](pre-commit/pre-commit-hooks@v4.5.0...v5.0.0) - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.6.9](astral-sh/ruff-pre-commit@v0.1.4...v0.6.9) - [github.com/pre-commit/mirrors-mypy: v1.6.1 → v1.11.2](pre-commit/mirrors-mypy@v1.6.1...v1.11.2) - [github.com/codespell-project/codespell: v2.2.6 → v2.3.0](codespell-project/codespell@v2.2.6...v2.3.0) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 83f8d1b commit 8d6e25d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+538
-474
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ ci:
1515
repos:
1616

1717
- repo: https://github.com/pre-commit/pre-commit-hooks
18-
rev: v4.5.0
18+
rev: v5.0.0
1919
hooks:
2020
- id: check-json
2121
- id: check-yaml
@@ -28,14 +28,14 @@ repos:
2828
- id: trailing-whitespace
2929

3030
- repo: https://github.com/astral-sh/ruff-pre-commit
31-
rev: v0.1.4
31+
rev: v0.6.9
3232
hooks:
3333
- id: ruff
3434
args: ["--fix", "--show-fixes"]
3535
- id: ruff-format
3636

3737
- repo: https://github.com/pre-commit/mirrors-mypy
38-
rev: v1.6.1
38+
rev: v1.11.2
3939
hooks:
4040
- id: mypy
4141
args: [--config-file=pyproject.toml]
@@ -51,7 +51,7 @@ repos:
5151
)$
5252
5353
- repo: https://github.com/codespell-project/codespell
54-
rev: v2.2.6
54+
rev: v2.3.0
5555
hooks:
5656
- id: codespell
5757
args: ["-S", "*.ipynb"]

docs/render/orphaned_nb.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@
3333
],
3434
"source": [
3535
"from myst_nb import glue\n",
36+
"\n",
3637
"glue(\"var_text\", \"My orphaned variable!\")\n",
37-
"glue(\"var_float\", 1.0/3.0)"
38+
"glue(\"var_float\", 1.0 / 3.0)"
3839
]
3940
}
4041
],

myst_nb/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""A docutils/sphinx parser for Jupyter Notebooks."""
2+
23
__version__ = "1.1.2"
34

45

myst_nb/cli.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""A basic CLI for quickstart of a myst_nb project."""
2+
23
from __future__ import annotations
34

45
import argparse

myst_nb/core/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Configuration for myst-nb."""
2+
23
import dataclasses as dc
34
from enum import Enum
45
from typing import Any, Callable, Dict, Iterable, Literal, Optional, Sequence, Tuple

myst_nb/core/execute/base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Module for executing notebooks."""
2+
23
from __future__ import annotations
34

45
from pathlib import Path

myst_nb/core/execute/cache.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Execute a notebook from the cache."""
2+
23
from __future__ import annotations
34

45
from contextlib import nullcontext, suppress

myst_nb/core/execute/direct.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Execute a notebook directly."""
2+
23
from __future__ import annotations
34

45
from contextlib import nullcontext

myst_nb/core/execute/inline.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Execute a notebook inline."""
2+
23
from __future__ import annotations
34

45
import asyncio

myst_nb/core/lexers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Pygments lexers"""
2+
23
from __future__ import annotations
34

45
import re

myst_nb/core/loggers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
``logger.warning("message", line=1, subtype="foo")``
1010
1111
"""
12+
1213
import logging
1314
from typing import Union
1415

myst_nb/core/nb_to_tokens.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Module for parsing notebooks to Markdown-it tokens."""
2+
23
from __future__ import annotations
34

45
from typing import Any

myst_nb/core/read.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Module for reading notebook formats from a string input."""
2+
23
from __future__ import annotations
34

45
import dataclasses as dc

myst_nb/core/render.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
Note, this module purposely does not import any Sphinx modules at the top-level,
44
in order for docutils-only use.
55
"""
6+
67
from __future__ import annotations
78

89
from binascii import a2b_base64

myst_nb/core/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Shared utilities."""
2+
23
from __future__ import annotations
34

45
import re

myst_nb/core/variables.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Utilities for rendering code output variables."""
2+
23
from __future__ import annotations
34

45
from ast import literal_eval

myst_nb/docutils_.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""The docutils parser implementation for myst-nb."""
2+
23
from __future__ import annotations
34

45
from dataclasses import dataclass, field

myst_nb/ext/eval/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Roles/directives for evaluating variables in the notebook."""
2+
23
from __future__ import annotations
34

45
from functools import partial
@@ -161,9 +162,9 @@ def run(self):
161162
render: dict[str, Any] = {}
162163
for key in ("alt", "height", "width", "scale", "class"):
163164
if key in self.options:
164-
render.setdefault("image", {})[
165-
key.replace("classes", "class")
166-
] = self.options[key]
165+
render.setdefault("image", {})[key.replace("classes", "class")] = (
166+
self.options[key]
167+
)
167168

168169
mime_nodes = render_variable_outputs(
169170
data, self.document, self.line, self.source, render=render

myst_nb/ext/execution_tables.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
which is then replaced by a table of statistics in a post-transformation
55
(once all the documents have been executed and these statistics are available).
66
"""
7+
78
from __future__ import annotations
89

910
from datetime import datetime

myst_nb/ext/glue/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Functionality for storing special data in notebook code cells,
22
which can then be inserted into the document body.
33
"""
4+
45
from __future__ import annotations
56

67
from typing import TYPE_CHECKING, Any

myst_nb/ext/glue/crossref.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
Note, we restrict this to a only a subset of mime-types and data -> nodes transforms,
44
since adding these nodes in a post-transform will not apply any transforms to them.
55
"""
6+
67
from __future__ import annotations
78

89
from functools import lru_cache

myst_nb/ext/glue/directives.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
We intentionally do no import sphinx in this module,
44
in order to allow docutils-only use without sphinx installed.
55
"""
6+
67
from typing import TYPE_CHECKING, Any, Dict, List
78

89
from docutils import nodes
@@ -151,9 +152,9 @@ def run(self):
151152
render: Dict[str, Any] = {}
152153
for key in ("alt", "height", "width", "scale", "class"):
153154
if key in self.options:
154-
render.setdefault("image", {})[
155-
key.replace("classes", "class")
156-
] = self.options[key]
155+
render.setdefault("image", {})[key.replace("classes", "class")] = (
156+
self.options[key]
157+
)
157158
paste_nodes = render_variable_outputs(
158159
[data], self.document, self.line, self.source, render=render
159160
)

myst_nb/ext/glue/domain.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
This is required for any directive/role names using `:`.
44
"""
5+
56
from sphinx.domains import Domain
67

78
from .directives import (

myst_nb/ext/glue/roles.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
We intentionally do no import sphinx in this module,
44
in order to allow docutils-only use without sphinx installed.
55
"""
6+
67
from __future__ import annotations
78

89
from docutils import nodes

myst_nb/ext/glue/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
We intentionally do no import sphinx in this module,
44
in order to allow docutils-only use without sphinx installed.
55
"""
6+
67
from __future__ import annotations
78

89
from functools import partial

myst_nb/ext/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
We intentionally do no import sphinx in this module,
44
in order to allow docutils-only use without sphinx installed.
55
"""
6+
67
from __future__ import annotations
78

89
from typing import Any

myst_nb/sphinx_.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""The sphinx parser implementation for myst-nb."""
2+
23
from __future__ import annotations
34

45
from collections import defaultdict

myst_nb/sphinx_ext.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Setup for the myst-nb sphinx extension."""
2+
23
from __future__ import annotations
34

45
import contextlib

myst_nb/warnings_.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Central handling of warnings for the myst-nb extension."""
2+
23
from __future__ import annotations
34

45
from enum import Enum

tests/notebooks/basic_failing.ipynb

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
11
{
2-
"cells": [
3-
{
4-
"cell_type": "markdown",
5-
"metadata": {},
6-
"source": [
7-
"# a title\n",
8-
"\n",
9-
"some text\n"
10-
]
11-
},
12-
{
13-
"cell_type": "code",
14-
"execution_count": null,
15-
"metadata": {},
16-
"source": [
17-
"raise Exception('oopsie!')"
18-
],
19-
"outputs": []
20-
}
21-
],
22-
"metadata": {
23-
"test_name": "notebook1",
24-
"kernelspec": {
25-
"display_name": "Python 3",
26-
"language": "python",
27-
"name": "python3"
28-
},
29-
"language_info": {
30-
"codemirror_mode": {
31-
"name": "ipython",
32-
"version": 3
33-
},
34-
"file_extension": ".py",
35-
"mimetype": "text/x-python",
36-
"name": "python",
37-
"nbconvert_exporter": "python",
38-
"pygments_lexer": "ipython3",
39-
"version": "3.6.1"
40-
}
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# a title\n",
8+
"\n",
9+
"some text\n"
10+
]
4111
},
42-
"nbformat": 4,
43-
"nbformat_minor": 2
12+
{
13+
"cell_type": "code",
14+
"execution_count": null,
15+
"metadata": {},
16+
"outputs": [],
17+
"source": [
18+
"raise Exception(\"oopsie!\")"
19+
]
20+
}
21+
],
22+
"metadata": {
23+
"kernelspec": {
24+
"display_name": "Python 3",
25+
"language": "python",
26+
"name": "python3"
27+
},
28+
"language_info": {
29+
"codemirror_mode": {
30+
"name": "ipython",
31+
"version": 3
32+
},
33+
"file_extension": ".py",
34+
"mimetype": "text/x-python",
35+
"name": "python",
36+
"nbconvert_exporter": "python",
37+
"pygments_lexer": "ipython3",
38+
"version": "3.6.1"
39+
},
40+
"test_name": "notebook1"
41+
},
42+
"nbformat": 4,
43+
"nbformat_minor": 2
4444
}

0 commit comments

Comments
 (0)