Name | listpicker JSON |
Version |
0.3.1
JSON |
| download |
home_page | None |
Summary | Interactive list selection and multiselect for POSIX terminals (non-curses) |
upload_time | 2024-05-12 17:48:10 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.10 |
license | The MIT License (MIT) Copyright © 2024 Sung Pae <self@sungpae.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
list selection
multiple select
multiselect
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
python-listpicker
=================
Interactive list selection for POSIX terminals.
```python
pip install listpicker
```
Python 3.10+
Features
--------
- Single and multiple selection from a sequence of strings
- Interactive substring filtering
- Paging for long lists
- Common navigation keybindings (vi, emacs, arrow keys, Home/End, etc)
- Direct terminal manipulation with CSI commands (i.e. no curses)
- Draw to main screen buffer without clearing the screen
- Proper truncation of long lines with SGR color sequences
- Redraw on terminal resize (SIGWINCH)
- Help menu and multiselect confirmation prompt
- Preselected options in multiselect prompts
Screenshots
-----------





Examples
--------
### Basic usage
```python
import listpicker
pizza_styles = ("Thin crust", "Stuffed crust", "Deep dish")
style = listpicker.pick("Choose pizza style:", pizza_styles)
# User can abort input, so handle the case where "pick()" returns "None"
if style is None:
style = pizza_styles[0]
pizza_toppings = ("Pepperoni", "Sausage", "Mushroom", "Pineapple")
toppings = listpicker.pick_multiple("Choose toppings:", pizza_toppings)
```
### Typical usage with dictionary
```python
import dataclasses
import listpicker
@dataclasses.dataclass
class Book:
isbn: str
title: str
authors: list[str]
publication_year: int
books = [
Book(
"0201038013",
"The Art of Computer Programming, Volume 1: Fundamental Algorithms",
["Knuth, Donald"],
1968,
),
Book(
"0262010771",
"Structure and Interpretation of Computer Programs",
["Harold Abelson", "Gerald Jay Sussman", "Julie Sussman"],
1984,
),
Book(
"032163537X",
"Elements of Programming",
["Stepanov, Alexander A.", "McJones, Paul"],
2009,
),
]
options = {f"{b.title} ({b.publication_year})": b for b in books}
choice = listpicker.pick("Pick a book:", list(options.keys()))
# Pick a book:
# (filter with f, submit with Enter, F1 for keybindings)
# > 1. The Art of Computer Programming, Volume 1: Fundamental Algorithms (1968)
# 2. Structure and Interpretation of Computer Programs (1984)
# 3. Elements of Programming (2009)
if choice:
book = options[choice]
```
Raw data
{
"_id": null,
"home_page": null,
"name": "listpicker",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "list selection, multiple select, multiselect",
"author": null,
"author_email": "Sung Pae <self@sungpae.com>",
"download_url": "https://files.pythonhosted.org/packages/b1/ba/5bb3b28c6e688f475b0f23e0ef2c704e6ea96fa49b2d0df1cd64cfd9e8da/listpicker-0.3.1.tar.gz",
"platform": null,
"description": "python-listpicker\n=================\n\nInteractive list selection for POSIX terminals.\n\n```python\npip install listpicker\n```\n\nPython 3.10+\n\nFeatures\n--------\n\n- Single and multiple selection from a sequence of strings\n- Interactive substring filtering\n- Paging for long lists\n- Common navigation keybindings (vi, emacs, arrow keys, Home/End, etc)\n- Direct terminal manipulation with CSI commands (i.e. no curses)\n- Draw to main screen buffer without clearing the screen\n- Proper truncation of long lines with SGR color sequences\n- Redraw on terminal resize (SIGWINCH)\n- Help menu and multiselect confirmation prompt\n- Preselected options in multiselect prompts\n\nScreenshots\n-----------\n\n\n\n\n\n\n\nExamples\n--------\n\n### Basic usage\n\n```python\nimport listpicker\n\npizza_styles = (\"Thin crust\", \"Stuffed crust\", \"Deep dish\")\nstyle = listpicker.pick(\"Choose pizza style:\", pizza_styles)\n\n# User can abort input, so handle the case where \"pick()\" returns \"None\"\nif style is None:\n style = pizza_styles[0]\n\npizza_toppings = (\"Pepperoni\", \"Sausage\", \"Mushroom\", \"Pineapple\")\ntoppings = listpicker.pick_multiple(\"Choose toppings:\", pizza_toppings)\n```\n\n### Typical usage with dictionary\n\n```python\nimport dataclasses\n\nimport listpicker\n\n\n@dataclasses.dataclass\nclass Book:\n isbn: str\n title: str\n authors: list[str]\n publication_year: int\n\n\nbooks = [\n Book(\n \"0201038013\",\n \"The Art of Computer Programming, Volume 1: Fundamental Algorithms\",\n [\"Knuth, Donald\"],\n 1968,\n ),\n Book(\n \"0262010771\",\n \"Structure and Interpretation of Computer Programs\",\n [\"Harold Abelson\", \"Gerald Jay Sussman\", \"Julie Sussman\"],\n 1984,\n ),\n Book(\n \"032163537X\",\n \"Elements of Programming\",\n [\"Stepanov, Alexander A.\", \"McJones, Paul\"],\n 2009,\n ),\n]\n\noptions = {f\"{b.title} ({b.publication_year})\": b for b in books}\nchoice = listpicker.pick(\"Pick a book:\", list(options.keys()))\n\n# Pick a book:\n# (filter with f, submit with Enter, F1 for keybindings)\n# > 1. The Art of Computer Programming, Volume 1: Fundamental Algorithms (1968)\n# 2. Structure and Interpretation of Computer Programs (1984)\n# 3. Elements of Programming (2009)\n\nif choice:\n book = options[choice]\n```\n",
"bugtrack_url": null,
"license": "The MIT License (MIT) Copyright \u00a9 2024 Sung Pae <self@sungpae.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
"summary": "Interactive list selection and multiselect for POSIX terminals (non-curses)",
"version": "0.3.1",
"project_urls": {
"Homepage": "https://github.com/guns/python-listpicker",
"Repository": "https://github.com/guns/python-listpicker.git"
},
"split_keywords": [
"list selection",
" multiple select",
" multiselect"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6be97d83f00950a997d4cbd81dbd1b3be21ac06fcd3d628667fd21e41bd73bb2",
"md5": "0f101a015aff323a1013e07ba835473d",
"sha256": "190ce206fa941c68aa3f3cd52afd345e0b912eebb17992ba083b22af767b39c9"
},
"downloads": -1,
"filename": "listpicker-0.3.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0f101a015aff323a1013e07ba835473d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 14612,
"upload_time": "2024-05-12T17:48:08",
"upload_time_iso_8601": "2024-05-12T17:48:08.927243Z",
"url": "https://files.pythonhosted.org/packages/6b/e9/7d83f00950a997d4cbd81dbd1b3be21ac06fcd3d628667fd21e41bd73bb2/listpicker-0.3.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b1ba5bb3b28c6e688f475b0f23e0ef2c704e6ea96fa49b2d0df1cd64cfd9e8da",
"md5": "33e011c8e7d72feee8d0be82e671c3dd",
"sha256": "b42381feafbc399eca4c1dd8335e51cf9af81b3397edaa1a51b9f911a5ffc353"
},
"downloads": -1,
"filename": "listpicker-0.3.1.tar.gz",
"has_sig": false,
"md5_digest": "33e011c8e7d72feee8d0be82e671c3dd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 10750,
"upload_time": "2024-05-12T17:48:10",
"upload_time_iso_8601": "2024-05-12T17:48:10.077373Z",
"url": "https://files.pythonhosted.org/packages/b1/ba/5bb3b28c6e688f475b0f23e0ef2c704e6ea96fa49b2d0df1cd64cfd9e8da/listpicker-0.3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-12 17:48:10",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "guns",
"github_project": "python-listpicker",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "listpicker"
}