Skip to content

Commit

Permalink
MAINT: appease pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
agoose77 committed Dec 5, 2023
1 parent 63601f7 commit b9507a2
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 55 deletions.
18 changes: 9 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,31 @@ exclude: >
repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.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/pycqa/isort
rev: 5.8.0
rev: 5.12.0
hooks:
- id: isort

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

- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.4
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear~=21.3.1
- flake8-comprehensions~=3.4.0
- pep8-naming~=0.11.1
- flake8-bugbear~=23.12.2
- flake8-comprehensions~=3.14.0
- pep8-naming~=0.13.3

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.941
Expand All @@ -46,7 +46,7 @@ repos:
exclude: tests/roots/.*py

- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.3.0
rev: v2.11.0
hooks:
- id: pretty-format-toml
args: [--autofix]
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build:
os: ubuntu-22.04
tools:
python: "3.10"

python:
install:
- method: pip
Expand Down
74 changes: 37 additions & 37 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
[build-system]
requires = ["flit_core >=3.2,<4"]
build-backend = "flit_core.buildapi"
requires = ["flit_core >=3.2,<4"]

[project]
name = "sphinx-jupyterbook-latex"
description = "Latex specific features for jupyter book"
readme = "README.md"
license = { file = "LICENSE" }
requires-python = ">=3.6"
authors = [
{ name = "Executable Book Project", email = "jupyter@googlegroups.com" },
{name = "Executable Book Project", email = "jupyter@googlegroups.com"}
]
classifiers = [
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: Implementation :: CPython",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: Implementation :: CPython"
]
dependencies = [
"importlib-resources;python_version<'3.9'",
"sphinx>=3,<5",
"importlib-resources;python_version<'3.9'",
"sphinx>=3,<5"
]
description = "Latex specific features for jupyter book"
dynamic = [
"version",
"version"
]
license = {file = "LICENSE"}
name = "sphinx-jupyterbook-latex"
readme = "README.md"
requires-python = ">=3.6"

[project.optional-dependencies]
code_style = [
"pre-commit~=2.12",
"pre-commit~=2.12"
]
myst = [
"myst-nb>=0.13,<0.14",
"myst-nb>=0.13,<0.14"
]
rtd = [
"myst-parser",
"sphinx-book-theme",
"sphinx-design",
"sphinx-jupyterbook-latex",
"myst-parser",
"sphinx-book-theme",
"sphinx-design",
"sphinx-jupyterbook-latex"
]
testing = [
"coverage<5.0",
"myst-nb>=0.13,<0.14",
"pytest-cov~=2.8",
"pytest-regressions",
"pytest>=3.6,<4",
"sphinx-external-toc>=0.1.0,<0.3.0",
"sphinxcontrib-bibtex>=2.2.1,<2.3.0",
"texsoup",
"coverage<5.0",
"myst-nb>=0.13,<0.14",
"pytest-cov~=2.8",
"pytest-regressions",
"pytest>=3.6,<4",
"sphinx-external-toc>=0.1.0,<0.3.0",
"sphinxcontrib-bibtex>=2.2.1,<2.3.0",
"texsoup"
]

[project.urls]
Expand All @@ -62,13 +62,13 @@ name = "sphinx_jupyterbook_latex"
[tool.isort]
profile = "black"
src_paths = [
"sphinx_jupyterbook_latex",
"tests",
"sphinx_jupyterbook_latex",
"tests"
]

[tool.mypy]
show_error_codes = true
warn_unused_ignores = true
warn_redundant_casts = true
no_implicit_optional = true
show_error_codes = true
strict_equality = true
warn_redundant_casts = true
warn_unused_ignores = true
1 change: 0 additions & 1 deletion sphinx_jupyterbook_latex/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ def add_node(cls, app: Sphinx) -> None:


def visit_RootHeader(self, node: RootHeader) -> None:

node["header_text"] = sphinx_encode(node.astext())

strong = nodes.strong("")
Expand Down
10 changes: 4 additions & 6 deletions sphinx_jupyterbook_latex/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ def check_dependency() -> Union[bool, dict]:
except ImportError:
return False
major, minor = __version__.split(".")[0:2]
if int(major) == 0 and 13 <= int(minor) < 18: # TODO: fetch this from pyproject.toml?
if (
int(major) == 0 and 13 <= int(minor) < 18
): # TODO: fetch this from pyproject.toml?
package_versions = {"myst_nb": minor}
return package_versions
else:
Expand Down Expand Up @@ -100,7 +102,6 @@ class LatexRootDocTransforms(SphinxTransform):
default_priority = 500

def apply(self, **kwargs: Any) -> None:

# TODO this assumes that `latex_documents` is set with the master_doc as the startdocname
if self.env.docname != self.app.config.master_doc:
return
Expand Down Expand Up @@ -144,7 +145,6 @@ def check_mystnb_dependency(cls) -> Union[bool, int]:
return False

def apply(self, **kwargs: Any) -> None:

mystnb_version = self.check_mystnb_dependency()

# checking mystnb_version for proper imports
Expand Down Expand Up @@ -234,7 +234,6 @@ class LatexRootDocPostTransforms(SphinxPostTransform):
default_priority = 700

def apply(self, **kwargs: Any) -> None:

# TODO this assumes that `latex_documents` is set with the master_doc as the startdocname
if not is_root_document(self.document, self.app):
return
Expand Down Expand Up @@ -297,7 +296,6 @@ def apply(self, **kwargs: Any) -> None:
# ...

if self.env.jblatex_captions_to_parts:

for node in self.document.traverse(docutils.nodes.compound):
if (
"toctree-wrapper" not in node["classes"]
Expand Down Expand Up @@ -389,10 +387,10 @@ def _create_item_node(self, item: Tuple) -> nodes.list_item:
reference = nodes.reference(
"",
"",
nodes.Text(title),
internal=internal,
refuri=val,
anchorname="",
*[nodes.Text(title)],
)
para = addnodes.compact_paragraph("", "", reference)
item = nodes.list_item("", para)
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def _func(src_path: Path, buildername="latex", **kwargs) -> SphinxBuild:
app = make_app(
buildername=buildername,
srcdir=sphinx_path(os.path.abspath(str(src_path))),
**kwargs
**kwargs,
)
return SphinxBuild(app, src_path)

Expand Down

0 comments on commit b9507a2

Please sign in to comment.