fralau / mkdocs-macros-plugin

Create richer and more beautiful pages in MkDocs, by using variables and calls to macros in the markdown code.
https://mkdocs-macros-plugin.readthedocs.io
Other
321 stars 50 forks source link

Invalid syntax in latest release 0.6.2 #106

Closed bheisig closed 2 years ago

bheisig commented 2 years ago

Hi,

First of all, I'd like to say thank you for your great work!

After updating to v0.6.2 my docs can't be built anymore:

$ mkdocs serve

INFO     -  Building documentation...
Traceback (most recent call last):
  File "/usr/local/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
  File "/usr/lib/python3/dist-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/mkdocs/__main__.py", line 177, in serve_command
    serve.serve(dev_addr=dev_addr, livereload=livereload, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/mkdocs/commands/serve.py", line 54, in serve
    config = builder()
  File "/usr/local/lib/python3.9/dist-packages/mkdocs/commands/serve.py", line 35, in builder
    config = load_config(
  File "/usr/local/lib/python3.9/dist-packages/mkdocs/config/base.py", line 224, in load_config
    errors, warnings = cfg.validate()
  File "/usr/local/lib/python3.9/dist-packages/mkdocs/config/base.py", line 108, in validate
    run_failed, run_warnings = self._validate()
  File "/usr/local/lib/python3.9/dist-packages/mkdocs/config/base.py", line 63, in _validate
    self[key] = config_option.validate(value)
  File "/usr/local/lib/python3.9/dist-packages/mkdocs/config/config_options.py", line 130, in validate
    return self.run_validation(value)
  File "/usr/local/lib/python3.9/dist-packages/mkdocs/config/config_options.py", line 636, in run_validation
    plgins[item] = self.load_plugin(item, cfg)
  File "/usr/local/lib/python3.9/dist-packages/mkdocs/config/config_options.py", line 649, in load_plugin
    Plugin = self.installed_plugins[name].load()
  File "/usr/local/lib/python3.9/dist-packages/importlib_metadata/__init__.py", line 167, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 851, in exec_module
  File "<frozen importlib._bootstrap_external>", line 988, in get_code
  File "<frozen importlib._bootstrap_external>", line 918, in source_to_code
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/usr/local/lib/python3.9/dist-packages/mkdocs_macros/plugin.py", line 228
    <<<<<<< HEAD
    ^
SyntaxError: invalid syntax

When downgrading to v0.6.0 it works fine.

My host:

$ mkdocs --version
mkdocs, version 1.2.3 from /usr/local/lib/python3.9/dist-packages/mkdocs (Python 3.9)
$ python --version
Python 3.9.5
$ pip list | grep mkdocs
mkdocs                                    1.2.3
mkdocs-git-revision-date-localized-plugin 0.10.3
mkdocs-macros-plugin                      0.6.0
mkdocs-material                           7.3.6
mkdocs-material-extensions                1.0.3
mkdocs-minify-plugin                      0.5.0
mkdocs-rss-plugin                         0.17.0

Hope it helps. Thanks in advance, Ben

github-actions[bot] commented 2 years ago

Welcome to this project and thank you!' first issue

lkiesow commented 2 years ago

I can confirm this bug. Looks like a broken merge.

fralau commented 2 years ago

This is correct! I'm on it.

fralau commented 2 years ago

Fixed with 708bbe7. Version 0.6.2 on pypi was yanked, and 0.6.3 uploaded.

Let me know if it worked?

TimWolla commented 2 years ago

Let me know if it worked?

LGTM now.

mriedem commented 2 years ago

Just a question but would it be possible to get something simple like a flake8 action/workflow/job to run on changes to this repo to hopefully prevent something like this from happening in the future?

ziegenberg commented 2 years ago

@fralau, you may wanna change that link in your comment. The current link https://pypi.org/manage/project/mkdocs-macros-plugin/release/0.6.3/ returns a 403 access denied. Maybe chose: https://pypi.org/project/mkdocs-macros-plugin/0.6.3/

fralau commented 2 years ago

@ziegenberg

@fralau, you may wanna change that link in your comment. Oh boy. We'll finally get it right :-)

@mriedem

Just a question but would it be possible to get something simple like a flake8 action/workflow/job to run on changes to this repo to hopefully prevent something like this from happening in the future?

I'm not familiar yet with this tool, but yes, that seems to be a good idea to pursue... Any indications on where to start would be welcome.

bheisig commented 2 years ago

First test was successful :slightly_smiling_face: :+1:

TimWolla commented 2 years ago

I'm not familiar yet with this tool, but yes, that seems to be a good idea to pursue... Any indications on where to start would be welcome.

@fralau Have a look at the workflow we're (@WoltLab) are using to test that our mkdocs documentation builds successfully:

https://github.com/WoltLab/docs.woltlab.com/blob/5.5/.github/workflows/test.yml

Just commit that file to the repository (make the necessary adjustments, e.g. for setup.py) and it will automatically be active. It detected the bad merge: https://github.com/WoltLab/docs.woltlab.com/runs/4300011035?check_suite_focus=true

Full documentation is here: https://docs.github.com/en/actions

bheisig commented 2 years ago

Alright, second test on another host was successful, too. Thank you very much, @fralau! This was lightning fast =)