Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Adapt to the new 0.7.19 _cli.make_arg_parser signature #3

Merged
merged 4 commits into from
Nov 20, 2024

Conversation

csala
Copy link
Owner

@csala csala commented Nov 20, 2024

Close #2 - Adapt to changes introduced in the _cli.make_arg_parser function in the 0.7.19, with backwards compatibility in mind.

@@ -12,7 +12,7 @@ repos:
hooks:
- id: python-check-blanket-noqa
- repo: https://github.com/timothycrosley/isort
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have been using https://github.com/PyCQA/isort, wondering if there is a difference

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No difference, this is just the old URL, which now jumps to PyCQA. I do not think it is worth changing it at this stage. Eventually I would possibly migrate everything over to ruff, but I would not really look into it unless it gives problems

@@ -50,12 +50,14 @@ jobs:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i wonder if there should be a test matrix or something for <0.7.19 and >=0.7.19 so that it's captured

Copy link
Owner Author

@csala csala Nov 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. This is implicitly covered by the different python versions, because older python versions do not support 0.7.19, while the new ones do pull the latest.

Feel free to open a separate PR if you have suggestions to improve this, but for now I would move on as is, to release a version that solves the problem.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is good to know! I'd have maybe added a comment in test.yaml about that or something, for auditing purposes.
Thank you for fixing! I only added my reviews since it is OS and I wanted to share some of the burden, I really appreciate this package.

enabled_parserplugins = mdformat.plugins.PARSER_EXTENSIONS
enabled_codeformatters = mdformat.plugins.CODEFORMATTERS
arg_parser = mdformat._cli.make_arg_parser(enabled_parserplugins, enabled_codeformatters)
if hasattr(mdformat.plugins, "_PARSER_EXTENSION_DISTS"):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sometimes try/except for these situations is more performant that checking hasattr, though probably unnecessary in this case.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I do not think it matters much in terms of performance here. Both options would be fine, but I prefer a bit more the if/else branching strategy over the try/except when there are two options which are hierarchically equivalent.

@codecov-commenter
Copy link

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@csala csala merged commit 85ae924 into master Nov 20, 2024
13 checks passed
@csala csala deleted the github-issue-2-mdformat-0.7.19-support branch November 20, 2024 19:27
@csala csala restored the github-issue-2-mdformat-0.7.19-support branch November 20, 2024 19:37
@csala csala deleted the github-issue-2-mdformat-0.7.19-support branch December 20, 2024 09:20
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mdformat 0.7.19 support
3 participants