I have been using docopt, because I like having good docstrings, but it is limited and doesn't always behave like I think it should. Click and typer look good!
ENJOYED the video - nicely done ! INTERESTING little package, but some comments/challenges already encountered: 1. the documentation uses the term "main" FAR TOO MUCH and in TOO MANY PLACES to see when you NEED to use "main" and when it's OPTIONAL (sloppy documentation); THAT IS: - you DON'T need to name your file "main.py" python mtcbrain.py hello 2. the FIRST thing I noticed was that the command names MUST be in ALL LOWERCASE; NO CamelCase, NO underscored_Names :-( !!! THAT IS, the following function names either WORK or DON'T - hello() WORKS (we KNEW this) :-) - Hello() DOESN'T WORK (that came as a surprise, but it's also BAD NAMING CONVENTION for python FUNCTIONS, so nobody noticed anyways) :-O - helloThere() DOESN'T WORK (this came as a REAL SURPRISE, because this is likely the MOST COMMON NAMING CONVENTION in all of python) :-O - hello_there() also DOESN'T WORK (this came as ANOTHER SURPRISE) because this is the 2ND-MOST-COMMON NAMING CONVENTION in all of python) :-O - hellothere() WORKS and will have to do for anyone trying to use multi-word (sorry "multiword") function names ;-) 3. even your ARGUMENT NAMES must also be ALL LOWER CASE !!! THAT IS: - hellothere(userName: str) DOESN'T WORK - hellothere(username: str) DOES WORK I'll CONTINUE test-driving this package as it's the FIRST one I tried, so I've NOTHING to compare to which to compare it, and will report back. HOPE THIS HELPS OTHERS TRYING TO BUILD CLI-TYPE APPS IN PYTHON - it's a GOOD THING TO DO, and containerizing PYSIMPLEGUI type apps ISN'T CROSS-PLATFORM (yet) ! Cheers, -Mark Vogt, Principal Data Scientist, AVANADE (www.avanade.com)
I am trying to use nubian, it is full fledged CLI creator with a feel of Cisco IOS or other network vendor devices, it was developed for LDShell by Facebook developers, but I can gurantee it is a hard nut to crack trying to include my commands and no luck so far after 5 hours..
hello, what if we are working with pipenv, how to make it working with the command typer to get the autocomplete ? and also can we combine fzf instead of the autocomplete? thanks
All nice and good but this, like all of the other tutorials it is for the command line arguments when you LAUNCH the python script (i.e., python nameOffScript --arg1 val etc...). My use case is that I have a command line within the launched program and I want it to parse my dozens of commands every time I receive command input. How do I bend it to that? I naively tried putting the app() call after the input command but it is just confused
I'm having a little trouble getting the auto completion to work in ubuntu. I'm probably missing something basic. (venv) charles@pc-1:~/Projects/py_trader$ type type typeset (venv) charles@pc-1:~/Projects/py_trader$ typer --install-completion Command 'typer' not found, but can be installed with: sudo snap install erlang If you can take a look at it I would appreciate it. Also this is the simplest cli I have tried very intuitive. edit: didn't realize I had to pip install typer-cli
What's your favorite Python module for creating CLI applications?
Click!
I have been using docopt, because I like having good docstrings, but it is limited and doesn't always behave like I think it should. Click and typer look good!
Cool 😎. Typer is simply smart. Thanks for the demo🙏🏻
Neat! Didn't know about typer, thanks!
ENJOYED the video - nicely done !
INTERESTING little package, but some comments/challenges already encountered:
1. the documentation uses the term "main" FAR TOO MUCH and in TOO MANY PLACES to see when you NEED to use "main" and when it's OPTIONAL (sloppy documentation);
THAT IS:
- you DON'T need to name your file "main.py" python mtcbrain.py hello
2. the FIRST thing I noticed was that the command names MUST be in ALL LOWERCASE; NO CamelCase, NO underscored_Names :-( !!!
THAT IS, the following function names either WORK or DON'T
- hello() WORKS (we KNEW this) :-)
- Hello() DOESN'T WORK (that came as a surprise, but it's also BAD NAMING CONVENTION for python FUNCTIONS, so nobody noticed anyways) :-O
- helloThere() DOESN'T WORK (this came as a REAL SURPRISE, because this is likely the MOST COMMON NAMING CONVENTION in all of python) :-O
- hello_there() also DOESN'T WORK (this came as ANOTHER SURPRISE) because this is the 2ND-MOST-COMMON NAMING CONVENTION in all of python) :-O
- hellothere() WORKS and will have to do for anyone trying to use multi-word (sorry "multiword") function names ;-)
3. even your ARGUMENT NAMES must also be ALL LOWER CASE !!!
THAT IS:
- hellothere(userName: str) DOESN'T WORK
- hellothere(username: str) DOES WORK
I'll CONTINUE test-driving this package as it's the FIRST one I tried, so I've NOTHING to compare to which to compare it, and will report back.
HOPE THIS HELPS OTHERS TRYING TO BUILD CLI-TYPE APPS IN PYTHON - it's a GOOD THING TO DO, and containerizing PYSIMPLEGUI type apps ISN'T CROSS-PLATFORM (yet) !
Cheers,
-Mark Vogt, Principal Data Scientist, AVANADE (www.avanade.com)
I am trying to use nubian, it is full fledged CLI creator with a feel of Cisco IOS or other network vendor devices, it was developed for LDShell by Facebook developers, but I can gurantee it is a hard nut to crack trying to include my commands and no luck so far after 5 hours..
"and it's just gonna show me my IQ of 500... so this is a pretty good feel-good app right now, feeling pretty smart" lmao
This is better than optparse and argparse.
microsoft is always restart, restart, restart ...maybe, they will add the source command to their shell, lol! good video!
Nice Mate!
Thanks!
Amazing channel... Thank you
hello, what if we are working with pipenv, how to make it working with the command typer to get the autocomplete ? and also can we combine fzf instead of the autocomplete? thanks
Reminds me of click 8.0.4 for Python.
thanks, helped me a lot today
Glad you found it helpful!
thanks
All nice and good but this, like all of the other tutorials it is for the command line arguments when you LAUNCH the python script
(i.e., python nameOffScript --arg1 val etc...).
My use case is that I have a command line within the launched program and I want it to parse my dozens of commands every time I receive command input. How do I bend it to that? I naively tried putting the app() call after the input command but it is just confused
hi , sir . How could I install "typer" in powershell?
I'm having a little trouble getting the auto completion to work in ubuntu. I'm probably missing something basic.
(venv) charles@pc-1:~/Projects/py_trader$ type
type typeset
(venv) charles@pc-1:~/Projects/py_trader$ typer --install-completion
Command 'typer' not found, but can be installed with:
sudo snap install erlang
If you can take a look at it I would appreciate it.
Also this is the simplest cli I have tried very intuitive.
edit: didn't realize I had to pip install typer-cli
Thank you, this tip helped me get it working!
Cool, thanks 😃
Is it possible to make the CLI commands interactive?
Nice.
how do u start the program from the command line? ive tried "python .\Program.py" (without quotations) but it hasnt worked
Try python3 ./program.py
I made a cli similar project, I want to deploy it and make it accessible to users. How can I do it??
What do you need to do
nice
How does it differ from the click module?
Typer is built on top of click, so they are similar in many ways
4:10 You can just add the name variable as another argument to print, no need for an F string :D
How do I code a invalid cli when user type the wrong command that is not in the list using type?
Create a Class with Enum
What do I do if it says: "zsh: permission denied: ./main.py"?
Permission issue. Try marking your script as executable. I think this might help you if not google. chmod +x ./main.py
i cant install typer autocompletion
What error do you get?
@@DevOpsJourney typer is not a cmdlet, program or batch file, i used powershell