Skip to content

Commit

Permalink
Compatibility with MkDocs 1.2: livereload isn't guaranteed now
Browse files Browse the repository at this point in the history
MkDocs doesn't depend on 'livereload' library, and neither should we, but we import it for the type annotation, which is now also wrong
  • Loading branch information
oprypin committed Jun 7, 2021
1 parent 5802b1e commit e379d07
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 1 addition & 6 deletions src/mkdocstrings/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import urllib.request
from typing import Any, BinaryIO, Callable, Iterable, List, Mapping, 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
Expand Down Expand Up @@ -111,7 +110,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).
Expand All @@ -127,10 +126,6 @@ def on_serve(self, server: Server, builder: Callable = None, **kwargs) -> Server
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)
Expand Down

0 comments on commit e379d07

Please sign in to comment.