Skip to content
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

Markdown TypeError with Ford (markdown 3.4.1 related?) #437

Closed
mathomp4 opened this issue Jul 18, 2022 · 3 comments · Fixed by #438
Closed

Markdown TypeError with Ford (markdown 3.4.1 related?) #437

mathomp4 opened this issue Jul 18, 2022 · 3 comments · Fixed by #438

Comments

@mathomp4
Copy link

First, let me say this might not be a Ford error, but I figured I'd start here. So this morning I did a sync up of my repo where I'm playing with Ford (see #431 and all the other issues that @ZedThree has helped me with), and with that sync, my "Run Ford" GitHub Action sprang into action...and failed. The error I got was:

Run ford Ford/docs.md
  ford Ford/docs.md
  shell: /usr/bin/bash -e {0}
  env:
    pythonLocation: /opt/hostedtoolcache/Python/3.10.5/x64
    PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.10.5/x64/lib/pkgconfig
    Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.10.5/x64
    Python[2](https://github.com/mathomp4/MAPL/runs/7389886008?check_suite_focus=true#step:8:2)_ROOT_DIR: /opt/hostedtoolcache/Python/[3](https://github.com/mathomp4/MAPL/runs/7389886008?check_suite_focus=true#step:8:3).10.5/x6[4](https://github.com/mathomp4/MAPL/runs/7389886008?check_suite_focus=true#step:8:4)
    Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.10.[5](https://github.com/mathomp4/MAPL/runs/7389886008?check_suite_focus=true#step:8:5)/x[6](https://github.com/mathomp4/MAPL/runs/7389886008?check_suite_focus=true#step:8:6)4
    LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.10.5/x64/lib
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.10.5/x64/bin/ford", line [8](https://github.com/mathomp4/MAPL/runs/7389886008?check_suite_focus=true#step:8:8), in <module>
    sys.exit(run())
  File "/opt/hostedtoolcache/Python/3.10.5/x64/lib/python3.10/site-packages/ford/__init__.py", line 633, in run
    proj_data, proj_docs, md = initialize()
  File "/opt/hostedtoolcache/Python/3.10.5/x64/lib/python3.10/site-packages/ford/__init__.py", line 236, in initialize
    return parse_arguments(vars(args), proj_docs, directory)
  File "/opt/hostedtoolcache/Python/3.10.5/x64/lib/python3.10/site-packages/ford/__init__.py", line 406, in parse_arguments
    md = markdown.Markdown(
  File "/opt/hostedtoolcache/Python/3.10.5/x64/lib/python3.10/site-packages/markdown/core.py", line [9](https://github.com/mathomp4/MAPL/runs/7389886008?check_suite_focus=true#step:8:9)6, in __init__
    self.registerExtensions(extensions=kwargs.get('extensions', []),
  File "/opt/hostedtoolcache/Python/3.[10](https://github.com/mathomp4/MAPL/runs/7389886008?check_suite_focus=true#step:8:10).5/x64/lib/python3.10/site-packages/markdown/core.py", line [12](https://github.com/mathomp4/MAPL/runs/7389886008?check_suite_focus=true#step:8:13)5, in registerExtensions
    ext.extendMarkdown(self)
TypeError: MarkdownInclude.extendMarkdown() missing 1 required positional argument: 'md_globals'
Error: Process completed with exit code 1.

This very well could be due to my Ford config file as I am still fiddling around, but then I was looking at the Python Markdown repo and saw in the v3.4 changelog:

In addition, the md_globals parameter of Markdown.extensions.Extension.extendMarkdown() is no longer recognized as a valid parameter and will raise an error if provided.

and GitHub did get Markdown 3.4.1:

Collecting markdown
  Downloading Markdown-3.4.1-py3-none-any.whl (93 kB)

As I said, I'm not sure if this is a Ford issue, or a Python-Markdown issue, or a me issue. I mean I added this:

md_extensions: markdown.extensions.toc
               markdown.extensions.smarty

to my Ford config file mainly because I saw other people using it in theirs. 😄

@ZedThree
Copy link
Member

Markdown 3.4 has removed a bunch of deprecated features, which has broken some extensions, including one we use by default, markdown_include.

There is a PR fixing it: cmacmackin/markdown-include#34

The workaround for the time being is to do e.g. pip install --upgrade "markdown<3.4"

@cmacmackin If you'd like me to help maintain that repo as a key dependency of FORD, I'm happy to do that

@mathomp4
Copy link
Author

Ah. Thanks! I added:

      - name: Downgrade Python Markdown
        run: pip install --upgrade "markdown<3.4"

to my GitHub Action and it seems much happier now.

(Though I might file a question about something else...)

@cmacmackin
Copy link
Contributor

@ZedThree Thanks, I was just thinking of asking if you'd like to do that! I'll give you the necessary permissions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants