{"id":21518144,"url":"https://github.com/gikeymarcia/pydymenu","last_synced_at":"2025-04-09T21:44:45.560Z","repository":{"id":62580050,"uuid":"375442979","full_name":"gikeymarcia/pydymenu","owner":"gikeymarcia","description":"Python wrapper for `fzf` `and `rofi`. All of your dynamic menu-ing needs in one place.","archived":false,"fork":false,"pushed_at":"2023-03-09T20:05:46.000Z","size":104,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-23T23:36:01.979Z","etag":null,"topics":["dynamic-menu","fzf","linux","python","rofi","scripting"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/pydymenu/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gikeymarcia.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-09T17:47:45.000Z","updated_at":"2025-01-03T11:35:52.000Z","dependencies_parsed_at":"2022-11-03T21:00:54.406Z","dependency_job_id":null,"html_url":"https://github.com/gikeymarcia/pydymenu","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gikeymarcia%2Fpydymenu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gikeymarcia%2Fpydymenu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gikeymarcia%2Fpydymenu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gikeymarcia%2Fpydymenu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gikeymarcia","download_url":"https://codeload.github.com/gikeymarcia/pydymenu/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248119424,"owners_count":21050754,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dynamic-menu","fzf","linux","python","rofi","scripting"],"created_at":"2024-11-24T00:50:16.354Z","updated_at":"2025-04-09T21:44:45.532Z","avatar_url":"https://github.com/gikeymarcia.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pydymenu: A Pythonic interface for `fzf` and `rofi`\n\nA single package to serve all your dynamic menu-ing needs with a simple Pythonic\ninterface.\n\n## Installation\n\n### Dependencies\n\n```bash\nsudo apt install fzf rofi -y\n```\n\n### From [PyPi][pypi]\n\n```bash\npip3 install pydymenu\n# upgrade to newest release (if previously installed)\npip3 install -U pydymenu\n```\n\n## Demonstration\n\nTo see each finder in action and get a sample code snippet to get you started\ntry the command-line interface.\n\n```bash\npython3 -m pydymenu --fzf\npython3 -m pydymenu --rofi\n```\n\n## Basic Usage\n\nTo begin, use `fzf` to pick an item from a list.\n\n```python\nimport pydymenu\n\nwith_a_list = [\"apples\", \"grapes\", \"bananas\", \"pears\", \"strawberries\"]\nchoice = pydymenu.fzf(with_a_list, prompt=\"Which fruit? \")\nprint(f\"Enjoy your {choice[0]}\")\n# if you wanted to use rofi instead\nchoice = pydymenu.rofi(with_a_list, prompt=\"Which fruit? \")\n```\n\nMy favorite way to use this tool is with a dictionary of values. Python makes it\neasy to select from a list of human-readable names but retrieve programming\nrelated values like lambda, lists, or dictionaries, or even your own custom\nobjects!\n\n```python\nimport pydymenu\n\nfrom_dict = {\n    \"Coder\": {\"First\": \"Mikey\", \"Last\": \"Garcia\", \"alignment\": \"chaotic good\"},\n    \"square()\": lambda x: x*x,\n    \"List of fruits\": [\"apples\", \"grapes\", \"bananas\", \"pears\", \"strawberries\"],\n    \"rofi selector\": pydymenu.rofi,\n    \"fzf selector\": pydymenu.fzf,\n}\nchoice = pydymenu.fzf(from_dict, prompt=\"Which option? \")\nif choice:\n    value = from_dict[choice[0]]\n    print(f\"{choice[0]}: {value}\")\nelse:\n    print(\"No selection made.\")\n\n```\n\n### `pydymenu.MENU(items: Iterable[str], **options) -\u003e Optional[List[str]]`\n\n### Parameters\n\n`items: Iterable[str]` (_required_)\n: The only required argument is an iterable of objects that can be cast to `str`\n: If `items` is a [generator][gen] each option will display as it is yielded\n\n`prompt: str`\n: The prompt text shown at the selection _(default: ` \u003e `)_\n\n`multi: bool`\n: Whether or not to allow multiple selections. _(default: `multi=False`)_\n\n`case_sensitive: bool`\n: Whether or not to use case sensitive search _(default: `case_sensitive=False`)_\n\n`preview: str` **(fzf only)**\n: Command that will be run on each entry and displayed as it's preview when\nusing the fuzzy finder. [Read more in the fzf documentation][prev docs]\n\n### Return Value\n\nAs soon as a selection is made the finder closes and returns the result as a\n`list[str]`. If no selection is made and/or the selection is cancelled `None` is\nreturned. This return signature allows for the following nice pythonic use case.\n\n```python\nimport pydymenu\n\nselection = pydymenu.fzf(items)\nif selection:\n    print(selection[0])\nelse:\n    print('No selection made.')\n```\n\n## Development\n\nTo get started with development:\n\n- clone the repository\n- install development dependencies\n- `source ./tools.sh`\n\nSee my [Super Python Project Template][template] on GitHub to learn more about\nthe automated features of this development environment. Clone the repo to get\nyour own Python projects up and running quickly!\n\n### Source of Truth\n\nThis project is available on [GitHub][github] and [GitLab][gitlab]. Each push to\n`master` automatically goes to both so choose whichever platform you prefer. All\nreleases are uploaded to [PyPi][pypi].\n\nBig thanks to [fzf][fzf] and [Rofi][rofi] developers for making the utilities\nthis tool relies upon.\n\n[prev docs]: \u003chttps://github.com/junegunn/fzf#preview-window\u003e\n\"fzf on GitHub: preview window\"\n[fzf]: \u003chttps://github.com/junegunn/fzf\u003e\n\"junegunn/fzf: A command-line fuzzy finder\"\n[rofi]: \u003chttps://github.com/davatorium/rofi\u003e\n\"Rofi: A window switcher, application launcher, and dmenu replacement\"\n[github]: \u003chttps://github.com/gikeymarcia/pydymenu\u003e\n\"gikeymarcia/pydymenu @ GitHub: All your dynamic menu-ing needs in one place\"\n[gitlab]: \u003chttps://gitlab.com/gikeymarcia/pydymenu\u003e\n\"gikeymarcia/pydymenu @ GitLab: All your dynamic menu-ing needs in one place\"\n[pypi]: \u003chttps://pypi.org/project/pydymenu/\u003e\n\"A pythonic wrapper interface for fzf and Rofi.\"\n[iterfzf]: \u003chttps://github.com/dahlia/iterfzf\u003e\n\"dahlia/iterfzf: Pythonic interface to fzf, a CLI fuzzy finder\"\n[gen]: \u003chttps://realpython.com/introduction-to-python-generators/\u003e\n\"Real Python: How to use generators and yield in Python\"\n[template]: \u003chttps://github.com/gikeymarcia/super-python-project-template\u003e\n\"Super Python Project Template @ GitHub\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgikeymarcia%2Fpydymenu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgikeymarcia%2Fpydymenu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgikeymarcia%2Fpydymenu/lists"}