veekun / pokedex

more than you ever wanted to know about Pokémon
MIT License
1.44k stars 637 forks source link

Markdown warnings #257

Open magical opened 5 years ago

magical commented 5 years ago

Running the test suite with a recent version of Markdown (3.0.1) gives me the following warnings

pokedex/tests/test_strings.py::test_markdown
  /home/andrew/veekun/env-pyramid/lib/python2.7/site-packages/markdown/util.py:388: DeprecationWarning: Using setitem to register a processor or pattern is deprecated. Use the `register` method instead.
    'Use the `register` method instead.', DeprecationWarning
  /home/andrew/veekun/env-pyramid/lib/python2.7/site-packages/markdown/core.py:128: DeprecationWarning: The 'md_globals' parameter of 'pokedex.db.markdown.PokedexLinkExtension.extendMarkdown' is deprecated.
    ext._extendMarkdown(self)
  /home/andrew/veekun/env-pyramid/lib/python2.7/site-packages/markdown/util.py:388: DeprecationWarning: Using setitem to register a processor or pattern is deprecated. Use the `register` method instead.
    'Use the `register` method instead.', DeprecationWarning
  /home/andrew/veekun/env-pyramid/lib/python2.7/site-packages/markdown/core.py:128: DeprecationWarning: The 'md_globals' parameter of 'pokedex.db.markdown.PokedexLinkExtension.extendMarkdown' is deprecated.
    ext._extendMarkdown(self)
  /home/andrew/veekun/env-pyramid/lib/python2.7/site-packages/markdown/util.py:388: DeprecationWarning: Using setitem to register a processor or pattern is deprecated. Use the `register` method instead.
    'Use the `register` method instead.', DeprecationWarning
  /home/andrew/veekun/env-pyramid/lib/python2.7/site-packages/markdown/core.py:128: DeprecationWarning: The 'md_globals' parameter of 'pokedex.db.markdown.PokedexLinkExtension.extendMarkdown' is deprecated.
    ext._extendMarkdown(self)
  /home/andrew/veekun/env-pyramid/lib/python2.7/site-packages/markdown/util.py:388: DeprecationWarning: Using setitem to register a processor or pattern is deprecated. Use the `register` method instead.
    'Use the `register` method instead.', DeprecationWarning
  /home/andrew/veekun/env-pyramid/lib/python2.7/site-packages/markdown/core.py:128: DeprecationWarning: The 'md_globals' parameter of 'pokedex.db.markdown.PokedexLinkExtension.extendMarkdown' is deprecated.
    ext._extendMarkdown(self)

pokedex/tests/test_strings.py::test_markdown_string
  /home/andrew/veekun/env-pyramid/lib/python2.7/site-packages/markdown/util.py:388: DeprecationWarning: Using setitem to register a processor or pattern is deprecated. Use the `register` method instead.
    'Use the `register` method instead.', DeprecationWarning
  /home/andrew/veekun/env-pyramid/lib/python2.7/site-packages/markdown/core.py:128: DeprecationWarning: The 'md_globals' parameter of 'pokedex.db.markdown.PokedexLinkExtension.extendMarkdown' is deprecated.
    ext._extendMarkdown(self)
  /home/andrew/veekun/env-pyramid/lib/python2.7/site-packages/markdown/util.py:388: DeprecationWarning: Using setitem to register a processor or pattern is deprecated. Use the `register` method instead.
    'Use the `register` method instead.', DeprecationWarning
  /home/andrew/veekun/env-pyramid/lib/python2.7/site-packages/markdown/core.py:128: DeprecationWarning: The 'md_globals' parameter of 'pokedex.tests.test_strings.ObjectTestExtension.extendMarkdown' is deprecated.
    ext._extendMarkdown(self)
  /home/andrew/veekun/env-pyramid/lib/python2.7/site-packages/markdown/util.py:388: DeprecationWarning: Using setitem to register a processor or pattern is deprecated. Use the `register` method instead.
    'Use the `register` method instead.', DeprecationWarning
  /home/andrew/veekun/env-pyramid/lib/python2.7/site-packages/markdown/core.py:128: DeprecationWarning: The 'md_globals' parameter of 'pokedex.tests.test_strings.IdentifierTestExtension.extendMarkdown' is deprecated.
    ext._extendMarkdown(self)
magical commented 5 years ago

Running with markdown 2.6.11 gives a different set of warnings:

pokedex/tests/test_strings.py::test_markdown
  /home/andrew/veekun/env-pyramid/lib/python2.7/site-packages/markdown/__init__.py:140: DeprecationWarning: "safe_mode" is deprecated in Python-Markdown. Use an HTML sanitizer (like Bleach https://bleach.readthedocs.io/) if you are parsing untrusted markdown text. See the 2.6 release notes for more info
    DeprecationWarning)
  /home/andrew/veekun/env-pyramid/lib/python2.7/site-packages/markdown/__init__.py:259: DeprecationWarning: Using short names for Markdown's builtin extensions is deprecated. Use the full path to the extension with Python's dot notation (eg: "markdown.extensions.extra" instead of "extra"). The current behavior will raise an error in version 2.7. See the Release Notes for Python-Markdown version 2.6 for more info.
    DeprecationWarning)
  /home/andrew/veekun/env-pyramid/lib/python2.7/site-packages/markdown/__init__.py:140: DeprecationWarning: "safe_mode" is deprecated in Python-Markdown. Use an HTML sanitizer (like Bleach https://bleach.readthedocs.io/) if you are parsing untrusted markdown text. See the 2.6 release notes for more info
    DeprecationWarning)
  /home/andrew/veekun/env-pyramid/lib/python2.7/site-packages/markdown/__init__.py:259: DeprecationWarning: Using short names for Markdown's builtin extensions is deprecated. Use the full path to the extension with Python's dot notation (eg: "markdown.extensions.extra" instead of "extra"). The current behavior will raise an error in version 2.7. See the Release Notes for Python-Markdown version 2.6 for more info.
    DeprecationWarning)
  /home/andrew/veekun/env-pyramid/lib/python2.7/site-packages/markdown/__init__.py:140: DeprecationWarning: "safe_mode" is deprecated in Python-Markdown. Use an HTML sanitizer (like Bleach https://bleach.readthedocs.io/) if you are parsing untrusted markdown text. See the 2.6 release notes for more info
    DeprecationWarning)
  /home/andrew/veekun/env-pyramid/lib/python2.7/site-packages/markdown/__init__.py:259: DeprecationWarning: Using short names for Markdown's builtin extensions is deprecated. Use the full path to the extension with Python's dot notation (eg: "markdown.extensions.extra" instead of "extra"). The current behavior will raise an error in version 2.7. See the Release Notes for Python-Markdown version 2.6 for more info.
    DeprecationWarning)
  /home/andrew/veekun/env-pyramid/lib/python2.7/site-packages/markdown/__init__.py:140: DeprecationWarning: "safe_mode" is deprecated in Python-Markdown. Use an HTML sanitizer (like Bleach https://bleach.readthedocs.io/) if you are parsing untrusted markdown text. See the 2.6 release notes for more info
    DeprecationWarning)
  /home/andrew/veekun/env-pyramid/lib/python2.7/site-packages/markdown/__init__.py:259: DeprecationWarning: Using short names for Markdown's builtin extensions is deprecated. Use the full path to the extension with Python's dot notation (eg: "markdown.extensions.extra" instead of "extra"). The current behavior will raise an error in version 2.7. See the Release Notes for Python-Markdown version 2.6 for more info.
    DeprecationWarning)

pokedex/tests/test_strings.py::test_markdown_string
  /home/andrew/veekun/env-pyramid/lib/python2.7/site-packages/markdown/__init__.py:140: DeprecationWarning: "safe_mode" is deprecated in Python-Markdown. Use an HTML sanitizer (like Bleach https://bleach.readthedocs.io/) if you are parsing untrusted markdown text. See the 2.6 release notes for more info
    DeprecationWarning)
  /home/andrew/veekun/env-pyramid/lib/python2.7/site-packages/markdown/__init__.py:259: DeprecationWarning: Using short names for Markdown's builtin extensions is deprecated. Use the full path to the extension with Python's dot notation (eg: "markdown.extensions.extra" instead of "extra"). The current behavior will raise an error in version 2.7. See the Release Notes for Python-Markdown version 2.6 for more info.
    DeprecationWarning)
  /home/andrew/veekun/env-pyramid/lib/python2.7/site-packages/markdown/__init__.py:140: DeprecationWarning: "safe_mode" is deprecated in Python-Markdown. Use an HTML sanitizer (like Bleach https://bleach.readthedocs.io/) if you are parsing untrusted markdown text. See the 2.6 release notes for more info
    DeprecationWarning)
  /home/andrew/veekun/env-pyramid/lib/python2.7/site-packages/markdown/__init__.py:259: DeprecationWarning: Using short names for Markdown's builtin extensions is deprecated. Use the full path to the extension with Python's dot notation (eg: "markdown.extensions.extra" instead of "extra"). The current behavior will raise an error in version 2.7. See the Release Notes for Python-Markdown version 2.6 for more info.
    DeprecationWarning)
  /home/andrew/veekun/env-pyramid/lib/python2.7/site-packages/markdown/__init__.py:140: DeprecationWarning: "safe_mode" is deprecated in Python-Markdown. Use an HTML sanitizer (like Bleach https://bleach.readthedocs.io/) if you are parsing untrusted markdown text. See the 2.6 release notes for more info
    DeprecationWarning)
  /home/andrew/veekun/env-pyramid/lib/python2.7/site-packages/markdown/__init__.py:259: DeprecationWarning: Using short names for Markdown's builtin extensions is deprecated. Use the full path to the extension with Python's dot notation (eg: "markdown.extensions.extra" instead of "extra"). The current behavior will raise an error in version 2.7. See the Release Notes for Python-Markdown version 2.6 for more info.
    DeprecationWarning)
magical commented 3 years ago

Markdown is now preventing us from supporting python 3.9. Attempting to install markdown 2.4.1 on python 3.9 produces this delightful little error: AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getiterator'. And also a warning about 'imp' being deprecated.

Noticed while trying to set up github actions.

``` 2021-03-20T03:45:50.0330971Z /tmp/pip-install-y0bz5q67/markdown_052892abbd484cf4a455c252c514c71c/setup.py:11: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses 2021-03-20T03:45:50.0332392Z import imp 2021-03-20T03:45:50.0332938Z running install 2021-03-20T03:45:50.0333416Z running build 2021-03-20T03:45:50.0333947Z running build_py 2021-03-20T03:45:50.0334445Z creating build/lib 2021-03-20T03:45:50.0335015Z creating build/lib/markdown 2021-03-20T03:45:50.0336088Z copying markdown/blockprocessors.py -> build/lib/markdown 2021-03-20T03:45:50.0337191Z copying markdown/serializers.py -> build/lib/markdown 2021-03-20T03:45:50.0338330Z copying markdown/postprocessors.py -> build/lib/markdown 2021-03-20T03:45:50.0339365Z copying markdown/__version__.py -> build/lib/markdown 2021-03-20T03:45:50.0340475Z copying markdown/treeprocessors.py -> build/lib/markdown 2021-03-20T03:45:50.0341486Z copying markdown/__main__.py -> build/lib/markdown 2021-03-20T03:45:50.0342462Z copying markdown/util.py -> build/lib/markdown 2021-03-20T03:45:50.0343704Z copying markdown/odict.py -> build/lib/markdown 2021-03-20T03:45:50.0344619Z copying markdown/__init__.py -> build/lib/markdown 2021-03-20T03:45:50.0345655Z copying markdown/blockparser.py -> build/lib/markdown 2021-03-20T03:45:50.0346761Z copying markdown/inlinepatterns.py -> build/lib/markdown 2021-03-20T03:45:50.0347951Z copying markdown/preprocessors.py -> build/lib/markdown 2021-03-20T03:45:50.0348761Z creating build/lib/markdown/extensions 2021-03-20T03:45:50.0349916Z copying markdown/extensions/footnotes.py -> build/lib/markdown/extensions 2021-03-20T03:45:50.0351138Z copying markdown/extensions/nl2br.py -> build/lib/markdown/extensions 2021-03-20T03:45:50.0352662Z copying markdown/extensions/def_list.py -> build/lib/markdown/extensions 2021-03-20T03:45:50.0353924Z copying markdown/extensions/codehilite.py -> build/lib/markdown/extensions 2021-03-20T03:45:50.0355252Z copying markdown/extensions/fenced_code.py -> build/lib/markdown/extensions 2021-03-20T03:45:50.0356464Z copying markdown/extensions/abbr.py -> build/lib/markdown/extensions 2021-03-20T03:45:50.0357641Z copying markdown/extensions/meta.py -> build/lib/markdown/extensions 2021-03-20T03:45:50.0358905Z copying markdown/extensions/attr_list.py -> build/lib/markdown/extensions 2021-03-20T03:45:50.0360126Z copying markdown/extensions/toc.py -> build/lib/markdown/extensions 2021-03-20T03:45:50.0361588Z copying markdown/extensions/wikilinks.py -> build/lib/markdown/extensions 2021-03-20T03:45:50.0364424Z copying markdown/extensions/headerid.py -> build/lib/markdown/extensions 2021-03-20T03:45:50.0365746Z copying markdown/extensions/sane_lists.py -> build/lib/markdown/extensions 2021-03-20T03:45:50.0374093Z copying markdown/extensions/admonition.py -> build/lib/markdown/extensions 2021-03-20T03:45:50.0375552Z copying markdown/extensions/__init__.py -> build/lib/markdown/extensions 2021-03-20T03:45:50.0376776Z copying markdown/extensions/smart_strong.py -> build/lib/markdown/extensions 2021-03-20T03:45:50.0379119Z copying markdown/extensions/extra.py -> build/lib/markdown/extensions 2021-03-20T03:45:50.0380326Z copying markdown/extensions/smarty.py -> build/lib/markdown/extensions 2021-03-20T03:45:50.0381598Z copying markdown/extensions/tables.py -> build/lib/markdown/extensions 2021-03-20T03:45:50.0382362Z running build_scripts 2021-03-20T03:45:50.0383158Z creating build/scripts-3.9 2021-03-20T03:45:50.0384197Z copying and adjusting bin/markdown_py -> build/scripts-3.9 2021-03-20T03:45:50.0385239Z changing mode of build/scripts-3.9/markdown_py from 644 to 755 2021-03-20T03:45:50.0385961Z running build_docs 2021-03-20T03:45:50.0386945Z Converting docs/release-2.1.1.txt -> build/docs/release-2.1.1.html 2021-03-20T03:45:50.0387837Z Traceback (most recent call last): 2021-03-20T03:45:50.0388920Z File "", line 1, in 2021-03-20T03:45:50.0390505Z File "/tmp/pip-install-y0bz5q67/markdown_052892abbd484cf4a455c252c514c71c/setup.py", line 216, in 2021-03-20T03:45:50.0391445Z setup( 2021-03-20T03:45:50.0392848Z File "/opt/hostedtoolcache/Python/3.9.2/x64/lib/python3.9/distutils/core.py", line 148, in setup 2021-03-20T03:45:50.0393703Z dist.run_commands() 2021-03-20T03:45:50.0394861Z File "/opt/hostedtoolcache/Python/3.9.2/x64/lib/python3.9/distutils/dist.py", line 966, in run_commands 2021-03-20T03:45:50.0395745Z self.run_command(cmd) 2021-03-20T03:45:50.0402505Z File "/opt/hostedtoolcache/Python/3.9.2/x64/lib/python3.9/distutils/dist.py", line 985, in run_command 2021-03-20T03:45:50.0403448Z cmd_obj.run() 2021-03-20T03:45:50.0410198Z File "/opt/hostedtoolcache/Python/3.9.2/x64/lib/python3.9/site-packages/setuptools/command/install.py", line 61, in run 2021-03-20T03:45:50.0411374Z return orig.install.run(self) 2021-03-20T03:45:50.0412539Z File "/opt/hostedtoolcache/Python/3.9.2/x64/lib/python3.9/distutils/command/install.py", line 546, in run 2021-03-20T03:45:50.0414142Z self.run_command('build') 2021-03-20T03:45:50.0415230Z File "/opt/hostedtoolcache/Python/3.9.2/x64/lib/python3.9/distutils/cmd.py", line 313, in run_command 2021-03-20T03:45:50.0416239Z self.distribution.run_command(command) 2021-03-20T03:45:50.0427784Z File "/opt/hostedtoolcache/Python/3.9.2/x64/lib/python3.9/distutils/dist.py", line 985, in run_command 2021-03-20T03:45:50.0428693Z cmd_obj.run() 2021-03-20T03:45:50.0429745Z File "/opt/hostedtoolcache/Python/3.9.2/x64/lib/python3.9/distutils/command/build.py", line 135, in run 2021-03-20T03:45:50.0430645Z self.run_command(cmd_name) 2021-03-20T03:45:50.0432145Z File "/opt/hostedtoolcache/Python/3.9.2/x64/lib/python3.9/distutils/cmd.py", line 313, in run_command 2021-03-20T03:45:50.0433175Z self.distribution.run_command(command) 2021-03-20T03:45:50.0434363Z File "/opt/hostedtoolcache/Python/3.9.2/x64/lib/python3.9/distutils/dist.py", line 985, in run_command 2021-03-20T03:45:50.0435284Z cmd_obj.run() 2021-03-20T03:45:50.0436766Z File "/tmp/pip-install-y0bz5q67/markdown_052892abbd484cf4a455c252c514c71c/setup.py", line 167, in run 2021-03-20T03:45:50.0437888Z out = template % self._get_context(src, outfile) 2021-03-20T03:45:50.0454480Z File "/tmp/pip-install-y0bz5q67/markdown_052892abbd484cf4a455c252c514c71c/setup.py", line 106, in _get_context 2021-03-20T03:45:50.0456398Z c['body'] = self.md.convert(src) 2021-03-20T03:45:50.0457250Z File "build/lib/markdown/__init__.py", line 295, in convert 2021-03-20T03:45:50.0458084Z newRoot = treeprocessor.run(root) 2021-03-20T03:45:50.0458979Z File "build/lib/markdown/treeprocessors.py", line 350, in run 2021-03-20T03:45:50.0460031Z brs = root.getiterator('br') 2021-03-20T03:45:50.0461367Z AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getiterator' ```
magical commented 3 years ago

Good news: markdown 2.6.11 does seem to work on 3.9.

magical commented 3 years ago

I tested the latest version (3.3.4) and it seems to work, despite the deprecation warnings (same warnings as the OP). They are trivial to fix but will require breaking support for Markdown 2.6.11. Note also that Markdown 3.2 dropped support for Python 2.

I'm going to leave this alone for now, but once we drop Python 2.7 support we should bump the minimum Markdown version up to 3.0 and fix the deprecations.