InquirerLib


NameInquirerLib JSON
Version 0.0.2 PyPI version JSON
download
home_pagehttps://github.com/brodybits/InquirerLib
SummaryAn updated fork of InquirerPy - Python port of Inquirer.js (A collection of common interactive command-line user interfaces)
upload_time2024-01-28 19:17:36
maintainer
docs_urlNone
authorVarious
requires_python>=3.7,<4.0
licenseMIT
keywords cli prompt-toolkit commandline inquirer development
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # InquirerLib

<!-- TODO: UPDATED BADGES -->

An updated fork of InquirerPy - see API notice below

<!-- start intro -->

## Introduction

`InquirerPy` is a Python port of the famous [Inquirer.js](https://github.com/SBoudrias/Inquirer.js/) (A collection of common interactive command line user interfaces).
This project is a re-implementation of the [PyInquirer](https://github.com/CITGuru/PyInquirer) project, with bug fixes of known issues, new prompts, backward compatible APIs
as well as more customisation options.

<!-- end intro -->

![Demo](https://github.com/kazhala/gif/blob/master/InquirerPy-demo.gif)

## Motivation

[PyInquirer](https://github.com/CITGuru/PyInquirer) is a great Python port of [Inquirer.js](https://github.com/SBoudrias/Inquirer.js/), however, the project is slowly reaching
to an unmaintained state with various issues left behind and no intention to implement more feature requests. I was heavily relying on this library for other projects but
could not proceed due to the limitations.

Some noticeable ones that bother me the most:

- hard limit on `prompt_toolkit` version 1.0.3
- various color issues
- various cursor issues
- No options for VI/Emacs navigation key bindings
- Pagination option doesn't work

This project uses python3.7+ type hinting with focus on resolving above issues while providing greater customisation options.

## Requirements

### OS

Leveraging [prompt_toolkit](https://github.com/prompt-toolkit/python-prompt-toolkit), `InquirerPy` works cross platform for all OS. Although Unix platform may have a better experience than Windows.

### Python

```
python >= 3.7
```

## API notice

Some functions are exported directly using `from InquirerLib`; other functions and all exported objects are within `InquirerLib.InquirerPy` namespace.

The optional arguments for `prompt` and `prompt_async` are now keyword arguments, with `raise_keyboard_interrupt` (which defaults to `True`) now deprecated. Rationale is to support a possible easier prompt API in the future - see DRAFT RFC PR: <https://github.com/brodybits/InquirerLib/pull/3>

**[Documentation for InquirerPy](https://inquirerpy.readthedocs.io/)** applies with these updated imports and optional arguments for `prompt` and `prompt_async` as now keyword arguments.

Note that importing from `InquirerLib.InquirerPy.inquirer` is DEPRECATED, as documented below.

Examples in `examples` may be helpful.

## Getting Started

### Install

```sh
pip install InquirerLib
```

### Quick Start

#### Classic Syntax (PyInquirer)

```python
from InquirerLib import prompt

questions = [
    {"type": "input", "message": "What's your name:", "name": "name"},
    {"type": "confirm", "message": "Confirm?", "name": "confirm", "default": True},
]
result = prompt(questions)
name = result["name"]
confirm = result["confirm"]
```

NOTE: `default` may be used for any question type.

#### Alternate Syntax

Using individual constructors:

```python
from InquirerLib.InquirerPy import prompts

name = prompts.InputPrompt(message="What's your name:").execute()
confirm = prompts.ConfirmPrompt(message="Confirm?", default=True).execute()
```

DEPRECATED API:

```python
from InquirerLib.InquirerPy import inquirer

name = inquirer.text(message="What's your name:").execute()
confirm = inquirer.confirm(message="Confirm?", default=True).execute()
```

These are deprecated aliases that may be removed or replaced in the future.

<!-- start migration -->

## Migrating from InquirerPy

Need to update the imports, as described above.

## Migrating from PyInquirer

Most APIs from [PyInquirer](https://github.com/CITGuru/PyInquirer) should be compatible with `InquirerPy`. If you have discovered more incompatible APIs, please
create an issue or directly update README via a pull request.

### EditorPrompt

`InquirerPy` does not support [editor](https://github.com/CITGuru/PyInquirer#editor---type-editor) prompt as of now.

### CheckboxPrompt

The following table contains the mapping of incompatible parameters.

| PyInquirer      | InquirerPy      |
| --------------- | --------------- |
| pointer_sign    | pointer         |
| selected_sign   | enabled_symbol  |
| unselected_sign | disabled_symbol |

### Style

Every style keys from [PyInquirer](https://github.com/CITGuru/PyInquirer) is present in `InquirerPy` except the ones in the following table.

| PyInquirer | InquirerPy |
| ---------- | ---------- |
| selected   | pointer    |

Although `InquirerPy` support all the keys from [PyInquirer](https://github.com/CITGuru/PyInquirer), the styling works slightly different.
Please refer to the [Style](https://inquirerpy.readthedocs.io/en/latest/pages/style.html) documentation for detailed information.

<!-- end migration -->

## Similar projects

### questionary

[questionary](https://github.com/tmbo/questionary) is a fantastic fork which supports `prompt_toolkit` 3.0.0+ with performance improvement and more customisation options.
It's already a well established and stable library.

Comparing with [questionary](https://github.com/tmbo/questionary), `InquirerPy` offers even more customisation options in styles, UI as well as key bindings. `InquirerPy` also provides a new
and powerful [fuzzy](https://inquirerpy.readthedocs.io/en/latest/pages/prompts/fuzzy.html) prompt.

### python-inquirer

[python-inquirer](https://github.com/magmax/python-inquirer) is another great Python port of [Inquirer.js](https://github.com/SBoudrias/Inquirer.js/). Instead of using `prompt_toolkit`, it
leverages the library `blessed` to implement the UI.

Before implementing `InquirerPy`, this library came up as an alternative. It's a more stable library comparing to the original [PyInquirer](https://github.com/CITGuru/PyInquirer), however
it has a rather limited customisation options and an older UI which did not solve the issues I was facing described in the [Motivation](#Motivation) section.

Comparing with [python-inquirer](https://github.com/magmax/python-inquirer), `InquirerPy` offers a slightly better UI,
more customisation options in key bindings and styles, providing pagination as well as more prompts.

## Credit

This project is based on the great work done by the following projects & their authors.

- [PyInquirer](https://github.com/CITGuru/PyInquirer)
- [prompt_toolkit](https://github.com/prompt-toolkit/python-prompt-toolkit)

## License

This project is licensed under [MIT](https://github.com/kazhala/InquirerPy/blob/master/LICENSE).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/brodybits/InquirerLib",
    "name": "InquirerLib",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7,<4.0",
    "maintainer_email": "",
    "keywords": "cli,prompt-toolkit,commandline,inquirer,development",
    "author": "Various",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/53/d7/0a61d5681038318b5f65441811c5d72430113b3b109ce1e9f7e662f9cb9d/inquirerlib-0.0.2.tar.gz",
    "platform": null,
    "description": "# InquirerLib\n\n<!-- TODO: UPDATED BADGES -->\n\nAn updated fork of InquirerPy - see API notice below\n\n<!-- start intro -->\n\n## Introduction\n\n`InquirerPy` is a Python port of the famous [Inquirer.js](https://github.com/SBoudrias/Inquirer.js/) (A collection of common interactive command line user interfaces).\nThis project is a re-implementation of the [PyInquirer](https://github.com/CITGuru/PyInquirer) project, with bug fixes of known issues, new prompts, backward compatible APIs\nas well as more customisation options.\n\n<!-- end intro -->\n\n![Demo](https://github.com/kazhala/gif/blob/master/InquirerPy-demo.gif)\n\n## Motivation\n\n[PyInquirer](https://github.com/CITGuru/PyInquirer) is a great Python port of [Inquirer.js](https://github.com/SBoudrias/Inquirer.js/), however, the project is slowly reaching\nto an unmaintained state with various issues left behind and no intention to implement more feature requests. I was heavily relying on this library for other projects but\ncould not proceed due to the limitations.\n\nSome noticeable ones that bother me the most:\n\n- hard limit on `prompt_toolkit` version 1.0.3\n- various color issues\n- various cursor issues\n- No options for VI/Emacs navigation key bindings\n- Pagination option doesn't work\n\nThis project uses python3.7+ type hinting with focus on resolving above issues while providing greater customisation options.\n\n## Requirements\n\n### OS\n\nLeveraging [prompt_toolkit](https://github.com/prompt-toolkit/python-prompt-toolkit), `InquirerPy` works cross platform for all OS. Although Unix platform may have a better experience than Windows.\n\n### Python\n\n```\npython >= 3.7\n```\n\n## API notice\n\nSome functions are exported directly using `from InquirerLib`; other functions and all exported objects are within `InquirerLib.InquirerPy` namespace.\n\nThe optional arguments for `prompt` and `prompt_async` are now keyword arguments, with `raise_keyboard_interrupt` (which defaults to `True`) now deprecated. Rationale is to support a possible easier prompt API in the future - see DRAFT RFC PR: <https://github.com/brodybits/InquirerLib/pull/3>\n\n**[Documentation for InquirerPy](https://inquirerpy.readthedocs.io/)** applies with these updated imports and optional arguments for `prompt` and `prompt_async` as now keyword arguments.\n\nNote that importing from `InquirerLib.InquirerPy.inquirer` is DEPRECATED, as documented below.\n\nExamples in `examples` may be helpful.\n\n## Getting Started\n\n### Install\n\n```sh\npip install InquirerLib\n```\n\n### Quick Start\n\n#### Classic Syntax (PyInquirer)\n\n```python\nfrom InquirerLib import prompt\n\nquestions = [\n    {\"type\": \"input\", \"message\": \"What's your name:\", \"name\": \"name\"},\n    {\"type\": \"confirm\", \"message\": \"Confirm?\", \"name\": \"confirm\", \"default\": True},\n]\nresult = prompt(questions)\nname = result[\"name\"]\nconfirm = result[\"confirm\"]\n```\n\nNOTE: `default` may be used for any question type.\n\n#### Alternate Syntax\n\nUsing individual constructors:\n\n```python\nfrom InquirerLib.InquirerPy import prompts\n\nname = prompts.InputPrompt(message=\"What's your name:\").execute()\nconfirm = prompts.ConfirmPrompt(message=\"Confirm?\", default=True).execute()\n```\n\nDEPRECATED API:\n\n```python\nfrom InquirerLib.InquirerPy import inquirer\n\nname = inquirer.text(message=\"What's your name:\").execute()\nconfirm = inquirer.confirm(message=\"Confirm?\", default=True).execute()\n```\n\nThese are deprecated aliases that may be removed or replaced in the future.\n\n<!-- start migration -->\n\n## Migrating from InquirerPy\n\nNeed to update the imports, as described above.\n\n## Migrating from PyInquirer\n\nMost APIs from [PyInquirer](https://github.com/CITGuru/PyInquirer) should be compatible with `InquirerPy`. If you have discovered more incompatible APIs, please\ncreate an issue or directly update README via a pull request.\n\n### EditorPrompt\n\n`InquirerPy` does not support [editor](https://github.com/CITGuru/PyInquirer#editor---type-editor) prompt as of now.\n\n### CheckboxPrompt\n\nThe following table contains the mapping of incompatible parameters.\n\n| PyInquirer      | InquirerPy      |\n| --------------- | --------------- |\n| pointer_sign    | pointer         |\n| selected_sign   | enabled_symbol  |\n| unselected_sign | disabled_symbol |\n\n### Style\n\nEvery style keys from [PyInquirer](https://github.com/CITGuru/PyInquirer) is present in `InquirerPy` except the ones in the following table.\n\n| PyInquirer | InquirerPy |\n| ---------- | ---------- |\n| selected   | pointer    |\n\nAlthough `InquirerPy` support all the keys from [PyInquirer](https://github.com/CITGuru/PyInquirer), the styling works slightly different.\nPlease refer to the [Style](https://inquirerpy.readthedocs.io/en/latest/pages/style.html) documentation for detailed information.\n\n<!-- end migration -->\n\n## Similar projects\n\n### questionary\n\n[questionary](https://github.com/tmbo/questionary) is a fantastic fork which supports `prompt_toolkit` 3.0.0+ with performance improvement and more customisation options.\nIt's already a well established and stable library.\n\nComparing with [questionary](https://github.com/tmbo/questionary), `InquirerPy` offers even more customisation options in styles, UI as well as key bindings. `InquirerPy` also provides a new\nand powerful [fuzzy](https://inquirerpy.readthedocs.io/en/latest/pages/prompts/fuzzy.html) prompt.\n\n### python-inquirer\n\n[python-inquirer](https://github.com/magmax/python-inquirer) is another great Python port of [Inquirer.js](https://github.com/SBoudrias/Inquirer.js/). Instead of using `prompt_toolkit`, it\nleverages the library `blessed` to implement the UI.\n\nBefore implementing `InquirerPy`, this library came up as an alternative. It's a more stable library comparing to the original [PyInquirer](https://github.com/CITGuru/PyInquirer), however\nit has a rather limited customisation options and an older UI which did not solve the issues I was facing described in the [Motivation](#Motivation) section.\n\nComparing with [python-inquirer](https://github.com/magmax/python-inquirer), `InquirerPy` offers a slightly better UI,\nmore customisation options in key bindings and styles, providing pagination as well as more prompts.\n\n## Credit\n\nThis project is based on the great work done by the following projects & their authors.\n\n- [PyInquirer](https://github.com/CITGuru/PyInquirer)\n- [prompt_toolkit](https://github.com/prompt-toolkit/python-prompt-toolkit)\n\n## License\n\nThis project is licensed under [MIT](https://github.com/kazhala/InquirerPy/blob/master/LICENSE).\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "An updated fork of InquirerPy - Python port of Inquirer.js (A collection of common interactive command-line user interfaces)",
    "version": "0.0.2",
    "project_urls": {
        "Homepage": "https://github.com/brodybits/InquirerLib",
        "Repository": "https://github.com/brodybits/InquirerLib"
    },
    "split_keywords": [
        "cli",
        "prompt-toolkit",
        "commandline",
        "inquirer",
        "development"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "54cc59dfecff66ff9dd3ff2abccee0b0102823aefcadab3178ecc23b205b265a",
                "md5": "ecd433f97b61d87211f1405fca3289b0",
                "sha256": "fbdb85601ecc384180a6321bf5154d4fa4b9d0366216bcad05179c292d4746bf"
            },
            "downloads": -1,
            "filename": "inquirerlib-0.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ecd433f97b61d87211f1405fca3289b0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7,<4.0",
            "size": 69293,
            "upload_time": "2024-01-28T19:17:35",
            "upload_time_iso_8601": "2024-01-28T19:17:35.069372Z",
            "url": "https://files.pythonhosted.org/packages/54/cc/59dfecff66ff9dd3ff2abccee0b0102823aefcadab3178ecc23b205b265a/inquirerlib-0.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "53d70a61d5681038318b5f65441811c5d72430113b3b109ce1e9f7e662f9cb9d",
                "md5": "be148324be6a21f8b237b4db9c4d39c0",
                "sha256": "c04e7a47e4fe4ee670a52bfe66295f09dc418026b27d694eda791e9183e78492"
            },
            "downloads": -1,
            "filename": "inquirerlib-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "be148324be6a21f8b237b4db9c4d39c0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7,<4.0",
            "size": 44594,
            "upload_time": "2024-01-28T19:17:36",
            "upload_time_iso_8601": "2024-01-28T19:17:36.794639Z",
            "url": "https://files.pythonhosted.org/packages/53/d7/0a61d5681038318b5f65441811c5d72430113b3b109ce1e9f7e662f9cb9d/inquirerlib-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-28 19:17:36",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "brodybits",
    "github_project": "InquirerLib",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "inquirerlib"
}
        
Elapsed time: 2.47509s