{"id":15665129,"url":"https://github.com/cansik/duit","last_synced_at":"2025-05-05T23:51:54.024Z","repository":{"id":208085210,"uuid":"436537412","full_name":"cansik/duit","owner":"cansik","description":"Duit is a Python library that provides a set of tools for working with data in a structured and efficient way.","archived":false,"fork":false,"pushed_at":"2025-04-16T21:40:24.000Z","size":1608,"stargazers_count":6,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-17T01:30:32.461Z","etag":null,"topics":["configuration","data","gui","helper","open3d","python","settings","tkinter","tool"],"latest_commit_sha":null,"homepage":"https://cansik.github.io/duit/","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/cansik.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-12-09T08:26:13.000Z","updated_at":"2025-04-07T20:58:22.000Z","dependencies_parsed_at":"2023-11-20T22:26:08.207Z","dependency_job_id":"50d3d1ed-7a9a-4199-90d1-b43fa9bbb0de","html_url":"https://github.com/cansik/duit","commit_stats":{"total_commits":183,"total_committers":2,"mean_commits":91.5,"dds":0.2896174863387978,"last_synced_commit":"31ccc04814b2d2a39c7f01e381a62aa5f00b5948"},"previous_names":["cansik/duit"],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cansik%2Fduit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cansik%2Fduit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cansik%2Fduit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cansik%2Fduit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cansik","download_url":"https://codeload.github.com/cansik/duit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252596375,"owners_count":21773844,"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":["configuration","data","gui","helper","open3d","python","settings","tkinter","tool"],"created_at":"2024-10-03T13:45:03.375Z","updated_at":"2025-05-05T23:51:53.955Z","avatar_url":"https://github.com/cansik.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Duit (Data UI Toolkit)\n\n[![Documentation](https://img.shields.io/badge/read-documentation-blue)](https://cansik.github.io/duit/)\n[![Duit Test](https://github.com/cansik/duit/actions/workflows/test.yml/badge.svg)](https://github.com/cansik/duit/actions/workflows/test.yml)\n[![PyPI](https://img.shields.io/pypi/v/duit)](https://pypi.org/project/duit/)\n[![Github](https://img.shields.io/badge/github-duit-green.svg?logo=github)](https://github.com/cansik/duit)\n\nDuit is a Python library that provides a set of tools for working with data in a structured and efficient way. The goal\nof duit is to make it easy for developers to create and manage data models and create simple user interfaces for\ndata entry and display. The implementation is based on the ideas\nof [cansik/bildspur-base](https://github.com/cansik/bildspur-base)\nand [cansik/bildspur-ui](https://github.com/cansik/bildspur-ui).\n\n\u003cimg width=\"800\" alt=\"gui-demo\" src=\"./doc/gui-demo.png\"\u003e\n\n*Example UI rendered with [Open3D](https://github.com/isl-org/Open3D) (left), [tkinter](https://docs.python.org/3/library/tkinter.html) (center) and [wx](https://pypi.org/project/wxPython/) (right)*.\n\n## Features\n\n- **Data Modeling**: duit provides a flexible data modeling framework to create structured data models and fields.\n\n- **Annotations**: Use annotations to attach metadata to data fields, making it easier to work with them.\n\n- **Command-line Arguments**: Easily parse and configure command-line arguments in your applications based on data\n  fields.\n\n- **Settings Serialization**: Serialize and deserialize settings from data fields to and from json.\n\n- **User Interface**: Create simple user-interfaces for data fields.\n\n## Installation\n\nBy default, only the data modeling, annotation, arguments and settings modules are installed.\n\n```bash\npip install duit\n```\n\nTo support user interface creation for data fields, one of the following backends can be installed:\n\n- [open3d](https://github.com/isl-org/Open3D) - Cross platform UI framework with support for 3d visualisation.\n- [tkinter](https://docs.python.org/3/library/tkinter.html) - More stable UI framework, currently not feature complete.\n\nAt the moment `open3d` is the recommended choice as gui backend.\n\n```bash\npip install \"duit[open3d]\"\n```\n\nTo install `tkinter` use the following command:\n\n```bash\npip install \"duit[tk]\"\n```\n\nTo install `wx` use the following command:\n\n```bash\npip install \"duit[wx]\"\n```\n\nTo install duit with all backends call pip like this:\n\n```bash\npip install \"duit[all]\"\n```\n\n## Example\n\nThis is a very basic example on how to use `duit`. Read to [documentation](https://cansik.github.io/duit/duit.html#documentation) for a more information about the core concepts.\n\n```python\nimport argparse\n\nfrom open3d.visualization import gui\n\nfrom duit import ui\nfrom duit.arguments.Argument import Argument\nfrom duit.arguments.Arguments import DefaultArguments\nfrom duit.model.DataField import DataField\nfrom duit.settings.Settings import DefaultSettings\nfrom duit.ui.ContainerHelper import ContainerHelper\nfrom duit.ui.open3d.Open3dPropertyPanel import Open3dPropertyPanel\nfrom duit.ui.open3d.Open3dPropertyRegistry import init_open3d_registry\n\n\nclass Config:\n    def __init__(self):\n        container_helper = ContainerHelper(self)\n\n        with container_helper.section(\"User\"):\n            self.name = DataField(\"Cat\") | ui.Text(\"Name\")\n            self.age = DataField(21) | ui.Slider(\"Age\", limit_min=18, limit_max=99)\n\n        with container_helper.section(\"Application\"):\n            self.enabled = DataField(True) | ui.Boolean(\"Enabled\") | Argument()\n\n\ndef main():\n    # create initial config\n    config = Config()\n\n    # register a custom listener for the enabled flag\n    config.enabled.on_changed += lambda e: print(f\"Enabled: {e}\")\n\n    # add arguments and parse\n    parser = argparse.ArgumentParser()\n    args = DefaultArguments.add_and_configure(parser, config)\n\n    # store current config\n    DefaultSettings.save(\"config.json\", config)\n\n    # create open3d gui for to display config\n    init_open3d_registry()\n\n    app = gui.Application.instance\n    app.initialize()\n\n    window: gui.Window = gui.Application.instance.create_window(\"Demo Window\", 400, 200)\n    panel = Open3dPropertyPanel(window)\n    window.add_child(panel)\n    panel.data_context = config\n\n    app.run()\n\n\nif __name__ == \"__main__\":\n    main()\n```\n\nWhich results in the following GUI.\n\n\u003cimg width=\"480\" alt=\"example-window\" src=\"./doc/example-window.png\"\u003e\n\n### Development\n\nTo develop it is recommended to clone this repository and install the dependencies like this:\n\n```bash\n# in the duit directory\npip install -e \".[all]\"\n```\n\n#### Generate Documentation\n\n```bash\n# create documentation into \"./docs\npython setup.py doc\n\n# launch pdoc webserver\npython setup.py doc --launch\n```\n\n## About\n\nMIT License - Copyright (c) 2024 Florian Bruggisser\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcansik%2Fduit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcansik%2Fduit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcansik%2Fduit/lists"}