executablebooks / MyST-Parser

An extended commonmark compliant parser, with bridges to docutils/sphinx
https://myst-parser.readthedocs.io
MIT License
730 stars 192 forks source link

🔧 Fix docutils deprecation in option parsing #842

Closed agoose77 closed 8 months ago

agoose77 commented 8 months ago

This PR fixes the deprecation warnings raised by docutils' deprecation of OptionParser.

The help handling is a little ugly - we could introduce a switch on the docutils version like we do for the default settings. However, I think this approach will be less likely to break once the breaking change is introduced.

welcome[bot] commented 8 months ago

Thanks for submitting your first pull request! You are awesome! :hugs:
If you haven't done so already, check out EBP's Code of Conduct and our Contributing Guide, as this will greatly help the review process.
Welcome to the EBP community! :tada:

codecov[bot] commented 8 months ago

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (b445a0c) 90.08% compared to head (80e4b6a) 90.04%.

Files Patch % Lines
myst_parser/mdit_to_docutils/base.py 66.66% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #842 +/- ## ========================================== - Coverage 90.08% 90.04% -0.05% ========================================== Files 24 24 Lines 3360 3364 +4 ========================================== + Hits 3027 3029 +2 - Misses 333 335 +2 ``` | [Flag](https://app.codecov.io/gh/executablebooks/MyST-Parser/pull/842/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=executablebooks) | Coverage Δ | | |---|---|---| | [pytests](https://app.codecov.io/gh/executablebooks/MyST-Parser/pull/842/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=executablebooks) | `90.04% <66.66%> (-0.05%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=executablebooks#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

chrisjsewell commented 8 months ago

Cheers @agoose77!

Note some suggestions on a fix were given here: https://github.com/executablebooks/MyST-Parser/issues/612#issuecomment-1265047994, maybe you want to double check that against your changes here?

Will have a proper look later

agoose77 commented 8 months ago

Thanks @chrisjsewell — I actually used that issue as a starting point. As such, I'm hopeful that this should fall in line with the recommended changes where possible.

welcome[bot] commented 8 months ago

Congrats on your first merged pull request in this project! :tada: congrats
Thank you for contributing, we are very proud of you! :heart: