From b3e122b36d586632738ddedaed7d3df8d5dead44 Mon Sep 17 00:00:00 2001 From: Oleh Prypin Date: Fri, 30 Apr 2021 23:14:55 +0200 Subject: [PATCH 1/3] chore: MkDocs default schema needs to be obtained differently now PR #273: https://github.com/mkdocstrings/mkdocstrings/pull/273 --- tests/test_extension.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/test_extension.py b/tests/test_extension.py index e2e92903..baf77fbf 100644 --- a/tests/test_extension.py +++ b/tests/test_extension.py @@ -7,11 +7,19 @@ from markdown import Markdown from mkdocs import config +try: + from mkdocs.config.defaults import get_schema +except ImportError: + + def get_schema(): + """Fallback for old versions of MkDocs.""" + return config.DEFAULT_SCHEMA + @pytest.fixture(name="ext_markdown") def fixture_ext_markdown(request, tmp_path): """Yield a Markdown instance with MkdocstringsExtension, with config adjustments.""" - conf = config.Config(schema=config.DEFAULT_SCHEMA) + conf = config.Config(schema=get_schema()) conf_dict = { "site_name": "foo", From 36e80248d2ab9e61975f6c83ae517115c9410fc1 Mon Sep 17 00:00:00 2001 From: Oleh Prypin Date: Wed, 9 Jun 2021 21:58:05 +0200 Subject: [PATCH 2/3] refactor: Compatibility with MkDocs 1.2: livereload isn't guaranteed now MkDocs doesn't depend on 'livereload' library, and neither should we, but we import it for the type annotation, which is now also wrong. Also fix tests: `site_url` value is now required for MkDocs. PR #294: https://github.com/mkdocstrings/mkdocstrings/pull/294 --- pyproject.toml | 2 +- src/mkdocstrings/plugin.py | 11 +---------- tests/test_extension.py | 1 + 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index faa18416..cbe1a4b3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,7 +19,7 @@ python = "^3.6" Jinja2 = ">=2.11.1, <4.0" Markdown = "^3.3" MarkupSafe = ">=1.1, <3.0" -mkdocs = "^1.1" +mkdocs = "^1.1.1" mkdocs-autorefs = ">=0.1, <0.3" pymdown-extensions = ">=6.3, <9.0" pytkdocs = ">=0.2.0, <0.12.0" diff --git a/src/mkdocstrings/plugin.py b/src/mkdocstrings/plugin.py index 054cd2e0..f7c7b611 100644 --- a/src/mkdocstrings/plugin.py +++ b/src/mkdocstrings/plugin.py @@ -15,7 +15,6 @@ import os from typing import Callable, Optional, Tuple -from livereload import Server from mkdocs.config import Config from mkdocs.config.config_options import Type as MkType from mkdocs.plugins import BasePlugin @@ -105,7 +104,7 @@ def handlers(self) -> Handlers: raise RuntimeError("The plugin hasn't been initialized with a config yet") return self._handlers - def on_serve(self, server: Server, builder: Callable = None, **kwargs) -> Server: # noqa: W0613 (unused arguments) + def on_serve(self, server, builder: Callable, **kwargs): # noqa: W0613 (unused arguments) """Watch directories. Hook for the [`on_serve` event](https://www.mkdocs.org/user-guide/plugins/#on_serve). @@ -117,18 +116,10 @@ def on_serve(self, server: Server, builder: Callable = None, **kwargs) -> Server server: The `livereload` server instance. builder: The function to build the site. kwargs: Additional arguments passed by MkDocs. - - Returns: - The server instance. """ - if builder is None: - # The builder parameter was added in mkdocs v1.1.1. - # See issue https://github.com/mkdocs/mkdocs/issues/1952. - builder = list(server.watcher._tasks.values())[0]["func"] # noqa: W0212 (protected member) for element in self.config["watch"]: log.debug(f"Adding directory '{element}' to watcher") server.watch(element, builder) - return server def on_config(self, config: Config, **kwargs) -> Config: # noqa: W0613 (unused arguments) """Instantiate our Markdown extension. diff --git a/tests/test_extension.py b/tests/test_extension.py index baf77fbf..c6eef821 100644 --- a/tests/test_extension.py +++ b/tests/test_extension.py @@ -23,6 +23,7 @@ def fixture_ext_markdown(request, tmp_path): conf_dict = { "site_name": "foo", + "site_url": "https://example.org/", "site_dir": str(tmp_path), "plugins": [{"mkdocstrings": {"default_handler": "python"}}], **getattr(request, "param", {}), From 2b0f809039139dc112ed0f6bd85eb152a2c5a7c2 Mon Sep 17 00:00:00 2001 From: Oleh Prypin Date: Wed, 9 Jun 2021 23:06:06 +0200 Subject: [PATCH 3/3] chore: Prepare release 0.15.2 --- CHANGELOG.md | 9 +++++++++ pyproject.toml | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 635b5080..a8309413 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,15 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [0.15.2](https://github.com/mkdocstrings/mkdocstrings/releases/tag/0.15.2) - 2021-06-09 + +[Compare with 0.15.1](https://github.com/mkdocstrings/mkdocstrings/compare/0.15.1...0.15.2) + +### Packaging +- MkDocs default schema needs to be obtained differently now ([b3e122b](https://github.com/mkdocstrings/mkdocstrings/commit/b3e122b36d586632738ddedaed7d3df8d5dead44) by Oleh Prypin). [PR #273](https://github.com/mkdocstrings/mkdocstrings/pull/273) +- Compatibility with MkDocs 1.2: livereload isn't guaranteed now ([36e8024](https://github.com/mkdocstrings/mkdocstrings/commit/36e80248d2ab9e61975f6c83ae517115c9410fc1) by Oleh Prypin). [PR #294](https://github.com/mkdocstrings/mkdocstrings/pull/294) + + ## [0.15.1](https://github.com/mkdocstrings/mkdocstrings/releases/tag/0.15.1) - 2021-05-16 [Compare with 0.15.0](https://github.com/mkdocstrings/mkdocstrings/compare/0.15.0...0.15.1) diff --git a/pyproject.toml b/pyproject.toml index cbe1a4b3..9150a2a1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "mkdocstrings" -version = "0.15.1" +version = "0.15.2" description = "Automatic documentation from sources, for MkDocs." authors = ["Timothée Mazzucotelli "] license = "ISC License"