backstage / mkdocs-monorepo-plugin

✚ Build multiple documentation folders in a single Mkdocs. Designed for large codebases.
https://backstage.github.io/mkdocs-monorepo-plugin/
Apache License 2.0
314 stars 75 forks source link

mkdocs serve not working on mkdocs 1.2 #49

Closed champsblanc closed 3 years ago

champsblanc commented 3 years ago

I updated my current virtual env to use mkdocs 1.2 (i'm testing the new analytics feature since i can't generate a UA-XXXXXX to use with older versions) and i get an error at the end of the building while serving (mkdocs build works fine):

File ".venv/lib/python3.6/site-packages/mkdocs_monorepo_plugin/plugin.py", line 67, in on_serve
    buildfunc = list(server.watcher._tasks.values())[0]['func']
AttributeError: 'LiveReloadServer' object has no attribute 'watcher'

Redirected from https://github.com/mkdocs/mkdocs/issues/2446#issuecomment-856059523

oprypin commented 3 years ago

FYI:

PaulienVa commented 3 years ago

Has anyone had a look at this issue? I am encountering the same issue using the following dependencies:

champsblanc commented 3 years ago

Any updates on this?

nghiaho12 commented 3 years ago

I also have this error. Here's my workaround (no guarantees on correctness!). Edit plugin.py, modify on_serve

def on_serve(self, server, config, **kwargs):
    #buildfunc = list(server.watcher._tasks.values())[0]['func']

    # still watch the original docs/ directory
    server.watch(self.originalDocsDir) #, buildfunc)

    # watch all the sub docs/ folders
    for _, docs_dir, yaml_file in self.resolvedPaths:
        server.watch(yaml_file) #, buildfunc)
        server.watch(docs_dir) #, buildfunc)

It appears to work for my limited test case. This is mentioned in site-packages/mkdocs/livereload/init.py

def watch(self, path, func=None, recursive=True):
    """Add the 'path' to watched paths, call the function and reload when any file changes under it."""
    path = os.path.abspath(path)
    if func in (None, self.builder):
        func = self.builder
    else:
        warnings.warn(
            "Plugins should not pass the 'func' parameter of watch(). "
            "The ability to execute custom callbacks will be removed soon.",
            DeprecationWarning,
            stacklevel=2,
        )
iamEAP commented 3 years ago

Thanks for the patience y'all! You should be good once you bump to 0.4.16 of this plugin.

marc0olo commented 3 years ago

Thanks for the patience y'all! You should be good once you bump to 0.4.16 of this plugin.

the time couldn't be better! thanks =)

estahn commented 3 years ago

Indeed, I was just debugging this yesterday :)

On Wed, 4 Aug 2021 at 8:32 am, Marco Walz @.***> wrote:

Thanks for the patience y'all! You should be good once you bump to 0.4.16 of this plugin.

the time couldn't be better! thanks =)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/backstage/mkdocs-monorepo-plugin/issues/49#issuecomment-892209250, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACYNPSLS2XHMMBEMWZ7GF3T3BU6ZANCNFSM46H7NWJA .