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

DeprecationWarning: 'contextfilter' is renamed to 'pass_context' #1568

Open
slayoo opened this issue May 13, 2021 · 4 comments
Open

DeprecationWarning: 'contextfilter' is renamed to 'pass_context' #1568

slayoo opened this issue May 13, 2021 · 4 comments

Comments

@slayoo
Copy link

slayoo commented May 13, 2021

from jinja2 import contextfilter

As discussed here: pallets/jinja#1381
contextfilter is now deprecated.

This causes the following warning to show up whenever using the exporters:

...
/opt/hostedtoolcache/Python/3.9.5/x64/lib/python3.9/site-packages/nbconvert/exporters/html.py:100: in HTMLExporter
    def markdown2html(self, context, source):
/opt/hostedtoolcache/Python/3.9.5/x64/lib/python3.9/site-packages/jinja2/filters.py:54: in contextfilter
    warnings.warn(
E   DeprecationWarning: 'contextfilter' is renamed to 'pass_context', the old name will be removed in Jinja 3.1.

Thanks

sjdemartini added a commit to sjdemartini/nbconvert that referenced this issue Jul 16, 2021
Resolves jupyter#1568.

As noted in the Jinja docs here https://jinja.palletsprojects.com/en/3.0.x/api/#jinja2.contextfilter and in the Changelog here https://jinja.palletsprojects.com/en/3.0.x/changes/#version-3-0-0, the `contextfilter` decorator has been replaced with `pass_context`, which provides the same functionality. `contextfilter` will be removed in Jinja 3.1.
@sjdemartini
Copy link

This should presumably have been fixed in #1624

@slayoo
Copy link
Author

slayoo commented Sep 15, 2021

thanks!

@slayoo slayoo closed this as completed Sep 15, 2021
@twhughes
Copy link

Hi, I am still getting this warning with nbconvert. Version: 6.1.0

Is there a way to resolve?

@slayoo slayoo reopened this Sep 21, 2021
@dimpase
Copy link

dimpase commented Mar 29, 2022

contextfilter is removed in the current jinja2 version, 3.1.1, on PyPI.
So fixing this is getting urgent.

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 a pull request may close this issue.

4 participants