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

use jinja2 < 3.0.0 #95

Closed
wants to merge 1 commit into from
Closed

Conversation

atsai1220
Copy link

Using Python 3.9.0 and 3.10.0 with a fresh environment causes this error:

Traceback (most recent call last):
  File "/Users/atsai/.pyenv/versions/silver-memory-3.9.0/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
  File "/Users/atsai/.pyenv/versions/3.9.0/envs/silver-memory-3.9.0/lib/python3.9/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/Users/atsai/.pyenv/versions/3.9.0/envs/silver-memory-3.9.0/lib/python3.9/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/Users/atsai/.pyenv/versions/3.9.0/envs/silver-memory-3.9.0/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/atsai/.pyenv/versions/3.9.0/envs/silver-memory-3.9.0/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/atsai/.pyenv/versions/3.9.0/envs/silver-memory-3.9.0/lib/python3.9/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/Users/atsai/.pyenv/versions/3.9.0/envs/silver-memory-3.9.0/lib/python3.9/site-packages/mkdocs/__main__.py", line 187, in build_command
    build.build(config.load_config(**kwargs), dirty=not clean)
  File "/Users/atsai/.pyenv/versions/3.9.0/envs/silver-memory-3.9.0/lib/python3.9/site-packages/mkdocs/config/base.py", line 216, in load_config
    from mkdocs.config.defaults import get_schema
  File "/Users/atsai/.pyenv/versions/3.9.0/envs/silver-memory-3.9.0/lib/python3.9/site-packages/mkdocs/config/defaults.py", line 1, in <module>
    from mkdocs.config import config_options
  File "/Users/atsai/.pyenv/versions/3.9.0/envs/silver-memory-3.9.0/lib/python3.9/site-packages/mkdocs/config/config_options.py", line 8, in <module>
    from mkdocs import utils, theme, plugins
  File "/Users/atsai/.pyenv/versions/3.9.0/envs/silver-memory-3.9.0/lib/python3.9/site-packages/mkdocs/theme.py", line 6, in <module>
    from mkdocs.utils import filters
  File "/Users/atsai/.pyenv/versions/3.9.0/envs/silver-memory-3.9.0/lib/python3.9/site-packages/mkdocs/utils/filters.py", line 13, in <module>
    @jinja2.contextfilter
AttributeError: module 'jinja2' has no attribute 'contextfilter'
mike: Command '['mkdocs', 'build', '--clean', '--config-file', 'mkdocs.yml']' returned non-zero exit status 1.

In jinja2 documentation they referenced the deprecation of contextfilter and currently setup.py is not configured for a specific version.

https://jinja.palletsprojects.com/en/3.0.x/api/#jinja2.pass_context

@jimporter
Copy link
Owner

mike doesn't use Jinja's contextfilter that I can see (though if it does, I'd prefer a patch to convert to the current Jinja API). The traceback you posted shows errors happening within MkDocs itself, so I think it would be better to fix this in MkDocs. See mkdocs/mkdocs#2794, mkdocs/mkdocs#2799, and mkdocs/mkdocs#2795.

@squidfunk
Copy link

Limiting to <3.1 should be enough. That's what I did for Material for MkDocs as a temporary fix.

@atsai1220
Copy link
Author

Thank you for the response. I'll close this and follow along with the mkdocs issues. mike is a great tool!

@atsai1220 atsai1220 closed this Mar 26, 2022
@atsai1220 atsai1220 deleted the patch-1 branch March 26, 2022 19:09
@jimporter
Copy link
Owner

This should be fixed in MkDocs now: see mkdocs/mkdocs#2800.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants