inquirer


Nameinquirer JSON
Version 3.4.0 PyPI version JSON
download
home_pagehttps://github.com/magmax/python-inquirer
SummaryCollection of common interactive command line user interfaces, based on Inquirer.js
upload_time2024-08-12 12:03:43
maintainerNone
docs_urlNone
authorMiguel Ángel García
requires_python>=3.8.1
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![PyPI](https://img.shields.io/pypi/v/inquirer.svg)][pypi status]
[![Status](https://img.shields.io/pypi/status/inquirer.svg)][pypi status]
[![Python Version](https://img.shields.io/pypi/pyversions/inquirer)][pypi status]
[![License](https://img.shields.io/pypi/l/inquirer)][license]
[![Black](https://img.shields.io/badge/code%20style-black-000000.svg)][black]
<br>
[![Read the documentation at https://python-inquirer.readthedocs.io/](https://img.shields.io/readthedocs/python-inquirer/latest.svg?label=Read%20the%20Docs)][read the docs]
[![Tests](https://github.com/magmax/python-inquirer/workflows/Tests/badge.svg)][tests]
[![Codecov](https://codecov.io/gh/magmax/python-inquirer/branch/main/graph/badge.svg)][codecov]
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)][pre-commit]

[pypi status]: https://pypi.org/project/inquirer/
[read the docs]: https://python-inquirer.readthedocs.io/
[tests]: https://github.com/magmax/python-inquirer/actions?workflow=Tests
[codecov]: https://app.codecov.io/gh/magmax/python-inquirer
[pre-commit]: https://github.com/pre-commit/pre-commit
[black]: https://github.com/psf/black

# python-inquirer

Collection of common interactive command line user interfaces, based on [Inquirer.js].

## Goal and Philosophy

Born as a [Inquirer.js] clone, it shares part of the goals and philosophy.

So, **Inquirer** should ease the process of asking end user **questions**, **parsing**, **validating** answers, managing **hierarchical prompts** and providing **error feedback**.

You can [download the python-inquirer code from GitHub] or [download the wheel from Pypi].

### Platforms support

Python-inquirer supports mainly UNIX-based platforms (eq. Mac OS, Linux, etc.). Windows has experimental support, please let us know if there are any problems!

## Installation

```sh
pip install inquirer
```

## Documentation

Documentation has been moved to [python-inquirer.readthedocs.io](https://python-inquirer.readthedocs.io/).

But here you have a couple of usage examples:

### Text

```python
import re

import inquirer
questions = [
  inquirer.Text('name', message="What's your name"),
  inquirer.Text('surname', message="What's your surname"),
  inquirer.Text('phone', message="What's your phone number",
                validate=lambda _, x: re.match('\+?\d[\d ]+\d', x),
                )
]
answers = inquirer.prompt(questions)
```

### Editor

Like a Text question, but used for larger answers. It opens external text editor which is used to collect the answer.

The environment variables `$VISUAL` and `$EDITOR`, can be used to specify which editor should be used. If not present inquirer fallbacks to `vim -> emacs -> nano` in this order based on availability in the system.

External editor handling is done using great library [python-editor](https://github.com/fmoo/python-editor).

Example:

```python
import inquirer
questions = [
  inquirer.Editor('long_text', message="Provide long text")
]
answers = inquirer.prompt(questions)
```

### List

Shows a list of choices, and allows the selection of one of them.

Example:

```python
import inquirer
questions = [
  inquirer.List('size',
                message="What size do you need?",
                choices=['Jumbo', 'Large', 'Standard', 'Medium', 'Small', 'Micro'],
            ),
]
answers = inquirer.prompt(questions)
```

List questions can take one extra argument `carousel=False`. If set to true, the answers will rotate (back to first when pressing down on last choice, and down to last choice when pressing up on first choice)

### Checkbox

Shows a list of choices, with multiple selection.

Example:

```python
import inquirer
questions = [
  inquirer.Checkbox('interests',
                    message="What are you interested in?",
                    choices=['Computers', 'Books', 'Science', 'Nature', 'Fantasy', 'History'],
                    ),
]
answers = inquirer.prompt(questions)
```

Checkbox questions can take extra argument `carousel=False`. If set to true, the answers will rotate (back to first when pressing down on last choice, and down to last choice when pressing up on first choice)

Another argument that can be used is `locked=<List>`. The given choices in the locked argument cannot be removed. This is useful if you want to make clear that a specific option out of the choices must be chosen.

### Path

Like Text question, but with builtin validations for working with paths.

Example:

```python
import inquirer
questions = [
  inquirer.Path('log_file',
                 message="Where logs should be located?",
                 path_type=inquirer.Path.DIRECTORY,
                ),
]
answers = inquirer.prompt(questions)
```

## Contributing

Contributions are very welcome.
To learn more, see the [Contributor Guide].

## License

Copyright (c) 2014-2023 Miguel Ángel García ([@magmax_en]), based on [Inquirer.js], by Simon Boudrias ([@vaxilart])

Distributed under the terms of the [MIT license][license].

<!-- github-only -->

[license]: https://github.com/magmax/python-inquirer/blob/main/LICENSE
[@magmax_en]: https://twitter.com/magmax_en
[@vaxilart]: https://twitter.com/vaxilart
[contributor guide]: CONTRIBUTING.md
[download the python-inquirer code from github]: https://github.com/magmax/python-inquirer
[download the wheel from pypi]: https://pypi.python.org/pypi/inquirer
[examples/]: https://github.com/magmax/python-inquirer/tree/master/examples
[inquirer.js]: https://github.com/SBoudrias/Inquirer.js


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/magmax/python-inquirer",
    "name": "inquirer",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8.1",
    "maintainer_email": null,
    "keywords": null,
    "author": "Miguel \u00c1ngel Garc\u00eda",
    "author_email": "miguelangel.garcia@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/f3/06/ef91eb8f3feafb736aa33dcb278fc9555d17861aa571b684715d095db24d/inquirer-3.4.0.tar.gz",
    "platform": null,
    "description": "[![PyPI](https://img.shields.io/pypi/v/inquirer.svg)][pypi status]\n[![Status](https://img.shields.io/pypi/status/inquirer.svg)][pypi status]\n[![Python Version](https://img.shields.io/pypi/pyversions/inquirer)][pypi status]\n[![License](https://img.shields.io/pypi/l/inquirer)][license]\n[![Black](https://img.shields.io/badge/code%20style-black-000000.svg)][black]\n<br>\n[![Read the documentation at https://python-inquirer.readthedocs.io/](https://img.shields.io/readthedocs/python-inquirer/latest.svg?label=Read%20the%20Docs)][read the docs]\n[![Tests](https://github.com/magmax/python-inquirer/workflows/Tests/badge.svg)][tests]\n[![Codecov](https://codecov.io/gh/magmax/python-inquirer/branch/main/graph/badge.svg)][codecov]\n[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)][pre-commit]\n\n[pypi status]: https://pypi.org/project/inquirer/\n[read the docs]: https://python-inquirer.readthedocs.io/\n[tests]: https://github.com/magmax/python-inquirer/actions?workflow=Tests\n[codecov]: https://app.codecov.io/gh/magmax/python-inquirer\n[pre-commit]: https://github.com/pre-commit/pre-commit\n[black]: https://github.com/psf/black\n\n# python-inquirer\n\nCollection of common interactive command line user interfaces, based on [Inquirer.js].\n\n## Goal and Philosophy\n\nBorn as a [Inquirer.js] clone, it shares part of the goals and philosophy.\n\nSo, **Inquirer** should ease the process of asking end user **questions**, **parsing**, **validating** answers, managing **hierarchical prompts** and providing **error feedback**.\n\nYou can [download the python-inquirer code from GitHub] or [download the wheel from Pypi].\n\n### Platforms support\n\nPython-inquirer supports mainly UNIX-based platforms (eq. Mac OS, Linux, etc.). Windows has experimental support, please let us know if there are any problems!\n\n## Installation\n\n```sh\npip install inquirer\n```\n\n## Documentation\n\nDocumentation has been moved to [python-inquirer.readthedocs.io](https://python-inquirer.readthedocs.io/).\n\nBut here you have a couple of usage examples:\n\n### Text\n\n```python\nimport re\n\nimport inquirer\nquestions = [\n  inquirer.Text('name', message=\"What's your name\"),\n  inquirer.Text('surname', message=\"What's your surname\"),\n  inquirer.Text('phone', message=\"What's your phone number\",\n                validate=lambda _, x: re.match('\\+?\\d[\\d ]+\\d', x),\n                )\n]\nanswers = inquirer.prompt(questions)\n```\n\n### Editor\n\nLike a Text question, but used for larger answers. It opens external text editor which is used to collect the answer.\n\nThe environment variables `$VISUAL` and `$EDITOR`, can be used to specify which editor should be used. If not present inquirer fallbacks to `vim -> emacs -> nano` in this order based on availability in the system.\n\nExternal editor handling is done using great library [python-editor](https://github.com/fmoo/python-editor).\n\nExample:\n\n```python\nimport inquirer\nquestions = [\n  inquirer.Editor('long_text', message=\"Provide long text\")\n]\nanswers = inquirer.prompt(questions)\n```\n\n### List\n\nShows a list of choices, and allows the selection of one of them.\n\nExample:\n\n```python\nimport inquirer\nquestions = [\n  inquirer.List('size',\n                message=\"What size do you need?\",\n                choices=['Jumbo', 'Large', 'Standard', 'Medium', 'Small', 'Micro'],\n            ),\n]\nanswers = inquirer.prompt(questions)\n```\n\nList questions can take one extra argument `carousel=False`. If set to true, the answers will rotate (back to first when pressing down on last choice, and down to last choice when pressing up on first choice)\n\n### Checkbox\n\nShows a list of choices, with multiple selection.\n\nExample:\n\n```python\nimport inquirer\nquestions = [\n  inquirer.Checkbox('interests',\n                    message=\"What are you interested in?\",\n                    choices=['Computers', 'Books', 'Science', 'Nature', 'Fantasy', 'History'],\n                    ),\n]\nanswers = inquirer.prompt(questions)\n```\n\nCheckbox questions can take extra argument `carousel=False`. If set to true, the answers will rotate (back to first when pressing down on last choice, and down to last choice when pressing up on first choice)\n\nAnother argument that can be used is `locked=<List>`. The given choices in the locked argument cannot be removed. This is useful if you want to make clear that a specific option out of the choices must be chosen.\n\n### Path\n\nLike Text question, but with builtin validations for working with paths.\n\nExample:\n\n```python\nimport inquirer\nquestions = [\n  inquirer.Path('log_file',\n                 message=\"Where logs should be located?\",\n                 path_type=inquirer.Path.DIRECTORY,\n                ),\n]\nanswers = inquirer.prompt(questions)\n```\n\n## Contributing\n\nContributions are very welcome.\nTo learn more, see the [Contributor Guide].\n\n## License\n\nCopyright (c) 2014-2023 Miguel \u00c1ngel Garc\u00eda ([@magmax_en]), based on [Inquirer.js], by Simon Boudrias ([@vaxilart])\n\nDistributed under the terms of the [MIT license][license].\n\n<!-- github-only -->\n\n[license]: https://github.com/magmax/python-inquirer/blob/main/LICENSE\n[@magmax_en]: https://twitter.com/magmax_en\n[@vaxilart]: https://twitter.com/vaxilart\n[contributor guide]: CONTRIBUTING.md\n[download the python-inquirer code from github]: https://github.com/magmax/python-inquirer\n[download the wheel from pypi]: https://pypi.python.org/pypi/inquirer\n[examples/]: https://github.com/magmax/python-inquirer/tree/master/examples\n[inquirer.js]: https://github.com/SBoudrias/Inquirer.js\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Collection of common interactive command line user interfaces, based on Inquirer.js",
    "version": "3.4.0",
    "project_urls": {
        "Documentation": "https://python-inquirer.readthedocs.io",
        "Homepage": "https://github.com/magmax/python-inquirer",
        "Repository": "https://github.com/magmax/python-inquirer"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a4b2be907c8c0f8303bc4b10089f5470014c3bf3521e9b8d3decf3037fd94725",
                "md5": "07041792b9764ed2d098a6fba3f7ff40",
                "sha256": "bb0ec93c833e4ce7b51b98b1644b0a4d2bb39755c39787f6a504e4fee7a11b60"
            },
            "downloads": -1,
            "filename": "inquirer-3.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "07041792b9764ed2d098a6fba3f7ff40",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8.1",
            "size": 18077,
            "upload_time": "2024-08-12T12:03:41",
            "upload_time_iso_8601": "2024-08-12T12:03:41.589870Z",
            "url": "https://files.pythonhosted.org/packages/a4/b2/be907c8c0f8303bc4b10089f5470014c3bf3521e9b8d3decf3037fd94725/inquirer-3.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f306ef91eb8f3feafb736aa33dcb278fc9555d17861aa571b684715d095db24d",
                "md5": "6e41b6b459126463712f9a435ce50d59",
                "sha256": "8edc99c076386ee2d2204e5e3653c2488244e82cb197b2d498b3c1b5ffb25d0b"
            },
            "downloads": -1,
            "filename": "inquirer-3.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "6e41b6b459126463712f9a435ce50d59",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8.1",
            "size": 14472,
            "upload_time": "2024-08-12T12:03:43",
            "upload_time_iso_8601": "2024-08-12T12:03:43.830950Z",
            "url": "https://files.pythonhosted.org/packages/f3/06/ef91eb8f3feafb736aa33dcb278fc9555d17861aa571b684715d095db24d/inquirer-3.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-12 12:03:43",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "magmax",
    "github_project": "python-inquirer",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "inquirer"
}
        
Elapsed time: 0.51035s