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
Ignore mypy issue on jinja2.contextfunction
function
#1554
Conversation
jinja2
to be able to build with mkdocs
jinja2
to be able to build with mkdocs
jinja2
to be able to build our docs
jinja2
to be able to build our docsjinja2.contextfunction
function
pass_context = jinja2.contextfunction | ||
pass_context = jinja2.contextfunction # type: ignore[attr-defined] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you clarify why this is necessary? Is Jinja2 untyped / the types are wrong? I'm going to run this locally also, going to take me a sec tho
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The attribute is not defined on the latest jinja2
(which is the one installed for Python 3.7+).
The conditional there is because Python 3.6 will have a previous jinja2
version installed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see. It's just missing in newer versions of Jinja. And so MyPy complains that it's missing. Seems like a reasonable ignore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use sys.version_info instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we could... I've added a note on the PR that removes Python 3.6 (#1357) to remove this logic anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about that but it seems like it could lead to issues because the coupling between the Python version and Jinja2 version is coming from our requirements file, so it's pretty much an implementation detail. If there were a sys.version_info
but for jinja that is what we would want to do
Thanks @adriangb :) |
jinja2
released a new version, and as a consequence our pipeline broke.EDIT: we need to pin
jinja2
on our pipeline becausemkdocs
doesn't work with the latestjinja2
.