typer
python-prompt-toolkit
Our great sponsors
typer | python-prompt-toolkit | |
---|---|---|
87 | 21 | |
14,347 | 8,948 | |
- | 1.1% | |
8.7 | 7.8 | |
1 day ago | 17 days ago | |
Python | Python | |
MIT License | BSD 3-clause "New" or "Revised" License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
typer
- Typer: Python library for building CLI applications
- Copilot for your GitHub stars
-
Things I've learned about building CLI tools in Python
I have been using Typer on every one of my CLI projects which uses Click under the hood. The documentation is fantastic, the CLI app it produces looks great and lets you create things quickly. I high recommend it.
https://typer.tiangolo.com/
-
Things to do with standalone script
Adding CLI capabilities. My preferred library here is typer.
-
Where to start for managing a Python code base for public distribution
I just heard about this but it seems to be pretty much the type of thing you want and want fast.
-
Help on Docstrings
Docstrings are for documenting how a function/ class/ method/ module works. Often you don't need to add a docstring to your main function because no one will be importing it to use elsewhere. And if you want it to run as a CLI, then there are better ways to document the available options. For example, typer does most of it for you, or in click you add the help text to the decorator.
-
Which best practices do you follow to build robust & extensible ETL jobs?
Most computing tasks in airflow DAGs are KubernetesPodOperator containing a CLI (Python Typer). It allows us to pass arguments easily to run DAG manually if needed (the new UI to pass arguments to DAG in airflow 2.6 is really nice). Arguments allow us to replay DAG easily (change start / end dates for instance).
-
Devs on teams that deploy anytime you want, what does your SDLC workflow look like?
So it's basically the main .gitlab-ci.yml file plus a separate Python CI app using Typer for the AWS instrumentation.
-
The different uses of Python type hints
Similarly for Typer, which is literally "the FastAPI of CLIs"[1]. Handy to type your `main` parameters and have CLI argument parsing. For more complicated cases, it's a wrapper around Click.
[1] https://typer.tiangolo.com/
-
Command line parser library, which one do you like the most, regardless of language?
interesting that you hate python, but love Click. Did you try Typer which uses Click underneath?
python-prompt-toolkit
-
Is there a library that can give python-prompt-toolkit like completion for TUI?
Ref. https://github.com/prompt-toolkit/python-prompt-toolkit and https://github.com/c-bata/go-prompt ?
-
Show HN: Replbuilder, quickly build a Python REPL CLI prompt
> The purpose is not to do this however, the goal for a repl cli is usually to invoke a set of particular, already implemented commands, not on the fly python input and output. The implementation will be predefined and packaged, repl are only used to run a list of specific commands with arguments that implementation has already defined.
That's a very strange definition for a REPL, I would just call that an (interactive) CLI. Maybe that's why you couldn't find anything when you were doing your search? I used python-prompt-toolkit [0] when building such interfaces. pgcli [1] is an example of such an interface built with prompt-toolkit.
It has a lot of nice autocomplete and readline emulation options. Maybe it's something you can integrate with your project.
[0] https://github.com/prompt-toolkit/python-prompt-toolkit
[1] https://www.pgcli.com/
-
TUI library with Sixel support?
Euporie uses prompt_toolkit as its TUI library. prompt_toolkit does not specifically support terminal graphics, but I've written various of custom components and modifications to enable images to be displayed using terminal graphics.
-
Why is the terminal input so weird?
That bothered me too, the default function for Ctrl-W in ipython is unix-word-rubout from python-prompt-toolkit [1], which uses spaces for word boundaries. You can rebind it to backward-kill-word so it uses "not a letter nor a digit" as a word boundary.
Here's a gist with my config (also binds shift-left/right arrow to move to previous space instead of visual select): https://gist.github.com/fratajczak/64e32421a43d3b8194d0409ce...
[1]: https://github.com/prompt-toolkit/python-prompt-toolkit/blob...
- Is there a library for creating interactive long running terminal applications?
-
improved repl for lua?
When coding in python I've used ptpython repl based on prompt-toolkit which has been used in numerous CLI programs https://github.com/prompt-toolkit/python-prompt-toolkit/blob/master/PROJECTS.rst. I've also used mycli from that page. I've really enjoyed the UX of these. In addition to the syntax highlighting, auto/tab completions, (and maybe other enjoyable features) the vi-mode is amazingly helpful (for us vi folks) (it's probably got emacs bindings too). I would love to have all of this in a repl for lua.
-
A simple tui to launch gzdoom mods
That's an interesting approach. I was also thinking of using a more sophisticated framework than whiptail, maybe the PromptToolkit. I guess it then would be more similar to the idea of using a text editor. I certainly do think a TUI may be overkill yet it was also a good excuse to practice some bash scripting for me.
- How to create terminal GUI?
-
Rich is a Python library for rich text and beautiful formatting in the terminal
Try prompt_toolkit which is a Python library used by IPython among others: https://github.com/prompt-toolkit/python-prompt-toolkit
-
python-prompt-toolkit VS python-sploitkit - a user suggested alternative
2 projects | 15 Jan 2022
What are some alternatives?
click - Python composable command line interface toolkit
Python Fire - Python Fire is a library for automatically generating command line interfaces (CLIs) from absolutely any Python object.
rich - Rich is a Python library for rich text and beautiful formatting in the terminal.
Gooey - Turn (almost) any Python command line program into a full GUI application with one line
Turbo Vision - A modern port of Turbo Vision 2.0, the classical framework for text-based user interfaces. Now cross-platform and with Unicode support.
textual - The lean application framework for Python. Build sophisticated user interfaces with a simple Python API. Run your apps in the terminal and a web browser.
cement - Application Framework for Python
asciimatics - A cross platform package to do curses-like operations, plus higher level APIs and widgets to create text UIs and ASCII art animations
docopt - This project is no longer maintained. Please see https://github.com/jazzband/docopt-ng
urwid - Console user interface library for Python (official repo)