Skip to content

Commit

Permalink
Merge branch 'main' into cell-anchor
Browse files Browse the repository at this point in the history
  • Loading branch information
krassowski authored Feb 11, 2023
2 parents ba0e27c + e355aec commit a6ad846
Show file tree
Hide file tree
Showing 78 changed files with 576 additions and 323 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install texlive-plain-generic inkscape texlive-xetex latexmk
sudo apt-get install texlive-plain-generic inkscape texlive-xetex latexmk enchant-2
# pandoc is not up to date in the ubuntu repos, so we install directly
wget https://github.com/jgm/pandoc/releases/download/2.14.2/pandoc-2.14.2-1-amd64.deb && sudo dpkg -i pandoc-2.14.2-1-amd64.deb
Expand Down
15 changes: 5 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
branches: [main]
pull_request:
schedule:
- cron: "0 8 * * *"

concurrency:
group: tests-${{ github.ref }}
Expand Down Expand Up @@ -65,8 +67,9 @@ jobs:
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Run Linters
run: |
hatch run typing:test
hatch run lint:style
pipx run 'validate-pyproject[all]' pyproject.toml
pipx run interrogate -v .
pipx run doc8 --max-line-length=200 --ignore-path=docs/source/other/full-config.rst
check_release:
Expand All @@ -91,14 +94,6 @@ jobs:
with:
ignore_links: 'https://ipywidgets.readthedocs.io/en/latest/examples/Output'

pre_commit:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- uses: jupyterlab/maintainer-tools/.github/actions/pre-commit@v1

test_minimum_versions:
name: Test Minimum Versions
timeout-minutes: 20
Expand Down Expand Up @@ -151,7 +146,7 @@ jobs:
if: always()
needs:
- run-tests
- pre_commit
- test_lint
- test_minimum_versions
- test_prereleases
- check_links
Expand Down
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: end-of-file-fixer
- id: check-case-conflict
- id: check-ast
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: requirements-txt-fixer
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: check-json
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: forbid-new-submodules
- id: check-builtin-literals
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/python-jsonschema/check-jsonschema
Expand All @@ -31,12 +31,12 @@ repos:
[mdformat-gfm, mdformat-frontmatter, mdformat-footnote]

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

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.181
rev: v0.0.237
hooks:
- id: ruff
args: ["--fix"]
58 changes: 56 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,62 @@

<!-- <START NEW CHANGELOG ENTRY> -->

## 7.2.9

([Full Changelog](https://github.com/jupyter/nbconvert/compare/v7.2.8...14b1d7aa75485ea754c2d0ffc67cc528e3984a99))

### Bugs fixed

- Fix handling of css sanitizer [#1940](https://github.com/jupyter/nbconvert/pull/1940) ([@blink1073](https://github.com/blink1073))

### Contributors to this release

([GitHub contributors page for this release](https://github.com/jupyter/nbconvert/graphs/contributors?from=2023-01-16&to=2023-01-24&type=c))

[@blink1073](https://github.com/search?q=repo%3Ajupyter%2Fnbconvert+involves%3Ablink1073+updated%3A2023-01-16..2023-01-24&type=Issues)

<!-- <END NEW CHANGELOG ENTRY> -->

## 7.2.8

([Full Changelog](https://github.com/jupyter/nbconvert/compare/v7.2.7...73f7b1b93a4526d7e9d987f5a5b207eaed8171f2))

### Bugs fixed

- always pass relax_add_props=True when validating [#1936](https://github.com/jupyter/nbconvert/pull/1936) ([@minrk](https://github.com/minrk))

### Maintenance and upkeep improvements

- Update codecov link [#1935](https://github.com/jupyter/nbconvert/pull/1935) ([@blink1073](https://github.com/blink1073))
- Fix types and add lint to automerge [#1932](https://github.com/jupyter/nbconvert/pull/1932) ([@blink1073](https://github.com/blink1073))
- Add type checking [#1930](https://github.com/jupyter/nbconvert/pull/1930) ([@blink1073](https://github.com/blink1073))
- Add spelling and docstring enforcement [#1929](https://github.com/jupyter/nbconvert/pull/1929) ([@blink1073](https://github.com/blink1073))
- Add scheduled ci run [#1926](https://github.com/jupyter/nbconvert/pull/1926) ([@blink1073](https://github.com/blink1073))

### Contributors to this release

([GitHub contributors page for this release](https://github.com/jupyter/nbconvert/graphs/contributors?from=2022-12-19&to=2023-01-16&type=c))

[@blink1073](https://github.com/search?q=repo%3Ajupyter%2Fnbconvert+involves%3Ablink1073+updated%3A2022-12-19..2023-01-16&type=Issues) | [@maartenbreddels](https://github.com/search?q=repo%3Ajupyter%2Fnbconvert+involves%3Amaartenbreddels+updated%3A2022-12-19..2023-01-16&type=Issues) | [@martinRenou](https://github.com/search?q=repo%3Ajupyter%2Fnbconvert+involves%3AmartinRenou+updated%3A2022-12-19..2023-01-16&type=Issues) | [@minrk](https://github.com/search?q=repo%3Ajupyter%2Fnbconvert+involves%3Aminrk+updated%3A2022-12-19..2023-01-16&type=Issues) | [@pre-commit-ci](https://github.com/search?q=repo%3Ajupyter%2Fnbconvert+involves%3Apre-commit-ci+updated%3A2022-12-19..2023-01-16&type=Issues)

## 7.2.7

([Full Changelog](https://github.com/jupyter/nbconvert/compare/v7.2.6...a32c3c1063e081d7e639b7f1670788d220b93810))

### Bugs fixed

- Fix Hanging Tests on Linux [#1924](https://github.com/jupyter/nbconvert/pull/1924) ([@blink1073](https://github.com/blink1073))

### Maintenance and upkeep improvements

- Adopt ruff and handle lint [#1925](https://github.com/jupyter/nbconvert/pull/1925) ([@blink1073](https://github.com/blink1073))

### Contributors to this release

([GitHub contributors page for this release](https://github.com/jupyter/nbconvert/graphs/contributors?from=2022-12-05&to=2022-12-19&type=c))

[@blink1073](https://github.com/search?q=repo%3Ajupyter%2Fnbconvert+involves%3Ablink1073+updated%3A2022-12-05..2022-12-19&type=Issues) | [@pre-commit-ci](https://github.com/search?q=repo%3Ajupyter%2Fnbconvert+involves%3Apre-commit-ci+updated%3A2022-12-05..2022-12-19&type=Issues)

## 7.2.6

([Full Changelog](https://github.com/jupyter/nbconvert/compare/v7.2.5...788dd3c4de1b6333e807250d0f33b59b80d5b202))
Expand All @@ -22,8 +78,6 @@

[@blink1073](https://github.com/search?q=repo%3Ajupyter%2Fnbconvert+involves%3Ablink1073+updated%3A2022-11-14..2022-12-05&type=Issues)

<!-- <END NEW CHANGELOG ENTRY> -->

## 7.2.5

([Full Changelog](https://github.com/jupyter/nbconvert/compare/v7.2.4...e5fefbb17b0bf3d6b5bbeb9a2ee62412d75ab0d8))
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

[![Build Status](https://travis-ci.org/jupyter/nbconvert.svg?branch=main)](https://travis-ci.org/jupyter/nbconvert)
[![Documentation Status](https://readthedocs.org/projects/nbconvert/badge/?version=latest)](https://nbconvert.readthedocs.io/en/latest/?badge=latest)
[![codecov.io](https://codecov.io/github/jupyter/nbconvert/coverage.svg?branch=main)](https://codecov.io/github/jupyter/nbconvert?branch=main)
[![codecov.io](https://codecov.io/gh/jupyter/nbconvert/coverage.svg?branch=main)](https://codecov.io/gh/gh/nbconvert?branch=main)

The **nbconvert** tool, `jupyter nbconvert`, converts notebooks to various other
formats via [Jinja] templates. The nbconvert tool allows you to convert an
Expand Down
2 changes: 1 addition & 1 deletion check_requirements.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Verify that the "all" reqs are in sync.
"""Verify that the "all" reqs are in sync."""
import sys

from tomli import load
Expand Down
14 changes: 11 additions & 3 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import os
import shutil
from datetime import datetime, timezone

HERE = os.path.dirname(__file__)

Expand Down Expand Up @@ -45,6 +46,13 @@
"IPython.sphinxext.ipython_console_highlighting",
]

try:
import enchant # type:ignore # noqa

extensions += ["sphinxcontrib.spelling"]
except ImportError:
pass

myst_enable_extensions = ["html_image"]

# Add any paths that contain templates here, relative to this directory.
Expand All @@ -63,10 +71,10 @@

# General information about the project.
project = "nbconvert"
from datetime import date

year = date.today().year
copyright = "2015-%s, Jupyter Development Team" % year

year = datetime.now(tz=timezone.utc).date().year
copyright = "2015-%s, Jupyter Development Team" % year # noqa
author = "Jupyter Development Team"

extlinks = {"ghpull": ("https://github.com/jupyter/nbconvert/pull/%s", "PR #%s")}
Expand Down
6 changes: 5 additions & 1 deletion hatch_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ def _get_css_file(template_name, url, filename):
if osp.exists(dest):
print("Already have CSS: %s, moving on." % dest)
else:
raise OSError("Need CSS to proceed.")
msg = "Need CSS to proceed."
raise OSError(msg)
return

with open(dest, "wb") as f:
Expand All @@ -75,7 +76,10 @@ def _get_css_files():


class CustomHook(BuildHookInterface):
"""A custom build hook for nbconvert."""

def initialize(self, version, build_data):
"""Initialize the hook."""
if self.target_name not in ["wheel", "sdist"]:
return
_get_css_files()
1 change: 1 addition & 0 deletions nbconvert/__main__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""nbconvert cli entry point."""
from .nbconvertapp import main

main()
5 changes: 3 additions & 2 deletions nbconvert/_version.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
"""nbconvert version info."""
import re
from typing import List

# Version string must appear intact for versioning
__version__ = "7.2.6"
__version__ = "7.2.9"

# Build up version_info tuple for backwards compatibility
pattern = r"(?P<major>\d+).(?P<minor>\d+).(?P<patch>\d+)(?P<rest>.*)"
match = re.match(pattern, __version__)
assert match is not None
assert match is not None # noqa
parts: List[object] = [int(match[part]) for part in ["major", "minor", "patch"]]
if match["rest"]:
parts.append(match["rest"])
Expand Down
3 changes: 2 additions & 1 deletion nbconvert/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""pytest configuration."""
import asyncio
import os

if os.name == "nt":
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) # type:ignore
27 changes: 15 additions & 12 deletions nbconvert/exporters/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@


class ExporterNameError(NameError):
"""An exporter name error."""

pass


class ExporterDisabledError(ValueError):
"""An exporter disabled error."""

pass


Expand Down Expand Up @@ -68,18 +72,18 @@ def export(exporter, nb, **kw):

# Check arguments
if exporter is None:
raise TypeError("Exporter is None")
msg = "Exporter is None"
raise TypeError(msg)
elif not isinstance(exporter, Exporter) and not issubclass(exporter, Exporter):
raise TypeError("exporter does not inherit from Exporter (base)")
msg = "exporter does not inherit from Exporter (base)"
raise TypeError(msg)
if nb is None:
raise TypeError("nb is None")
msg = "nb is None"
raise TypeError(msg)

# Create the exporter
resources = kw.pop("resources", None)
if isinstance(exporter, Exporter):
exporter_instance = exporter
else:
exporter_instance = exporter(**kw)
exporter_instance = exporter if isinstance(exporter, Exporter) else exporter(**kw)

# Try to convert the notebook using the appropriate conversion function.
if isinstance(nb, NotebookNode):
Expand Down Expand Up @@ -121,11 +125,10 @@ def get_exporter(name, config=get_config()): # noqa
log = get_logger()
log.error("Error importing %s" % name, exc_info=True)

raise ExporterNameError(
'Unknown exporter "{}", did you mean one of: {}?'.format(
name, ", ".join(get_export_names())
)
msg = 'Unknown exporter "{}", did you mean one of: {}?'.format(
name, ", ".join(get_export_names())
)
raise ExporterNameError(msg)


def get_export_names(config=get_config()): # noqa
Expand All @@ -148,5 +151,5 @@ def get_export_names(config=get_config()): # noqa
if e.enabled:
enabled_exporters.append(exporter_name)
except (ExporterDisabledError, ValueError):
pass
pass # noqa
return enabled_exporters
Loading

0 comments on commit a6ad846

Please sign in to comment.