# groupick
[![image](https://github.com/anafvana/groupick/actions/workflows/ci.yml/badge.svg)](https://github.com/anafvana/groupick/actions/workflows/ci.yml)
[![PyPI](https://img.shields.io/pypi/v/groupick.svg)](https://pypi.org/project/groupick/)
[![PyPI](https://img.shields.io/pypi/dm/groupick)](https://pypi.org/project/groupick/)
**groupick** is a small python library based on [wong2's pick](https://github.com/wong2/pick) which allows you to create a curses-based interactive selection in the terminal. With **groupick** you can assign options to groups.
![](example/basic.gif)
## Installation
$ pip install groupick
## Usage
**groupick** comes with a simple api:
>>> from groupick import groupick
>>> instructions = "Assign languages to groups 'a', 'b' or '1'."
>>> options = ["Java", "JavaScript", "Python", "PHP", "C++", "Erlang", "Haskell"]
>>> groups:set = {"a", "b", 1}
>>> selected = groupick(options, groups, instructions, indicator="=>", default_index=2)
>>> print(f"Here is your assignment: {selected}")
**output**:
>>> {'1': [], 'a': [("JavaScript", 1)], 'b': []}
## Options
- `options`: a list of options to choose from
- `groups`: a list of ints and/or characters symbolising groups (max-length per item is 1)
- `instructions`: (optional) a title above options list
- `indicator`: (optional) custom the selection indicator, defaults to `*`
- `default_index`: (optional) index of item where cursor starts at by default
- `handle_all`: (optional) define whether it is mandatory to assign all options to groups, defaults to `False`
- `screen`: (optional), if you are using `groupick` within an existing curses application, pass your existing `screen` object. It is assumed this has initialised in the standard way (e.g. via `curses.wrapper()`, or `curses.noecho(); curses.cbreak(); screen.kepad(True)`)
## Community Projects
[wong2's pick](https://github.com/wong2/pick): Original pick project, for selecting one or more options (no grouping)
[pickpack](https://github.com/anafvana/pickpack): A fork of [`pick`](https://github.com/wong2/pick) to select tree data.
Raw data
{
"_id": null,
"home_page": "https://github.com/anafvana/groupick/",
"name": "groupick",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "",
"keywords": "terminal,gui,pick,group,assign",
"author": "Ana",
"author_email": "anafvana@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/cf/90/bea0097d3a24d26b92fa1666b56a6831715caea8a6b680caa9060631173a/groupick-1.1.2.tar.gz",
"platform": null,
"description": "# groupick\n\n[![image](https://github.com/anafvana/groupick/actions/workflows/ci.yml/badge.svg)](https://github.com/anafvana/groupick/actions/workflows/ci.yml)\n[![PyPI](https://img.shields.io/pypi/v/groupick.svg)](https://pypi.org/project/groupick/)\n[![PyPI](https://img.shields.io/pypi/dm/groupick)](https://pypi.org/project/groupick/)\n\n**groupick** is a small python library based on [wong2's pick](https://github.com/wong2/pick) which allows you to create a curses-based interactive selection in the terminal. With **groupick** you can assign options to groups.\n\n![](example/basic.gif)\n\n## Installation\n\n $ pip install groupick\n\n## Usage\n\n**groupick** comes with a simple api:\n\n >>> from groupick import groupick\n\n >>> instructions = \"Assign languages to groups 'a', 'b' or '1'.\"\n >>> options = [\"Java\", \"JavaScript\", \"Python\", \"PHP\", \"C++\", \"Erlang\", \"Haskell\"]\n >>> groups:set = {\"a\", \"b\", 1}\n >>> selected = groupick(options, groups, instructions, indicator=\"=>\", default_index=2)\n >>> print(f\"Here is your assignment: {selected}\")\n\n**output**:\n\n >>> {'1': [], 'a': [(\"JavaScript\", 1)], 'b': []}\n\n## Options\n\n- `options`: a list of options to choose from\n- `groups`: a list of ints and/or characters symbolising groups (max-length per item is 1)\n- `instructions`: (optional) a title above options list\n- `indicator`: (optional) custom the selection indicator, defaults to `*`\n- `default_index`: (optional) index of item where cursor starts at by default\n- `handle_all`: (optional) define whether it is mandatory to assign all options to groups, defaults to `False`\n- `screen`: (optional), if you are using `groupick` within an existing curses application, pass your existing `screen` object. It is assumed this has initialised in the standard way (e.g. via `curses.wrapper()`, or `curses.noecho(); curses.cbreak(); screen.kepad(True)`)\n\n## Community Projects\n\n[wong2's pick](https://github.com/wong2/pick): Original pick project, for selecting one or more options (no grouping)\n\n[pickpack](https://github.com/anafvana/pickpack): A fork of [`pick`](https://github.com/wong2/pick) to select tree data.\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Assign options to groups in the terminal with a simple GUI. Based on wong2's pick",
"version": "1.1.2",
"split_keywords": [
"terminal",
"gui",
"pick",
"group",
"assign"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c2e3c5ca05c8f85390b8d1ff7cb85752c10fe1aed77f1788eda162e0ba5917dc",
"md5": "7ce8598559cf7ca27f028e77892fac5d",
"sha256": "b262019d75f12ef4789ff4033effeb7b63f649c302505dbb46de94a4bfd1a661"
},
"downloads": -1,
"filename": "groupick-1.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7ce8598559cf7ca27f028e77892fac5d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 5186,
"upload_time": "2023-04-03T21:23:14",
"upload_time_iso_8601": "2023-04-03T21:23:14.626391Z",
"url": "https://files.pythonhosted.org/packages/c2/e3/c5ca05c8f85390b8d1ff7cb85752c10fe1aed77f1788eda162e0ba5917dc/groupick-1.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "cf90bea0097d3a24d26b92fa1666b56a6831715caea8a6b680caa9060631173a",
"md5": "fb09303e595b17100a835bffde54b378",
"sha256": "7d781f2a2a74f6b95b41fe46032f019849d7a56b65af59fb0efd060f5500821f"
},
"downloads": -1,
"filename": "groupick-1.1.2.tar.gz",
"has_sig": false,
"md5_digest": "fb09303e595b17100a835bffde54b378",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 4730,
"upload_time": "2023-04-03T21:23:15",
"upload_time_iso_8601": "2023-04-03T21:23:15.887131Z",
"url": "https://files.pythonhosted.org/packages/cf/90/bea0097d3a24d26b92fa1666b56a6831715caea8a6b680caa9060631173a/groupick-1.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-03 21:23:15",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "anafvana",
"github_project": "groupick",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "groupick"
}