https://github.com/zerointensity/prompts.py
Beautiful prompts for Python.
https://github.com/zerointensity/prompts.py
choice cli command-line interface prompts py python
Last synced: 6 months ago
JSON representation
Beautiful prompts for Python.
- Host: GitHub
- URL: https://github.com/zerointensity/prompts.py
- Owner: ZeroIntensity
- License: mit
- Created: 2024-05-18T00:21:37.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-05-19T19:07:18.000Z (over 1 year ago)
- Last Synced: 2025-04-09T03:42:11.512Z (6 months ago)
- Topics: choice, cli, command-line, interface, prompts, py, python
- Language: Python
- Homepage: https://prompts.zintensity.dev
- Size: 306 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE.txt
Awesome Lists containing this project
README
# prompts.py
## Beautiful prompts for Python.
[](https://pypi.org/project/prompts.py)
[](https://pypi.org/project/prompts.py)_Inspired by the [prompts](https://www.npmjs.com/package/prompts) package on NPM. This project was written specifically for [view.py](https://github.com/ZeroIntensity/view.py)_
---
## Example

```py
from prompts import ask, ValidatorResultdef validate(name: str) -> ValidatorResult:
if name == "andrew":
return "You're not allowed here, buddy!"return True
ask("What's your name?", validate=validate)
```## Features
- Fully typed
- Extendable
- Drop-in support for [Click](https://click.palletsprojects.com/)### Click Example
```py
from prompts.integration import PrettyOption
import click@click.command()
@click.option(
"--name",
default="Peter",
prompt=True,
cls=PrettyOption, # Enable prompts.py inputs!
)
def main(name: str):
...if __name__ == "__main__":
main()
```## Installation
```console
$ pip install prompts.py
```## License
`prompts.py` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.