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: Fix codecov jobs and update pre-commit #460

Merged
merged 5 commits into from
Apr 11, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
# this is why we run `coverage xml` afterwards (required by codecov)

- name: Upload to Codecov
if: github.repository == 'executablebooks/MyST-NB'
if: github.repository == 'executablebooks/MyST-NB' && matrix.python-version == '3.9' && matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v1
with:
name: myst-nb-pytests
Expand Down
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,37 @@ exclude: >
repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.4.0
hooks:
- id: check-json
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/asottile/pyupgrade
rev: v3.2.2
rev: v3.3.1
hooks:
- id: pyupgrade
args: [--py37-plus]

- repo: https://github.com/PyCQA/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort

- repo: https://github.com/psf/black
rev: 22.10.0
rev: 23.3.0
hooks:
- id: black

- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
rev: 6.0.0
hooks:
- id: flake8
additional_dependencies: [flake8-bugbear]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.990
rev: v1.2.0
hooks:
- id: mypy
args: [--config-file=pyproject.toml]
Expand Down
2 changes: 1 addition & 1 deletion docs/authoring/jupyter-notebooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Sphinx using the MyST parser.[^download]

:::{seealso}
For more information about what you can write with MyST Markdown, see the
[MyST Parser syntax guide](myst:syntax/syntax).
[MyST Parser documentation](myst:intro/get-started).
:::

### Configuration
Expand Down
4 changes: 0 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ def field_type(field):
return ctype

class MystNbConfigDirective(_ConfigBase):

required_arguments = 1
option_spec = {
"sphinx": directives.flag,
Expand All @@ -197,7 +196,6 @@ def run(self):
text = self.table_header()
count = 0
for name, value, field in config.as_triple():

# filter by sphinx options
if "sphinx" in self.options and field.metadata.get("sphinx_exclude"):
continue
Expand Down Expand Up @@ -239,7 +237,6 @@ def run(self):
return node.children

class MystConfigDirective(_ConfigBase):

option_spec = {
"sphinx": directives.flag,
}
Expand All @@ -250,7 +247,6 @@ def run(self):
text = self.table_header()
count = 0
for name, value, field in config.as_triple():

# filter by sphinx options
if "sphinx" in self.options and field.metadata.get("sphinx_exclude"):
continue
Expand Down
3 changes: 0 additions & 3 deletions myst_nb/core/execute/inline.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class NotebookClientInline(NotebookClientBase):
"""

def start_client(self):

self._tmp_path = None
if self.nb_config.execution_in_temp:
self._tmp_path = mkdtemp()
Expand Down Expand Up @@ -114,12 +113,10 @@ def close_client(self, exc_type, exc_val, exc_tb):
def code_cell_outputs(
self, cell_index: int
) -> tuple[int | None, list[NotebookNode]]:

cells = self.notebook.get("cells", [])

# ensure all cells up to and including the requested cell have been executed
while (not self._cell_error) and cell_index > self._last_cell_executed:

self._last_cell_executed += 1
try:
next_cell = cells[self._last_cell_executed]
Expand Down
1 change: 0 additions & 1 deletion myst_nb/core/nb_to_tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ def notebook_to_tokens(
# (required to collect all reference definitions, before assessing references).
block_tokens = [Token("nb_initialise", "", 0, map=[0, 0])]
for cell_index, nb_cell in enumerate(notebook.cells):

# skip empty cells
if len(nb_cell["source"].strip()) == 0:
continue
Expand Down
1 change: 0 additions & 1 deletion myst_nb/core/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ def _flush_markdown(start_line, token, md_metadata):
md_metadata: dict = {}

for token in tokens:

nesting_level += token.nesting

if nesting_level != 0:
Expand Down
1 change: 0 additions & 1 deletion myst_nb/core/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ def render_nb_cell_code(self: SelfType, token: SyntaxTreeNode) -> None:

self.add_line_and_source_path(cell_container, token)
with self.current_node_context(cell_container, append=True):

# render the code source code
if not remove_input:
cell_input = nodes.container(
Expand Down
1 change: 0 additions & 1 deletion myst_nb/docutils_.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,6 @@ def _render_nb_cell_code_outputs(
self.add_line_and_source_path_r(_nodes, token)
self.current_node.extend(_nodes)
elif output.output_type in ("display_data", "execute_result"):

# Note, this is different to the sphinx implementation,
# here we directly select a single output, based on the mime_priority,
# as opposed to output all mime types, and select in a post-transform
Expand Down
1 change: 0 additions & 1 deletion myst_nb/ext/glue/roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class PasteRoleAny(RoleBase):
"""

def run(self) -> tuple[list[nodes.Node], list[nodes.system_message]]:

# check if this is a pending reference
doc_key = self.text.split("::", 1)
if len(doc_key) == 2:
Expand Down
3 changes: 0 additions & 3 deletions myst_nb/sphinx_.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ def _render_nb_cell_code_outputs(
self.add_line_and_source_path_r(_nodes, token)
self.current_node.extend(_nodes)
elif output.output_type in ("display_data", "execute_result"):

# Note, this is different to the docutils implementation,
# where we directly select a single output, based on the mime_priority.
# Here, we do not know the mime priority until we know the output format
Expand Down Expand Up @@ -504,9 +503,7 @@ class HideInputCells(SphinxPostTransform):
formats = ("html",)

def run(self, **kwargs):

for node in findall(self.document)(nodes.container):

if (
node.get("nb_element") == "cell_code"
and node.get("hide_mode")
Expand Down