Skip to content

Move sphinx and docutils to optional dependencies #342

Closed

Description

@choldgraf

If I'm not mistaken, the myst parser can be used independently of sphinx and docutils. Is that right? If so, perhaps we should move those dependencies into an extra install. This would make the parser more lightweight and potentially encourage others to use it in other ways. Wdyt @chrisjsewell ?

Activity

  1. chrisjsewell commented on Apr 5, 2021

    @chrisjsewell
    Member

    No, this is a sphinx extension, if they want to use just the parser, then that's what markdown-it-py is for.
    You can add extra documentation about how to do the parsing with markdown-it-py if you want, i.e. what extensions and options to use

  2. choldgraf commented on Apr 5, 2021

    @choldgraf
    MemberAuthor

    Maybe another way of phrasing this question - I think that the Python library could be useful for others outside of the Sphinx use case. Is there a way that we could offer this to others without requiring them to rewrite it from scratch with their own markdown it py config? If not, i agree with your assessment that documenting how to recreate a myst parser with markdown it py would be helpful

  3. chrisjsewell commented on Apr 5, 2021

    @chrisjsewell
    Member

    I think that the Python library could be useful for others outside of the Sphinx use case.

    I disagree: this is literally all the code that would be made available:

    from markdown_it import MarkdownIt
    from mdit_py_plugins.dollarmath import dollarmath_plugin
    from mdit_py_plugins.footnote import footnote_plugin
    from mdit_py_plugins.front_matter import front_matter_plugin
    from mdit_py_plugins.myst_blocks import myst_block_plugin
    from mdit_py_plugins.myst_role import myst_role_plugin
    md = (
            MarkdownIt("commonmark")
            .enable("table")
            .use(front_matter_plugin)
            .use(myst_block_plugin)
            .use(myst_role_plugin)
            .use(footnote_plugin)
            .disable("footnote_inline")
            .disable("footnote_tail")
            .use(dollarmath_plugin)  # potentially optional
        )

    Also, sphinx was previously an extra and changed to a core requirement because it added extra complexity and the chance for broken dependency versions, for the core use-case as a sphinx extension,
    i.e. this has already been litigated and decided

  4. chrisjsewell commented on Apr 5, 2021

    @chrisjsewell
    Member

    If you didn't want this to be the case, then you should have objected here: #170 (comment) 😜

  5. choldgraf commented on Apr 5, 2021

    @choldgraf
    MemberAuthor

    Then I think we should document this pattern for others to follow, since the myst parser repo is also effectively the reference implementation this could be a helpful way for others to apply the myst spec in other contexts. I'll close this and re open another issue

  6. chrisjsewell commented on Apr 5, 2021

    @chrisjsewell
    Member

    👍

  7. astrojuanlu commented on Apr 6, 2021

    @astrojuanlu
    Contributor

    (Coming from here https://twitter.com/juanluisback/status/1379101793653776387)

    Hi @chrisjsewell! I was surprised to see docutils 0.17 add experimental Markdown support using Recommonmark, so I found this thread on docutils-users https://sourceforge.net/p/docutils/mailman/docutils-users/thread/rkv4nb%24139g%241%40ciao.gmane.io/#msg37118232 (in which you participated I believe) and that's what sparked my original question to @choldgraf about the optional dependencies of myst-parser. It sounds like docutils could potentially use https://github.com/executablebooks/markdown-it-py for its Markdown support then?

  8. choldgraf commented on Apr 6, 2021

    @choldgraf
    MemberAuthor

    Yep, i think that is the answer.

  9. chrisjsewell commented on Apr 6, 2021

    @chrisjsewell
    Member

    I was surprised to see docutils 0.17 add experimental Markdown support using Recommonmark

    Grr you and me both, and I completely missed the response on the email thread.

    Ah well that's a different proposition: I literally have myst_parser/docutils_renderer.py and myst_parser/sphinx_renderer.py as a sub-class, so that it is certainly possible to use myst-parser with "docutils only" functionality.

    If I had known previously about such an intention to ship Markdown in docutils, I would certainly have considered splitting the "docutils only" aspects in to a separate "myst-docutils" package (and have that as a dependency here), which I think would probably be a better solution than just moving dependencies to extras.
    Indeed, if there was an agreement in principle with the docutils guys to include something like myst-docutils in docutils I would look into this.

    @choldgraf you've been promising to talk to the recommonmark guys about potentially combining our efforts (indeed myst-parser evolved from the recommonmark code), get on it! 😉

  10. astrojuanlu commented on Apr 6, 2021

    @astrojuanlu
    Contributor

    I now work on Read the Docs, so although it's still a bit bold to call me one of the "recommonmark guys", I'd love to stay in the loop of such conversations. If the release cadence of docutils is ~once a year, I'd say we have enough time to give this a try :)

  11. astrojuanlu commented on Apr 6, 2021

    @astrojuanlu
    Contributor
  12. chrisjsewell commented on Apr 6, 2021

    @chrisjsewell
    Member

    I now work on Read the Docs

    Ah fair lol

    If the release cadence of docutils is ~once a year, I'd say we have enough time to give this a try

    yep absolutely 👍

  13. ericholscher commented on Apr 6, 2021

    @ericholscher

    I'm 👍 on deprecating recommonmark. I will add it to our internal roadmap call this week, and then see if @astrojuanlu can move forward on it as a priority item on our side 👍

  14. chrisjsewell commented on Apr 6, 2021

    @chrisjsewell
    Member

    Ok cool, yeh feel free to get in touch about any question/issues, and I will think about how best to approach the docutils integration.
    I guess we can open up a new issue or meta discussion on this.

  15. astrojuanlu commented on Apr 15, 2021

    @astrojuanlu
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions