Skip to content

DeprecationWarning 'contextfilter' is renamed to 'pass_context', the old name will be removed in Jinja 3.1 #2794

@lyz-code

Description

@lyz-code

I'm trying to load a mkdocs.yaml in a fixture for the mkdocs-newsletter library with the next code:

from mkdocs import config
from mkdocs.config.base import Config

mkdocs_config = config.load_config("mkdocs.yml")

With the next "mkdocs.yml"

---
site_name: The Blue Book
site_description: My second brain
site_author: Lyz
site_url: https://lyz-code.github.io/blue-book
site_dir: site
nav:
  - Introduction: index.md
  - DevOps:
      - devops/devops.md
      - Infrastructure as Code:
          - Helm:
              - devops/helm/helm.md
  - Coding:
      - TDD: coding/tdd.md
      - Python:
          - Libraries:
              - GitPython: coding/python/gitpython.md
  - Botany:
      - Trees: botany/trees.md
  - Emojis: emojis.md

plugins:
  - git-revision-date-localized:
      type: timeago
  - autolinks
  - section-index
  - mkdocs-newsletter

markdown_extensions:
  - toc:
      baselevel: 2
theme:
  name: material
  logo: img/logo.bmp

And I get the next error:

tests/conftest.py:166: in config_
    mkdocs_config = config.load_config(
../../.venvs/mkdocs-newsletter/lib/python3.9/site-packages/mkdocs/config/base.py:216: in load_config
    from mkdocs.config.defaults import get_schema
../../.venvs/mkdocs-newsletter/lib/python3.9/site-packages/mkdocs/config/defaults.py:1: in <module>
    from mkdocs.config import config_options
../../.venvs/mkdocs-newsletter/lib/python3.9/site-packages/mkdocs/config/config_options.py:8: in <module>
    from mkdocs import utils, theme, plugins
../../.venvs/mkdocs-newsletter/lib/python3.9/site-packages/mkdocs/theme.py:6: in <module>
    from mkdocs.utils import filters
../../.venvs/mkdocs-newsletter/lib/python3.9/site-packages/mkdocs/utils/filters.py:14: in <module>
    def url_filter(context, value):
../../.venvs/mkdocs-newsletter/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.

I'm using the next versions:

  • Python 3.9.10
  • Mkdocs 1.2.3
  • Jinja2 3.0.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions