inquirer


Nameinquirer JSON
Version 3.2.4 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-02-21 00:32:20
maintainer
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": "",
    "docs_url": null,
    "requires_python": ">=3.8.1",
    "maintainer_email": "",
    "keywords": "",
    "author": "Miguel \u00c1ngel Garc\u00eda",
    "author_email": "miguelangel.garcia@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/03/eb/b631f7ed6156717cd5bd9abc8c9df809fe128a389a0377274f2d6cb102db/inquirer-3.2.4.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.2.4",
    "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": "17e0d7febc18212b2006f06542ca59e86fb982ac514e5df9ffb727b351c54f5c",
                "md5": "6c75294f58189ab864aab7837253396c",
                "sha256": "273a4e4a4345ac1afdb17408d40fc8dccf3485db68203357919468561035a763"
            },
            "downloads": -1,
            "filename": "inquirer-3.2.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6c75294f58189ab864aab7837253396c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8.1",
            "size": 18441,
            "upload_time": "2024-02-21T00:32:16",
            "upload_time_iso_8601": "2024-02-21T00:32:16.799683Z",
            "url": "https://files.pythonhosted.org/packages/17/e0/d7febc18212b2006f06542ca59e86fb982ac514e5df9ffb727b351c54f5c/inquirer-3.2.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "03ebb631f7ed6156717cd5bd9abc8c9df809fe128a389a0377274f2d6cb102db",
                "md5": "0e7c86e3c18e27b336685a865e0c4361",
                "sha256": "33b09efc1b742b9d687b540296a8b6a3f773399673321fcc2ab0eb4c109bf9b5"
            },
            "downloads": -1,
            "filename": "inquirer-3.2.4.tar.gz",
            "has_sig": false,
            "md5_digest": "0e7c86e3c18e27b336685a865e0c4361",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8.1",
            "size": 14826,
            "upload_time": "2024-02-21T00:32:20",
            "upload_time_iso_8601": "2024-02-21T00:32:20.947460Z",
            "url": "https://files.pythonhosted.org/packages/03/eb/b631f7ed6156717cd5bd9abc8c9df809fe128a389a0377274f2d6cb102db/inquirer-3.2.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-21 00:32:20",
    "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.20393s