nlohmann / json

JSON for Modern C++
https://json.nlohmann.me
MIT License
42.01k stars 6.63k forks source link

ISSUE-3924 Bumps `mkdocs` and associated tools #4024

Closed schuylermartin45 closed 1 year ago

schuylermartin45 commented 1 year ago

This attempts to fix #3942 by way of upgrading mkdocs and the associated dependencies. As I mentioned in the issue, it looks like the hamburger menu glitch has been fixed in mkdocs-material upstream.

NOTE I have been unable to test this change. I currently cannot get past an issue with plantuml when I attempt to run the docs with the suggested:

make install_venv serve -C docs/mkdocs

Here is the issue. I get this error on both MacOS and a Ubuntu machine no matter which branch I am on. I don't see any mention of anyone else encountering this in another GitHub issue:

Exception: Failed to run plantuml: [Errno 2] No such file or directory: 'plantuml'
make: *** [serve] Error 1

But in the spirit of FOSS Friday, I wanted to get a PR up anyways. I was at least able to determine a cascading set of version number dependencies and I don't want to lose that effort.

Cheers!


Pull request checklist

Read the Contribution Guidelines for detailed information.

Please don't

schuylermartin45 commented 1 year ago

Here is the full error log from serve: I'm guessing some binary from plantuml_markdown.py isn't being pulled correctly down? Maybe there's another missing dependency or some assumed file that needs to be installed globally? But this happens on develop and the latest tagged release.

cp -r ../examples/*.cpp ../examples/*.output docs/examples
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
venv/bin/mkdocs serve
INFO     -  Building documentation...
INFO     -  Cleaning site directory
ERROR    -  Error reading page 'api/basic_json/exception.md': Failed to run plantuml: [Errno 2] No such file
            or directory: 'plantuml'
Traceback (most recent call last):
  File "/Users/smartin/foss_friday/json/docs/mkdocs/venv/lib/python3.9/site-packages/plantuml_markdown.py", line 438, in _render_local_uml_image
    p = Popen(cmdline, stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=(os.name == 'nt'))
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1821, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'plantuml'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/smartin/foss_friday/json/docs/mkdocs/venv/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
  File "/Users/smartin/foss_friday/json/docs/mkdocs/venv/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Users/smartin/foss_friday/json/docs/mkdocs/venv/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Users/smartin/foss_friday/json/docs/mkdocs/venv/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/smartin/foss_friday/json/docs/mkdocs/venv/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/smartin/foss_friday/json/docs/mkdocs/venv/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Users/smartin/foss_friday/json/docs/mkdocs/venv/lib/python3.9/site-packages/mkdocs/__main__.py", line 234, in serve_command
    serve.serve(dev_addr=dev_addr, livereload=livereload, watch=watch, **kwargs)
  File "/Users/smartin/foss_friday/json/docs/mkdocs/venv/lib/python3.9/site-packages/mkdocs/commands/serve.py", line 83, in serve
    builder(config)
  File "/Users/smartin/foss_friday/json/docs/mkdocs/venv/lib/python3.9/site-packages/mkdocs/commands/serve.py", line 76, in builder
    build(config, live_server=live_server, dirty=dirty)
  File "/Users/smartin/foss_friday/json/docs/mkdocs/venv/lib/python3.9/site-packages/mkdocs/commands/build.py", line 308, in build
    _populate_page(file.page, config, files, dirty)
  File "/Users/smartin/foss_friday/json/docs/mkdocs/venv/lib/python3.9/site-packages/mkdocs/commands/build.py", line 181, in _populate_page
    page.render(config, files)
  File "/Users/smartin/foss_friday/json/docs/mkdocs/venv/lib/python3.9/site-packages/mkdocs/structure/pages.py", line 270, in render
    self.content = md.convert(self.markdown)
  File "/Users/smartin/foss_friday/json/docs/mkdocs/venv/lib/python3.9/site-packages/markdown/core.py", line 261, in convert
    self.lines = prep.run(self.lines)
  File "/Users/smartin/foss_friday/json/docs/mkdocs/venv/lib/python3.9/site-packages/plantuml_markdown.py", line 154, in run
    text1, idx1 = self._replace_block(text[idx:])
  File "/Users/smartin/foss_friday/json/docs/mkdocs/venv/lib/python3.9/site-packages/plantuml_markdown.py", line 217, in _replace_block
    diagram, err = self._render_diagram(code, requested_format)
  File "/Users/smartin/foss_friday/json/docs/mkdocs/venv/lib/python3.9/site-packages/plantuml_markdown.py", line 359, in _render_diagram
    diagram, err = self._render_local_uml_image(code, requested_format)
  File "/Users/smartin/foss_friday/json/docs/mkdocs/venv/lib/python3.9/site-packages/plantuml_markdown.py", line 441, in _render_local_uml_image
    raise Exception(f'Failed to run plantuml: {exc}')
Exception: Failed to run plantuml: [Errno 2] No such file or directory: 'plantuml'
make: *** [serve] Error 1
coveralls commented 1 year ago

Coverage Status

Coverage: 100.0%. Remained the same when pulling 64a8c59e7db7efdd5f73e9e11fef88ef5141bad2 on schuylermartin45:issue3942 into 6af826d0bdb55e4b69e3ad817576745335f243ca on nlohmann:develop.

schuylermartin45 commented 1 year ago

It looks like I needed to brew install plantuml/sudo apt-get install -y plantuml to get past that error message.

Unfortunately, pulling the latest version of mkdocs-material does not appear to fix the issue with the hamburger menu, as was suggested by the closed issue tagged above. I will close this PR for now.