-
-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use python fire for all cli commands #240
Comments
Hi @uberspot, I am planning to work on this issue. I was checking into this python-fire guide https://github.com/google/python-fire/blob/master/docs/guide.md and although there are different possible implementations, one of them can be, as we have 7 different subparsers, so we can make a function for each one of them with corresponding arguments included in it which can then be handled by fire. One other way can be to make class for each subparser. What are your thoughts on this ? |
Sounds like a class for each subparser is an overkill.
And import functions in cli.py that implement each part. |
We can shift each subparser code block inside our current if-else tree into separate functions along with necessary arguments and then just fire using a dict. Should I proceed with this implementation ? |
If you wish yes. We can continue comments on the PR. 👍 |
Hey @uberspot, I wanted to discuss on some issues before creating a PR. Like:
Edit : For the first issue after searching a bit more I found this google/python-fire#108 . Some shorthand ability is indeed present but its not fully flexible. |
That seems like it would work. I can't really comment without seeing code but for 2) it's ok if we move that basic check in the function. We only use it in one place. For nargs a similar check will be needed but that at least can be re-used in a function, so code changes should be minimal. |
Hey @uberspot , can you go over above discussion in python-fire about some current difficulties. They have some few suggestions and we will have to decide on a specific way of implementation. |
dbieber's suggestion in google/python-fire#169 (comment)_ sounds pretty good actually. Some minor parsing for specific types is also acceptable given that this will anyway decrease the code size significantly. |
Not relevant anymore |
Some minor refactoring in cli.py to use https://github.com/google/python-fire will allow for much easier expansion in functionality later on with less code.
The text was updated successfully, but these errors were encountered: