-
Notifications
You must be signed in to change notification settings - Fork 66
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
Fix etree deprecation warnings #93
Fix etree deprecation warnings #93
Conversation
@nickmoreton thanks for this. Can you point me to the deprecation warnings? |
Hey @zerolab this is one of our support tickets:
Is this info enough? I can get trace tomorrow if need be. |
That is plenty, thanks |
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.
Issue: It looks like that import is only deprecated as of Markdown >= 3.2
.
https://python-markdown.github.io/change_log/release-3.2/#markdownutiletree-deprecated
This project currently allows the version range Markdown>=3,<4
.
We either need to add a version dependent import or limit the supported version range. I would say the former would be preferred as the impact should be smaller.
import markdown
if markdown.VERSION >= (3, 2):
import xml.etree.ElementTree as etree
else:
from markdown.util import etree
🌟@tbrlpld |
@nickmoreton you probably want to use |
Thanks @zerolab I was busy working it out before I saw your message but used version instead. Is that OK? |
@@ -14,9 +14,19 @@ | |||
Copyright 2009 - [Waylan Limberg](http://achinghead.com) | |||
""" | |||
|
|||
|
|||
import markdown | |||
from packaging.version import Version |
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.
Wasn't sure how this would play with non-pip solutions (e.g. Conda) but it looks like Conda projects can use pip when a package is not available in the Conda repos.
From my research it seem it should all be fine. Happy to go with this.
I have changed the import for etree to avoid the Django deprecation warnings