{"id":19583693,"url":"https://github.com/cnfeffery/feffery-dash-utils","last_synced_at":"2025-07-22T18:34:45.826Z","repository":{"id":244545902,"uuid":"815360108","full_name":"CNFeffery/feffery-dash-utils","owner":"CNFeffery","description":"包含一系列用于提升Dash应用开发效率的工具函数/工具类","archived":false,"fork":false,"pushed_at":"2025-07-08T03:47:02.000Z","size":117,"stargazers_count":10,"open_issues_count":2,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-08T06:07:18.076Z","etag":null,"topics":["dash-plotly","web-application"],"latest_commit_sha":null,"homepage":"","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/CNFeffery.png","metadata":{"files":{"readme":"README-en_US.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,"zenodo":null}},"created_at":"2024-06-15T00:14:54.000Z","updated_at":"2025-04-25T13:50:04.000Z","dependencies_parsed_at":"2024-06-15T14:48:14.688Z","dependency_job_id":"617cc962-7cb1-49b6-b557-a345143c17b0","html_url":"https://github.com/CNFeffery/feffery-dash-utils","commit_stats":null,"previous_names":["cnfeffery/feffery-dash-utils"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CNFeffery/feffery-dash-utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CNFeffery%2Ffeffery-dash-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CNFeffery%2Ffeffery-dash-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CNFeffery%2Ffeffery-dash-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CNFeffery%2Ffeffery-dash-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CNFeffery","download_url":"https://codeload.github.com/CNFeffery/feffery-dash-utils/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CNFeffery%2Ffeffery-dash-utils/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266552738,"owners_count":23947183,"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-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":["dash-plotly","web-application"],"created_at":"2024-11-11T07:44:06.842Z","updated_at":"2025-07-22T18:34:45.807Z","avatar_url":"https://github.com/CNFeffery.png","language":"Python","readme":"# feffery-dash-utils\n\n[简体中文](./README.md) | English\n\nContains a series of tool functions/classes designed to enhance the development efficiency of `Dash` applications.\n\n\u003cdiv\u003e\n\n[![Pyhton](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-blue)](./setup.py)\n[![GitHub](https://shields.io/badge/license-MIT-informational)](https://github.com/CNFeffery/feffery-antd-components/blob/master/LICENSE)\n[![PyPI](https://img.shields.io/pypi/v/feffery-dash-utils.svg?color=dark-green)](https://pypi.org/project/feffery-dash-utils/)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n\n\u003c/div\u003e\n\n## Table of Contents\n\n[Install](#install)\u003cbr\u003e\n[Use with vscode plugin](#with-vscode)\u003cbr\u003e\n[Utils List](#utils-list)\u003cbr\u003e\n[Contribute](#contribute)\u003cbr\u003e\n[Roadmap](#roadmap)\n\n\u003ca name=\"install\" \u003e\u003c/a\u003e\n\n## Install\n\n```bash\npip install feffery-dash-utils -U\n```\n\n\u003ca name=\"with-vscode\" \u003e\u003c/a\u003e\n\n## Use with vscode plugin\n\nIn `vscode`, with the plugin [feffery-dash-snippets](https://github.com/CNFeffery/feffery-dash-snippets), you can quickly import various utility functions and classes. In a `Python` file, typing `utils:` will trigger the relevant quick commands.\n\n\u003ca name=\"utils-list\" \u003e\u003c/a\u003e\n\n## Utils List\n\n- style_utils\n  - [style()](#style)\u003cbr\u003e\n- tree_utils\n  - [TreeManager](#TreeManager)\u003cbr\u003e\n    - [update_tree_node()](#update_tree_node)\u003cbr\u003e\n    - [add_node_before()](#add_node_before)\u003cbr\u003e\n    - [add_node_after()](#add_node_after)\u003cbr\u003e\n    - [delete_node()](#delete_node)\u003cbr\u003e\n    - [get_node()](#get_node)\u003cbr\u003e\n- i18n_utils\n  - [Translator](#Translator)\n- template_utils\n  - [dashboard_components](#dashboard_components)\n    - [welcome_card()](#welcome_card)\u003cbr\u003e\n    - [blank_card()](#blank_card)\u003cbr\u003e\n    - [simple_chart_card()](#simple_chart_card)\u003cbr\u003e\n    - [index_card()](#index_card)\u003cbr\u003e\n- version_utils\n  - [check_python_version()](#check_python_version)\u003cbr\u003e\n  - [check_dependencies_version()](#check_dependencies_version)\u003cbr\u003e\n\n\u003ca name=\"style\" \u003e\u003c/a\u003e\n\n### `style()`\n\nUsed for quickly generating the `style` parameter dictionary of `Dash` components, it includes most of the commonly used `css` properties in camelCase naming format. Hovering the mouse over the parameter name in common IDEs will display the corresponding Chinese and English property introductions, which are automatically generated based on `w3cschool`.\n\n\u003e Usage Example\n\n```Python\nfrom feffery_dash_utils.style_utils import style\n\n# Method one: Directly write key-value pair styles\nfac.AntdText(\n    'Test',\n    style=style(\n        fontSize=16,\n        color='red'\n    )\n)\n\n# Method two: Parse CSS code snippets\nfac.AntdText(\n    'Test',\n    style=style(\n        \"\"\"\n.IvkwhTOsc9wu6RdvHESR .yK52Sq0w7wspWaS28YNl {\n    width: 91.46%;\n    margin-left: 4.27%;\n    margin-bottom: 5%;\n    position: relative;\n}\"\"\"\n    )\n)\n\n# Method three: Mixed use\nfac.AntdText(\n    'Test',\n    style=style(\n        \"\"\"\n.IvkwhTOsc9wu6RdvHESR .yK52Sq0w7wspWaS28YNl {\n    width: 91.46%;\n    margin-left: 4.27%;\n    margin-bottom: 5%;\n    position: relative;\n}\"\"\",\n        fontSize=16,\n        color='red'\n    )\n)\n```\n\n\u003ca name=\"TreeManager\" \u003e\u003c/a\u003e\n\n### `TreeManager`\n\nUsed for quick management operations on tree structure data that components like `AntdTree` and `AntdTreeSelect` depend on. The specific methods included are:\n\n\u003ca name=\"update_tree_node\" \u003e\u003c/a\u003e\n\n#### `update_tree_node()`\n\nUsed to perform overall or incremental updates on a specified `key` corresponding node in the tree structure data.\n\n\u003e Usage Example\n\n```Python\nfrom feffery_dash_utils.tree_utils import TreeManager\n\n# Example tree data\ndemo_tree = [\n    {\n        'title': 'Node 1',\n        'key': 'Node 1',\n        'children': [\n            {\n                'title': 'Node 1-1',\n                'key': 'Node 1-1',\n                'children': [\n                    {\n                        'title': 'Node 1-1-1',\n                        'key': 'Node 1-1-1',\n                    },\n                    {\n                        'title': 'Node 1-1-2',\n                        'key': 'Node 1-1-2',\n                    },\n                ],\n            }\n        ],\n    },\n    {'title': 'Node 2', 'key': 'Node 2'},\n]\n\n# Replace a specified node in the example tree data as a whole\nTreeManager.update_tree_node(\n    demo_tree,\n    'Node 1-1',\n    {'title': 'Node 1-1', 'key': 'Node 1-1'},\n)\n\n# Incrementally update a specified node in the example tree data\nTreeManager.update_tree_node(\n    demo_tree,\n    'Node 1-1',\n    {'title': 'Node 1-1new'},\n    'overlay',\n)\n```\n\n\u003ca name=\"add_node_before\" \u003e\u003c/a\u003e\n\n#### `add_node_before()`\n\nInsert a new sibling node before the specified `key` corresponding node in the tree structure data.\n\n\u003e Usage Example\n\n```Python\nfrom feffery_dash_utils.tree_utils import TreeManager\n\n# Example tree data\ndemo_tree = [\n    {\n        'title': 'Node 1',\n        'key': 'Node 1',\n        'children': [\n            {\n                'title': 'Node 1-1',\n                'key': 'Node 1-1',\n                'children': [\n                    {\n                        'title': 'Node 1-1-1',\n                        'key': 'Node 1-1-1',\n                    },\n                    {\n                        'title': 'Node 1-1-2',\n                        'key': 'Node 1-1-2',\n                    },\n                ],\n            }\n        ],\n    },\n    {'title': 'Node 2', 'key': 'Node 2'},\n]\n\n# Insert a new sibling node before the specified node in the example tree data\nTreeManager.add_node_before(\n    demo_tree,\n    'Node 1-1',\n    {'title': 'Node 1-0', 'key': 'Node 1-0'},\n)\n```\n\n\u003ca name=\"add_node_after\" \u003e\u003c/a\u003e\n\n#### `add_node_after()`\n\nInsert a new sibling node after the specified `key` corresponding node in the tree structure data.\n\n\u003e Usage Example\n\n```Python\nfrom feffery_dash_utils.tree_utils import TreeManager\n\n# Example tree data\ndemo_tree = [\n    {\n        'title': 'Node 1',\n        'key': 'Node 1',\n        'children': [\n            {\n                'title': 'Node 1-1',\n                'key': 'Node 1-1',\n                'children': [\n                    {\n                        'title': 'Node 1-1-1',\n                        'key': 'Node 1-1-1',\n                    },\n                    {\n                        'title': 'Node 1-1-2',\n                        'key': 'Node 1-1-2',\n                    },\n                ],\n            }\n        ],\n    },\n    {'title': 'Node 2', 'key': 'Node 2'},\n]\n\n# Insert a new sibling node after the specified node in the example tree data\nTreeManager.add_node_after(\n    demo_tree,\n    'Node 1-1',\n    {'title': 'Node 1-2', 'key': 'Node 1-2'},\n)\n```\n\n\u003ca name=\"delete_node\" \u003e\u003c/a\u003e\n\n#### `delete_node()`\n\nDelete the node corresponding to the specified `key` in the tree structure data.\n\n\u003e Usage Example\n\n```Python\nfrom feffery_dash_utils.tree_utils import TreeManager\n\n# Example tree data\ndemo_tree = [\n    {\n        'title': 'Node 1',\n        'key': 'Node 1',\n        'children': [\n            {\n                'title': 'Node 1-1',\n                'key': 'Node 1-1',\n                'children': [\n                    {\n                        'title': 'Node 1-1-1',\n                        'key': 'Node 1-1-1',\n                    },\n                    {\n                        'title': 'Node 1-1-2',\n                        'key': 'Node 1-1-2',\n                    },\n                ],\n            }\n        ],\n    },\n    {'title': 'Node 2', 'key': 'Node 2'},\n]\n\n# Delete the specified node in the example tree data\nTreeManager.delete_node(demo_tree, 'Node 2')\n```\n\n\u003ca name=\"get_node\" \u003e\u003c/a\u003e\n\n#### `get_node()`\n\nQuery the node corresponding to the specified `key` in the tree structure data.\n\n\u003e Usage Example\n\n```Python\nfrom feffery_dash_utils.tree_utils import TreeManager\n\n# Example tree data\ndemo_tree = [\n    {\n        'title': 'Node 1',\n        'key': 'Node 1',\n        'children': [\n            {\n                'title': 'Node 1-1',\n                'key': 'Node 1-1',\n                'children': [\n                    {\n                        'title': 'Node 1-1-1',\n                        'key': 'Node 1-1-1',\n                    },\n                    {\n                        'title': 'Node 1-1-2',\n                        'key': 'Node 1-1-2',\n                    },\n                ],\n            }\n        ],\n    },\n    {'title': 'Node 2', 'key': 'Node 2'},\n]\n\n# Query the specified node in the example tree data\nTreeManager.get_node(demo_tree, 'Node 1-1')\n\n# Query a specified node that does not exist in the example tree data (will return None)\nTreeManager.get_node(demo_tree, 'Node 1-666')\n```\n\n\u003ca name=\"Translator\" \u003e\u003c/a\u003e\n\n### `Translator`\n\nUsed for quickly building an internationalization and multi-language solution in `Dash` applications, driven by front-end `cookies` and local internationalization configuration files.\n\n\u003e Usage Example\n\nExample applications can be found in [i18n_test_app.py](/tests/i18n_utils/i18n_test_app.py) and [i18n_multi_test_app.py](/tests/i18n_utils/i18n_multi_test_app.py), and reference configuration files can be found in [locales.json](/tests/i18n_utils/locales.json), [locales1.json](/tests/i18n_utils/multi_locales/locales1.json), and [locales2.json](/tests/i18n_utils/multi_locales/locales2.json).\n\n\u003ca name=\"dashboard_components\" \u003e\u003c/a\u003e\n\n### `dashboard_components`\n\nBuilt-in data dashboard page building common custom components, including:\n\n\u003ca name=\"welcome_card\" \u003e\u003c/a\u003e\n\n#### `welcome_card()`\n\nWelcome card.\n\n\u003ca name=\"blank_card\" \u003e\u003c/a\u003e\n\n#### `blank_card()`\n\nBlank card.\n\n\u003ca name=\"simple_chart_card\" \u003e\u003c/a\u003e\n\n#### `simple_chart_card()`\n\nSimple chart card.\n\n\u003ca name=\"index_card\" \u003e\u003c/a\u003e\n\n#### `index_card()`\n\nIndex card.\n\n\u003ca name=\"version_utils\" \u003e\u003c/a\u003e\n\n### `version_utils`\n\nProvides a series of utility functions related to project dependency versions, including Python version checking and dependency library version checking.\n\n\u003ca name=\"check_python_version\" \u003e\u003c/a\u003e\n\n#### `check_python_version()`\n\nUsed to check if the current Python version meets the project requirements.\n\n\u003e Usage Example\n\n```Python\nfrom feffery_dash_utils.version_utils import check_python_version\n\ncheck_python_version(\n    min_version='3.8',\n    max_version='3.12'\n)\n\n```\n\n\u003ca name=\"check_dependencies_version\" \u003e\u003c/a\u003e\n\n#### `check_dependencies_version()`\n\nUsed to check if the current project dependency library versions meet the project requirements.\n\n\u003e Usage Example\n\n```Python\nfrom feffery_dash_utils.version_utils import check_dependencies_version\n\ncheck_dependencies_version(\n    rules=[\n        {\n            'name': 'dash',\n            'specifier': '\u003c=2.18.2'\n        }\n    ]\n)\n\n```\n\n\u003ca name=\"contribute\" \u003e\u003c/a\u003e\n\n## Contribute\n\n```bash\ngit clone https://github.com/CNFeffery/feffery-dash-utils.git\ncd feffery-dash-utils\n# Install dependencies required for the development environment\npip install -r requirements/dev.txt\n```\n\n\u003ca name=\"roadmap\" \u003e\u003c/a\u003e\n\n## Roadmap\n\n- [ ] Style-related utility function submodule `style_utils`\n  - [x] `style` parameter writing assistant function `style()`\n- [ ] Template-related utility function submodule `template_utils`\n  - [x] Dashboard common custom component submodule `dashboard_components`\n    - [x] Welcome card `welcome_card()`\n    - [x] Blank card `blank_card()`\n    - [x] Simple chart card `simple_chart_card()`\n    - [x] Index card `index_card()`\n- [ ] Tree processing-related utility function submodule `tree_utils`\n  - [x] Tree data structure management class `TreeManager`\n    - [x] Tree node update function `update_tree_node()`\n    - [x] Tree node front insertion function `add_node_before()`\n    - [x] Tree node rear insertion function `add_node_after()`\n    - [x] Tree node deletion function `delete_node()`\n    - [x] Tree node query function `get_node()`\n- [ ] Internationalization-related utility function submodule `i18n_utils`\n  - [x] Text content quick internationalization operation class `Translator`\n- [ ] Version control-related utility function submodule `version_utils`\n  - [x] `Python` version check function `check_python_version()`\n  - [x] Dependencies version check function `check_dependencies_version()`\n- [ ] Component parameter auxiliary generation utility function submodule `component_prop_utils`  \n - [x] Auxiliary generation utility function `to_box_data()` for the `data` parameter of the `fact.AntdBox` box plot component","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcnfeffery%2Ffeffery-dash-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcnfeffery%2Ffeffery-dash-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcnfeffery%2Ffeffery-dash-utils/lists"}