{"id":31065797,"url":"https://github.com/henriqueslab/ezinput","last_synced_at":"2025-09-15T16:57:27.317Z","repository":{"id":284332760,"uuid":"927757641","full_name":"HenriquesLab/EZInput","owner":"HenriquesLab","description":"EZInput is a Python library that simplifies the creation of graphical user interfaces (GUIs) both in the terminal and in Jupyter notebooks. It provides a convenient way to add various types of widgets, making it easier to interact with your code and visualize results.","archived":false,"fork":false,"pushed_at":"2025-06-21T09:05:37.000Z","size":106,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-21T09:28:54.734Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://henriqueslab.github.io/EZInput/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HenriquesLab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-02-05T13:51:31.000Z","updated_at":"2025-06-21T09:05:40.000Z","dependencies_parsed_at":"2025-06-21T09:23:39.207Z","dependency_job_id":"61962148-9d89-45dc-8b90-b607f0526885","html_url":"https://github.com/HenriquesLab/EZInput","commit_stats":null,"previous_names":["henriqueslab/ezinput"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/HenriquesLab/EZInput","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HenriquesLab%2FEZInput","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HenriquesLab%2FEZInput/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HenriquesLab%2FEZInput/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HenriquesLab%2FEZInput/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HenriquesLab","download_url":"https://codeload.github.com/HenriquesLab/EZInput/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HenriquesLab%2FEZInput/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275289703,"owners_count":25438494,"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","status":"online","status_checked_at":"2025-09-15T02:00:09.272Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-09-15T16:57:25.525Z","updated_at":"2025-09-15T16:57:27.306Z","avatar_url":"https://github.com/HenriquesLab.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EZInput\n\n[![PyPI](https://img.shields.io/pypi/v/ezinput.svg?color=green)](https://pypi.org/project/ezinput)\n[![Python Version](https://img.shields.io/pypi/pyversions/ezinput.svg?color=green)](https://python.org)\n[![Downloads](https://img.shields.io/pypi/dm/ezinput)](https://pypi.org/project/ezinput)\n[![Docs](https://img.shields.io/badge/documentation-link-blueviolet)](https://henriqueslab.github.io/EZInput/ezinput.html)\n[![License](https://img.shields.io/github/license/HenriquesLab/EZInput?color=Green)](https://github.com/HenriquesLab/EZInput/blob/main/LICENSE.txt)\n[![Tests](https://github.com/HenriquesLab/EZInput/actions/workflows/oncall_test.yml/badge.svg)](https://github.com/HenriquesLab/EZInput/actions/workflows/oncall_test.yml.yml)\n[![Coverage](https://img.shields.io/codecov/c/github/HenriquesLab/EZInput.svg?branch=main)](https://img.shields.io/codecov/c/github/HenriquesLab/EZInput?branch=main)\n[![Contributors](https://img.shields.io/github/contributors-anon/HenriquesLab/EZInput)](https://github.com/HenriquesLab/EZInput/graphs/contributors)\n[![GitHub stars](https://img.shields.io/github/stars/HenriquesLab/EZInput?style=social)](https://github.com/HenriquesLab/EZInput/)\n[![GitHub forks](https://img.shields.io/github/forks/HenriquesLab/EZInput?style=social)](https://github.com/HenriquesLab/EZInput/)\n[![DOI](https://img.shields.io/badge/Publication-Soon-purple)]()\n\nEZInput is a Python library that simplifies the creation of user interfaces both in the terminal and in Jupyter notebooks. It provides a convenient way to add various types of widgets, making it easier to interact with your code and visualize results.  \n\nDISCLAIMER: the project is currently in alpha stage and will likely suffer changes in the API and functionality.\n\n## Installation\n\nTo install EZInput, you can use pip:\n\n```bash\npip install ezinput\n```\n\n## Usage\n\nEZInput provides a unified interface for creating UIs in either the terminal or Jupyter notebooks. The mode is automatically determined based on the environment.\n\n### Terminal Mode\n\nTo create a GUI in the terminal using `prompt_toolkit`:\n\n```python\nfrom ezinput import EZInput\n\ngui = EZInput(title=\"My Terminal GUI\")\n\n# Add GUI elements\ngui.add_check(\"confirm\", \"Do you want to proceed?\", remember_value=True)\ngui.add_text(\"name\", \"Enter your name:\", placeholder=\"John Doe\", remember_value=True)\ngui.add_int_range(\"age\", \"Enter your age:\", 18, 100, remember_value=True)\ngui.add_float_range(\"height\", \"Enter your height (in meters):\", 1.0, 2.5, remember_value=True)\ngui.add_dropdown(\"color\", [\"Red\", \"Blue\", \"Green\"], \"Choose your favorite color:\", remember_value=True)\ngui.add_path_completer(\"file_path\", \"Enter a file path:\", remember_value=True)\n\n# Save settings\ngui.save_settings()\n\n# Restore default settings\ngui.restore_default_settings()\n```\n\n### Jupyter Notebook Mode\n\nTo create a GUI in Jupyter notebooks using `ipywidgets`:\n\n```python\nfrom ezinput import EZInput\n\ngui = EZInput(title=\"My Jupyter GUI\")\n\n# Add GUI elements\ngui.add_text(\"text\", description=\"Enter some text:\", placeholder=\"Hello, world!\", remember_value=True)\ngui.add_int_range(\"int_slider\", description=\"Choose a number:\", vmin=0, vmax=10, remember_value=True)\ngui.add_float_range(\"float_slider\", description=\"Choose a decimal:\", vmin=0.0, vmax=1.0, remember_value=True)\ngui.add_check(\"checkbox\", description=\"Check this box:\", remember_value=True)\ngui.add_dropdown(\"dropdown\", options=[\"Option 1\", \"Option 2\", \"Option 3\"], description=\"Choose an option:\", remember_value=True)\ngui.add_file_upload(\"file_upload\", accept=\".txt\", multiple=False)\n\n# Display the GUI\ngui.show()\n\n# Save settings\ngui.save_settings()\n```\n\n### Unified API\n\nEZInput provides a unified API for both terminal and Jupyter notebook modes. The following methods are available:\n\n- **`add_label(tag, label)`**: Add a label to the GUI.\n- **`add_text(tag, description, placeholder=\"\", remember_value=False)`**: Add a text input field.\n- **`add_text_area(tag, description, placeholder=\"\", remember_value=False)`**: Add a multi-line text area.\n- **`add_int_range(tag, description, vmin, vmax, remember_value=False)`**: Add an integer slider or range input.\n- **`add_float_range(tag, description, vmin, vmax, remember_value=False)`**: Add a float slider or range input.\n- **`add_check(tag, description, remember_value=False)`**: Add a yes/no or checkbox input.\n- **`add_dropdown(tag, options, description=\"\", remember_value=False)`**: Add a dropdown menu.\n- **`add_callback(tag, func, values, description=\"Run\")`**: Add a function to be ran (if in jupyter, after the press of the generated button) that triggers a callback function.\n\n## Recent Changes\n\n- All widget-adding methods now use the `style` from `kwargs` if provided, otherwise default to `self._style`.\n- `add_custom_widget` now accepts either a widget class (which will be instantiated with `*args` and `**kwargs`) or a widget instance.\n\n## Example: Using Custom Styles\n\n```python\nimport ipywidgets as widgets\nfrom ezinput.ezinput_jupyter import EZInputJupyter\n\ngui = EZInputJupyter()\ngui.add_text('name', description='Name:', style={'description_width': 'initial'})\n```\n\n## Example: Adding a Custom Widget\n\n```python\n# Pass a widget class (with args/kwargs)\ngui.add_custom_widget('slider', widgets.IntSlider, min=0, max=10, value=5)\n\n# Or pass an already-instantiated widget\ndropdown = widgets.Dropdown(options=['A', 'B', 'C'], value='A')\ngui.add_custom_widget('dropdown', dropdown)\n```\n\n### Saving and Restoring Settings\n\nEZInput allows you to save and restore widget values using configuration files:\n\n```python\n# Save current settings\ngui.save_settings()\n\n# Restore default settings\ngui.restore_default_settings()\n```\n\n### Examples\n\n#### Terminal Example\n\n```python\nfrom ezinput import EZInput\n\ngui = EZInput(title=\"Terminal Example\")\ngui.add_text(\"username\", \"Enter your username:\", remember_value=True)\ngui.add_int_range(\"age\", \"Enter your age:\", 18, 100, remember_value=True)\ngui.save_settings()\n```\n\n#### Jupyter Notebook Example\n\n```python\nfrom ezinput import EZInput\n\ngui = EZInput(title=\"Jupyter Example\")\ngui.add_text(\"username\", description=\"Enter your username:\", remember_value=True)\ngui.add_int_range(\"age\", description=\"Enter your age:\", vmin=18, vmax=100, remember_value=True)\ngui.show()\n```\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE.txt) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhenriqueslab%2Fezinput","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhenriqueslab%2Fezinput","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhenriqueslab%2Fezinput/lists"}