Conversation
docopt hasn't been updated in years and is still built using setup.py. typer is a more modern CLI library that gives shell completion for free. For more information see: - https://typer.tiangolo.com/ - https://github.com/fastapi/typer
The logging.getLevelNamesMapping() method was only introduced in Python 3.11.
This is no longer needed since we're now using typer for our CLI argument-parsing needs.
dav3r
left a comment
There was a problem hiding this comment.
I think both typer and click seem fine for our needs. I asked Google about it and here's what it came back with:
Pick Typer if: You want a modern developer experience with excellent autocompletion and less boilerplate. It is ideal if you are already using FastAPI, as it shares the same design philosophy.
Pick Click if: You need a proven, stable tool with maximum control and minimal dependencies. It is often preferred for very large, complex CLI structures where explicit control over every parameter is necessary.
Hybrid Approach: Because Typer is built on Click, you can use Typer for your main interface but drop down into Click for advanced features that Typer might not yet support.
That being said, I have no major preference here and will gladly go with whichever one our team feels more strongly about.
Co-authored-by: dav3r <david.redmin@gwe.cisa.dhs.gov>
|
We have decided to go with #176. |

🗣 Description
This pull request switches from
docopttotyperfor our CLI argument-parsing needs.💭 Motivation and context
I noticed that installing
docoptgenerates warnings because it still uses asetup.pyfile versus apyproject.tomlfile. Investigating further, I found thatdocopthasn't seen any updates since 2014. I figured now would be a good time to start looking at alternatives.The main two alternatives right now are
clickandtyper. The former is a bit more verbose, whereas the latter is a bit more opinionated but also more Pythonic.typerusesclickunder the hood and leverages type hints to do some work for you. Both automatically generate tab completion for various shells.See #176 for the
clickimplementation. We can choose which one we like better.🧪 Testing
All automated tests pass.
✅ Pre-approval checklist
bump_versionscript if this repository is versioned and the changes in this PR warrant a version bump.✅ Pre-merge checklist
✅ Post-merge checklist