Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression from 8.2.16 to 8.3.0: 'dict object' has no attribute 'hide' #3983

Closed
5 tasks done
ftrader opened this issue Jun 3, 2022 · 5 comments
Closed
5 tasks done
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open

Comments

@ftrader
Copy link

ftrader commented Jun 3, 2022

Contribution guidelines

I've found a bug and checked that ...

  • ... the problem doesn't occur with the mkdocs or readthedocs themes
  • ... the problem persists when all overrides are removed, i.e. custom_dir, extra_javascript and extra_css
  • ... the documentation does not mention anything about my problem
  • ... there are no open or closed issues that are related to my problem

Description

A CI job in our project which uses mkdocs stopped.

After some investigation we found the principal problem to be related to the upgrade of the mkdocs-material external dependency (it is installed via pip3 during the job setup).

Pinning to 8.2.16 fixes the issue.


NOTE: I was unable to test the first two checks

... the problem doesn't occur with the mkdocs or readthedocs themes
... the problem persists when all overrides are removed, i.e. custom_dir, extra_javascript and extra_css

Do feel free to close this issue directly due to unmet "checks".

If it helps someone else experiencing this issue to learn that they can fix this by sticking to 8.2.16 for now, I count it as a win.

Expected behaviour

No regression of this feature.

Actual behaviour

Extract of the failure with Python traceback:

ERROR    -  Error building page 'README.md': 'dict object' has no attribute 'hide'
Traceback (most recent call last):
  File "/usr/local/bin/mkdocs", line 10, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/mkdocs/__main__.py", line 192, in build_command
    build.build(config.load_config(**kwargs), dirty=not clean)
  File "/usr/local/lib/python3.7/dist-packages/mkdocs/commands/build.py", line 314, in build
    _build_page(file.page, config, doc_files, nav, env, dirty)
  File "/usr/local/lib/python3.7/dist-packages/mkdocs/commands/build.py", line 217, in _build_page
    output = template.render(context)
  File "/usr/local/lib/python3.7/dist-packages/jinja2/environment.py", line 1289, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.7/dist-packages/jinja2/environment.py", line 924, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "/usr/local/lib/python3.7/dist-packages/material/main.html", line 4, in top-level template code
    {% extends "base.html" %}
  File "/usr/local/lib/python3.7/dist-packages/material/base.html", line 178, in top-level template code
    {% block footer %}
  File "/usr/local/lib/python3.7/dist-packages/material/base.html", line 179, in block 'footer'
    {% include "partials/footer.html" %}
  File "/usr/local/lib/python3.7/dist-packages/material/partials/footer.html", line 6, in top-level template code
    {% set hidden = "hidden" if "footer" in page.meta.hide %}
jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'hide'

Steps to reproduce

The issue was reproducible by restarting our CI job - it failed reliably with the same Python traceback.

Package versions

  • Python: 3.7.3 (presumed since Debian buster based docker image used on our CI)
  • MkDocs: 1.3.0
  • Material: 8.3.0

Configuration

Unable to pare it down to a minimal one. Feel free to close on that account.

https://gitlab.com/bitcoin-cash-node/bitcoin-cash-node/-/blob/master/doc/mkdocs.yml.in

System information

  • Operating system: Debian Buster
  • Browser: n/a (problem prevents doc build)
@ftrader
Copy link
Author

ftrader commented Jun 3, 2022

Linking to the Issue on the GitLab repo where this regression was detected in CI:

https://gitlab.com/bitcoin-cash-node/bitcoin-cash-node/-/issues/430

@squidfunk squidfunk added the bug Issue reports a bug label Jun 4, 2022
@squidfunk
Copy link
Owner

squidfunk commented Jun 4, 2022

Thanks for reporting – my bad! Fixed in e3bea56. We missed a safeguard to check whether page.meta is defined, which is not true for static templates. Since you did not provide a minimal reproducible example, I can't say for sure when this was triggered, but it should be fixed by the change in the referenced commit.

On a side note, I did a slight refactoring and removed unnecessary safe guards in 95f8047.

@squidfunk squidfunk added the resolved Issue is resolved, yet unreleased if open label Jun 4, 2022
@squidfunk
Copy link
Owner

Released as part of 8.3.1.

@ftrader
Copy link
Author

ftrader commented Jun 4, 2022

Thanks a lot for the quick fix. I'll test it on our CI pipeline and let you know if it worked for us.

@ftrader
Copy link
Author

ftrader commented Jun 5, 2022

Tested in our pipeline with 8.3.2, all good. Thanks again @squidfunk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open
Projects
None yet
Development

No branches or pull requests

2 participants