diff --git a/mkdocs_exporter/formats/pdf/plugin.py b/mkdocs_exporter/formats/pdf/plugin.py index 244f59c..c8b45e4 100644 --- a/mkdocs_exporter/formats/pdf/plugin.py +++ b/mkdocs_exporter/formats/pdf/plugin.py @@ -1,7 +1,6 @@ import os import types import asyncio -import nest_asyncio from typing import Optional, Coroutine, Sequence @@ -92,7 +91,6 @@ def on_pre_build(self, **kwargs) -> None: self.loop = asyncio.new_event_loop() - nest_asyncio.apply(self.loop) asyncio.set_event_loop(self.loop) self.renderer = Renderer(options=self.config) @@ -170,7 +168,6 @@ async def limit(coroutine: Coroutine) -> Coroutine: self.loop = None self.renderer = None - nest_asyncio.apply(self.loop) asyncio.set_event_loop(self.loop) if self.config.get('aggregator', {})['enabled']: diff --git a/mkdocs_exporter/formats/pdf/renderer.py b/mkdocs_exporter/formats/pdf/renderer.py index 54eee33..3787ea3 100644 --- a/mkdocs_exporter/formats/pdf/renderer.py +++ b/mkdocs_exporter/formats/pdf/renderer.py @@ -1,7 +1,7 @@ from __future__ import annotations import os -import importlib_resources +import importlib.resources from urllib.parse import unquote @@ -67,8 +67,8 @@ def preprocess(self, page: Page) -> str: with open(script, 'r', encoding='utf-8') as file: preprocessor.script(file.read(), path=stylesheet) - preprocessor.script(importlib_resources.files(js).joinpath('pdf.js').read_text(encoding='utf-8')) - preprocessor.script(importlib_resources.files(js).joinpath('pagedjs.min.js').read_text(encoding='utf-8')) + preprocessor.script(importlib.resources.files(js).joinpath('pdf.js').read_text(encoding='utf-8')) + preprocessor.script(importlib.resources.files(js).joinpath('pagedjs.min.js').read_text(encoding='utf-8')) preprocessor.teleport() preprocessor.update_links(base, root) diff --git a/mkdocs_exporter/themes/readthedocs/theme.py b/mkdocs_exporter/themes/readthedocs/theme.py index 260b0af..6e4065b 100644 --- a/mkdocs_exporter/themes/readthedocs/theme.py +++ b/mkdocs_exporter/themes/readthedocs/theme.py @@ -1,7 +1,7 @@ from __future__ import annotations -import importlib_resources +import importlib from mkdocs.structure.files import File @@ -21,7 +21,7 @@ def preprocess(self, preprocessor: Preprocessor) -> None: """Preprocesses the DOM before rendering a document.""" preprocessor.remove(['.rst-content > div[role="navigation"]', 'nav.wy-nav-side']) - preprocessor.stylesheet(importlib_resources.files(css).joinpath('readthedocs.css').read_text(encoding='utf-8')) + preprocessor.stylesheet(importlib.resources.files(css).joinpath('readthedocs.css').read_text(encoding='utf-8')) def button(self, preprocessor: Preprocessor, title: str, icon: str, attributes: dict = {}): diff --git a/poetry.lock b/poetry.lock index 8f18839..15188d1 100644 --- a/poetry.lock +++ b/poetry.lock @@ -11,9 +11,6 @@ files = [ {file = "babel-2.15.0.tar.gz", hash = "sha256:8daf0e265d05768bc6c7a314cf1321e9a123afc328cc635c18622a2f30a04413"}, ] -[package.dependencies] -pytz = {version = ">=2015.7", markers = "python_version < \"3.9\""} - [package.extras] dev = ["freezegun (>=1.0,<2.0)", "pytest (>=6.0)", "pytest-cov"] @@ -331,19 +328,19 @@ files = [ [[package]] name = "flake8" -version = "5.0.4" +version = "7.0.0" description = "the modular source code checker: pep8 pyflakes and co" optional = false -python-versions = ">=3.6.1" +python-versions = ">=3.8.1" files = [ - {file = "flake8-5.0.4-py2.py3-none-any.whl", hash = "sha256:7a1cf6b73744f5806ab95e526f6f0d8c01c66d7bbe349562d22dfca20610b248"}, - {file = "flake8-5.0.4.tar.gz", hash = "sha256:6fbe320aad8d6b95cec8b8e47bc933004678dc63095be98528b7bdd2a9f510db"}, + {file = "flake8-7.0.0-py2.py3-none-any.whl", hash = "sha256:a6dfbb75e03252917f2473ea9653f7cd799c3064e54d4c8140044c5c065f53c3"}, + {file = "flake8-7.0.0.tar.gz", hash = "sha256:33f96621059e65eec474169085dc92bf26e7b2d47366b70be2f67ab80dc25132"}, ] [package.dependencies] mccabe = ">=0.7.0,<0.8.0" -pycodestyle = ">=2.9.0,<2.10.0" -pyflakes = ">=2.5.0,<2.6.0" +pycodestyle = ">=2.11.0,<2.12.0" +pyflakes = ">=3.2.0,<3.3.0" [[package]] name = "ghp-import" @@ -505,24 +502,6 @@ docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.link perf = ["ipython"] testing = ["flufl.flake8", "importlib-resources (>=1.3)", "jaraco.test (>=5.4)", "packaging", "pyfakefs", "pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy", "pytest-perf (>=0.9.2)", "pytest-ruff (>=0.2.1)"] -[[package]] -name = "importlib-resources" -version = "6.4.0" -description = "Read resources from Python packages" -optional = false -python-versions = ">=3.8" -files = [ - {file = "importlib_resources-6.4.0-py3-none-any.whl", hash = "sha256:50d10f043df931902d4194ea07ec57960f66a80449ff867bfe782b4c486ba78c"}, - {file = "importlib_resources-6.4.0.tar.gz", hash = "sha256:cdb2b453b8046ca4e3798eb1d84f3cce1446a0e8e7b5ef4efb600f19fc398145"}, -] - -[package.dependencies] -zipp = {version = ">=3.1.0", markers = "python_version < \"3.10\""} - -[package.extras] -docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (<7.2.5)", "sphinx (>=3.5)", "sphinx-lint"] -testing = ["jaraco.test (>=5.4)", "pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy", "pytest-ruff (>=0.2.1)", "zipp (>=3.17)"] - [[package]] name = "jinja2" version = "3.1.4" @@ -1054,17 +1033,6 @@ files = [ fast = ["fastnumbers (>=2.0.0)"] icu = ["PyICU (>=1.0.0)"] -[[package]] -name = "nest-asyncio" -version = "1.6.0" -description = "Patch asyncio to allow nested event loops" -optional = false -python-versions = ">=3.5" -files = [ - {file = "nest_asyncio-1.6.0-py3-none-any.whl", hash = "sha256:87af6efd6b5e897c81050477ef65c62e2b2f35d51703cae01aff2905b1852e1c"}, - {file = "nest_asyncio-1.6.0.tar.gz", hash = "sha256:6f172d5449aca15afd6c646851f4e31e02c598d553a667e38cafa997cfec55fe"}, -] - [[package]] name = "packaging" version = "24.0" @@ -1221,13 +1189,13 @@ pyee = "11.1.0" [[package]] name = "pycodestyle" -version = "2.9.1" +version = "2.11.1" description = "Python style guide checker" optional = false -python-versions = ">=3.6" +python-versions = ">=3.8" files = [ - {file = "pycodestyle-2.9.1-py2.py3-none-any.whl", hash = "sha256:d1735fc58b418fd7c5f658d28d943854f8a849b01a5d0a1e6f3f3fdd0166804b"}, - {file = "pycodestyle-2.9.1.tar.gz", hash = "sha256:2c9607871d58c76354b697b42f5d57e1ada7d261c261efac224b664affdc5785"}, + {file = "pycodestyle-2.11.1-py2.py3-none-any.whl", hash = "sha256:44fe31000b2d866f2e41841b18528a505fbd7fef9017b04eff4e2648a0fadc67"}, + {file = "pycodestyle-2.11.1.tar.gz", hash = "sha256:41ba0e7afc9752dfb53ced5489e89f8186be00e599e712660695b7a75ff2663f"}, ] [[package]] @@ -1260,13 +1228,13 @@ dev = ["black", "build", "flake8", "flake8-black", "isort", "jupyter-console", " [[package]] name = "pyflakes" -version = "2.5.0" +version = "3.2.0" description = "passive checker of Python programs" optional = false -python-versions = ">=3.6" +python-versions = ">=3.8" files = [ - {file = "pyflakes-2.5.0-py2.py3-none-any.whl", hash = "sha256:4579f67d887f804e67edb544428f264b7b24f435b263c4614f384135cea553d2"}, - {file = "pyflakes-2.5.0.tar.gz", hash = "sha256:491feb020dca48ccc562a8c0cbe8df07ee13078df59813b83959cbdada312ea3"}, + {file = "pyflakes-3.2.0-py2.py3-none-any.whl", hash = "sha256:84b5be138a2dfbb40689ca07e2152deb896a65c3a3e24c251c5c62489568074a"}, + {file = "pyflakes-3.2.0.tar.gz", hash = "sha256:1c61603ff154621fb2a9172037d84dca3500def8c8b630657d1701f026f8af3f"}, ] [[package]] @@ -1708,5 +1676,5 @@ test = ["big-O", "jaraco.functools", "jaraco.itertools", "jaraco.test", "more-it [metadata] lock-version = "2.0" -python-versions = ">=3.8" -content-hash = "56e8ac6050f4b705478ae1dcbdb467ee1b6b4fc520182946bd5549b536dc878e" +python-versions = ">=3.9" +content-hash = "2966e518a9ebb8bc85fe6a58a2cf9fac543f562dcf022c88abd7f98bec62f05b" diff --git a/pyproject.toml b/pyproject.toml index d75992f..5964d48 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,16 +20,12 @@ classifiers = [ ] [tool.poetry.dependencies] -python = ">=3.8" +python = ">=3.9" mkdocs = ">=1.4" playwright = ">=1.33" beautifulsoup4 = ">=4.12.2" lxml = ">=4.9" libsass = ">=0.22.0" -importlib-resources = ">=5.0" -importlib-metadata = ">=6.0" -nest-asyncio = ">=1.5.6" -mkdocs-material = {extras = ["imaging"], version = "^9.4.14"} pypdf = ">=4.2.0" [tool.poetry.plugins."mkdocs.plugins"] @@ -39,8 +35,8 @@ pypdf = ">=4.2.0" "Bug Tracker" = "https://github.com/adrienbrignon/mkdocs-exporter/issues" [tool.poetry.group.dev.dependencies] -flake8 = ">=5.0" -mkdocs-material = "^9.1.11" +flake8 = ">=7.0" +mkdocs-material = {version="^9.4.11", extras=["imaging"]} mkdocs-git-revision-date-localized-plugin = "^1.2.0" mkdocs-git-authors-plugin = "^0.7.0" mkdocs-awesome-pages-plugin = "^2.9.1"