this post was submitted on 23 Aug 2023
26 points (93.3% liked)
Programming
17482 readers
202 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities [email protected]
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Others have already mentioned
argparse
, which is a pretty great module for argument parsing if you want to use something built-in. If you're willing to look into other libraries though, I'd recommend taking a look at Click. You should be able topip install click
to use it. It takes advantage of defining the CLI through decorators, and from my experience, works better when you want to have subcommands.Interesting! I'll check it out.
I've replaced the Traitlets based arg parsing with argparse, and the subcommands are working ok so far. I'll see if Click can add anything, thank you for the recommendation!