backstage / mkdocs-techdocs-core

The core MkDocs plugin used by Backstage's TechDocs as a wrapper around multiple MkDocs plugins and Python Markdown extensions
Apache License 2.0
83 stars 61 forks source link

Pin jinja2 to 3.0.3 to have a working jinja2.contextfilter #54

Closed bassco closed 2 years ago

bassco commented 2 years ago

Jinja 3.1.0 has a breaking change when building a techdocs-cli image.

  File "/usr/local/lib/python3.8/site-packages/mkdocs/theme.py", line 6, in <module>
    from mkdocs.utils import filters
  File "/usr/local/lib/python3.8/site-packages/mkdocs/utils/filters.py", line 13, in <module>
    @jinja2.contextfilter

https://github.com/mkdocs/mkdocs/pull/2795/files has an unmerged fix.

bassco commented 2 years ago

@emmaindal - this should be a temporary fix for someone building on local and not using the docker hub image. https://github.com/mkdocs/mkdocs/pull/2800 once that gets merged and a release is made, this change can be rolled back

emmaindal commented 2 years ago

@bassco I think we might want to have control over the dependencies anyways. What issues do you see with keeping it long term and just instead lock to 3.1.0 once it's compatible?

bassco commented 2 years ago

@emmaindal - agree, having control of pinned versions is preferable.

rino0601 commented 1 year ago

Hi, I'm trying to build techdocs with --no-docker option, then I found this issue and err:

(airsflow-IrFbFKZq-py3.9) ➜  airsflow2 git:(feat/techdocs) ✗ poetry add mkdocs-techdocs-core
Using version ^1.1.4 for mkdocs-techdocs-core

Updating dependencies
Resolving dependencies... (1.6s)

  SolverProblemError

  Because mkdocs-techdocs-core (1.1.4) depends on Jinja2 (3.0.3)
   and no versions of mkdocs-techdocs-core match >1.1.4,<2.0.0, mkdocs-techdocs-core (>=1.1.4,<2.0.0) requires Jinja2 (3.0.3).
  So, because airsflow depends on both jinja2 (3.1.2) and mkdocs-techdocs-core (^1.1.4), version solving failed.

Looks like https://github.com/mkdocs/mkdocs/pull/2800 has been released https://github.com/mkdocs/mkdocs/releases/tag/1.2.4

Does this pin still need?