marzer / poxy

Documentation generator for C++
https://pypi.org/project/poxy
MIT License
135 stars 5 forks source link

Restore compatibility with Python <3.9 #20

Closed fwerner closed 1 year ago

fwerner commented 1 year ago

Hi Mark,

many thanks for this extremely useful wrapper around m.css!

I am stuck with Python v3.8 in some of my projects and stumbled over argparse.BooleanOptionalAction—which has only been introduced in Python v3.9. I hope you could consider merging this tiny PR to get back compatibility with earlier versions of Python.

Functionality and CLI arguments are not affected; the only downside is that --no-{html,xml,werror} are now listed on a separate line below their positive counterparts, e.g.:

[...]
  -v, --verbose         enable very noisy diagnostic output
  --html                specify whether HTML output is required
  --no-html
  --ppinclude <regex>   pattern matching HTML file names to post-process (default: all)
[...]

Cheers, Felix

marzer commented 1 year ago

Oh! TIL argparse.BooleanOptionalAction requires Python 3.9.

You are right about the downside. A shame to have them separate like that, though I guess it's a minor annoyance. Might be worth wrapping the argument factory for those in some helper function that checks sys.version_info.minor >= 9, though you needn't bother for this PR. I'll mess with that myself.

Thanks!