{"id":21127010,"url":"https://github.com/pyrustic/suggestion","last_synced_at":"2025-06-12T05:07:29.953Z","repository":{"id":57472224,"uuid":"382890162","full_name":"pyrustic/suggestion","owner":"pyrustic","description":"Democratizing auto-complete(suggest) for Python desktop applications","archived":false,"fork":false,"pushed_at":"2023-02-25T01:56:16.000Z","size":41,"stargazers_count":7,"open_issues_count":3,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-02T03:43:31.053Z","etag":null,"topics":["auto-complete","auto-suggest","autocomplete","desktop-application","gui","libary","lightweight","liteweight","pyrustic","python","tkinter"],"latest_commit_sha":null,"homepage":"https://pyrustic.github.io","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/pyrustic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2021-07-04T15:49:20.000Z","updated_at":"2023-12-01T07:35:39.000Z","dependencies_parsed_at":"2024-11-20T06:15:13.296Z","dependency_job_id":null,"html_url":"https://github.com/pyrustic/suggestion","commit_stats":{"total_commits":9,"total_committers":1,"mean_commits":9.0,"dds":0.0,"last_synced_commit":"6003b00c93152762ec8500092a2a67e33399676c"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/pyrustic/suggestion","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyrustic%2Fsuggestion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyrustic%2Fsuggestion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyrustic%2Fsuggestion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyrustic%2Fsuggestion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pyrustic","download_url":"https://codeload.github.com/pyrustic/suggestion/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyrustic%2Fsuggestion/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259402056,"owners_count":22851870,"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":["auto-complete","auto-suggest","autocomplete","desktop-application","gui","libary","lightweight","liteweight","pyrustic","python","tkinter"],"created_at":"2024-11-20T04:46:15.093Z","updated_at":"2025-06-12T05:07:29.928Z","avatar_url":"https://github.com/pyrustic.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Suggestion\n`Suggestion` is a `Python` library for democratizing auto-complete(suggest) in desktop applications. It's part of the [Pyrustic Open Ecosystem](https://pyrustic.github.io).\n\n[Installation](#installation) | [Reference](https://github.com/pyrustic/suggestion/tree/master/docs/reference#readme)\n\n## Overview\nAuto-complete(suggest) is a feature available in smartphone keyboards, browser search bars, and IDEs, so why not in your app too ?\n\n`Suggestion` is the library you need to power your applications with auto-complete or auto-suggest feature.\n\nThis [article](https://uxmag.com/articles/designing-search-as-you-type-suggestions) shows the difference between auto-suggest and auto-complete.\n\nLet's discover how to use `Suggestion`:\n\n```python\nimport tkinter as tk\nfrom suggestion import Suggestion\n\n\n# the dataset\nDATASET = [\"friend\", \"family\", \"my\", \"monster\"]\n\n# root\nroot = tk.Tk()\nroot.title(\"Suggestion demo | built with Pyrustic\")\n\n# text field (it works with tk.Entry too !)\ntext_field = tk.Text(root)\ntext_field.pack()\n\n# Suggestion\nsuggestion = Suggestion(text_field, dataset=DATASET)\n\n# lift off !\nroot.mainloop()\n\n\n```\n\nThis is what it looks like when you run the code:\n\n\u003c!-- Image --\u003e\n\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/pyrustic/misc/master/media/suggestion-demo-1.gif\" alt=\"Figure\" width=\"600\"\u003e\n    \u003cp align=\"center\"\u003e\n    \u003ci\u003e Figure 1 \u003c/i\u003e\n    \u003c/p\u003e\n\u003c/div\u003e\n\nDid my ridiculous dataset make you smile ? It's not realistic, right ? I agree.\n\nOk, let's download a [list](https://github.com/dwyl/english-words/blob/master/words_alpha.txt) of 370K english words from [https://github.com/dwyl/english-words](https://github.com/dwyl/english-words).\n\n```python\nimport tkinter as tk\nfrom suggestion import Suggestion\n\n# the dataset\nDATASET = \"/home/alex/words_alpha.txt\"\n\n# root\nroot = tk.Tk()\nroot.title(\"Suggestion demo | built with Pyrustic\")\n\n# text field (it works with tk.Entry too!)\ntext_field = tk.Text(root)\ntext_field.pack()\n\n# Suggestion\nsuggestion = Suggestion(text_field, dataset=DATASET)\n\n# lift off !\nroot.mainloop()\n\n```\n\nWatch how smooth it is:\n\n\u003c!-- Image --\u003e\n\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/pyrustic/misc/master/media/suggestion-demo-2.gif\" alt=\"Figure\" width=\"600\"\u003e\n    \u003cp align=\"center\"\u003e\n    \u003ci\u003e Figure 2 \u003c/i\u003e\n    \u003c/p\u003e\n\u003c/div\u003e\n\nI can type faster, duh !\n\n\u003c!-- Image --\u003e\n\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/pyrustic/misc/master/media/suggestion-demo-3.gif\" alt=\"Figure\" width=\"600\"\u003e\n    \u003cp align=\"center\"\u003e\n    \u003ci\u003e Figure 3 \u003c/i\u003e\n    \u003c/p\u003e\n\u003c/div\u003e\n\n\n\nWhat if I told you that so far you've only seen the default configuration/behavior of `Suggestion` ?\n\n\nThere are 3 main parts in `Suggestion`:\n- the `dataset`: by default it is a sequence of words. You can set any data type you want if you have a custom `engine` that knows how to use the dataset.\n- the `engine`: by default it is a basic algorithm which compares the words you type with the words of the dataset (provided that the dataset is a list of words). You can set your own engine and define your own type of dataset.\n- the `dropdown`: by default this is a simple tk.Listbox in a headless window that displays the suggested words returned by the engine. You can define your own drop down list to display rich data, with icons or whatever you want.\n\nMaybe you have a sophisticated dataset of words with metadata like probability of occurrence, and you need to keep track of words already typed to perform complex calculations. `Suggestion` is the library you need to implement your project !\n\nIf you want to create your custom auto-complete(suggest) `engine`, these links could be helpful:\n- [https://norvig.com/spell-correct.html](https://norvig.com/spell-correct.html)\n- [https://github.com/rodricios/autocomplete](https://github.com/rodricios/autocomplete)\n- [https://www.jeremymikkola.com/posts/2019_03_19_rules_for_autocomplete.html](https://www.jeremymikkola.com/posts/2019_03_19_rules_for_autocomplete.html)\n- [Rules of Autocomplete (Hackernews)](https://news.ycombinator.com/item?id=19438826)\n\nAs `Suggestion` is part of the [Pyrustic Open Ecosystem](https://pyrustic.github.io), it is compatible with the [Cyberpunk Theme](https://github.com/pyrustic/cyberpunk-theme):\n\n```python\nimport tkinter as tk\nfrom suggestion import Suggestion\nfrom cyberpunk_theme import Cyberpunk\n\n\n# the dataset\nDATASET = \"/home/alex/words_alpha.txt\"\n\n# root\nroot = tk.Tk()\nroot.title(\"Suggestion demo | built with Pyrustic\")\n\n# set the theme\nCyberpunk().target(root)\n\n# text field (it works with tk.Entry too!)\ntext_field = tk.Text(root)\ntext_field.pack()\n\n# Suggestion\nsuggestion = Suggestion(text_field, dataset=DATASET)\n\n# lift off !\nroot.mainloop()\n\n```\n\n\u003c!-- Image --\u003e\n\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/pyrustic/misc/master/media/suggestion-demo-4.gif\" alt=\"Figure\" width=\"650\"\u003e\n    \u003cp align=\"center\"\u003e\n    \u003ci\u003e Figure 4 \u003c/i\u003e\n    \u003c/p\u003e\n\u003c/div\u003e\n\n\n## Installation\n### First time\nInstall for the first time:\n\n```bash\n$ pip install suggestion\n```\n\n### Upgrade\nTo upgrade `Suggestion`:\n\n```bash\n$ pip install suggestion --upgrade --upgrade-strategy eager\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyrustic%2Fsuggestion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpyrustic%2Fsuggestion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyrustic%2Fsuggestion/lists"}