dash-echartsx 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dash_echartsx-0.1.0/.agent/skills/dash-duo-test-generator/SKILL.md +51 -0
- dash_echartsx-0.1.0/.agent/skills/dash-echartsx-test-runner/SKILL.md +50 -0
- dash_echartsx-0.1.0/.agent/skills/echarts-option-validator/SKILL.md +27 -0
- dash_echartsx-0.1.0/.agent/skills/scaffold-dash-echartsx-component/SKILL.md +39 -0
- dash_echartsx-0.1.0/.claude/CLAUDE.md +37 -0
- dash_echartsx-0.1.0/.github/AI_CONTEXT.md +73 -0
- dash_echartsx-0.1.0/.github/ISSUE_TEMPLATE/bug_report.md +58 -0
- dash_echartsx-0.1.0/.github/ISSUE_TEMPLATE/issue_template.md +53 -0
- dash_echartsx-0.1.0/.github/ISSUE_TEMPLATE/story.md +24 -0
- dash_echartsx-0.1.0/.github/copilot-instructions.md +45 -0
- dash_echartsx-0.1.0/.github/dependabot.yml +29 -0
- dash_echartsx-0.1.0/.github/pull_request_template.md +29 -0
- dash_echartsx-0.1.0/.github/skills/echarts-option-generator/SKILL.md +72 -0
- dash_echartsx-0.1.0/.github/skills/echarts-option-generator/prompts/pandas-dataframe-to-option.md +50 -0
- dash_echartsx-0.1.0/.github/skills/echarts-option-generator/prompts/python-dict-to-option.md +42 -0
- dash_echartsx-0.1.0/.github/workflows/ai-quality-gate.yml +49 -0
- dash_echartsx-0.1.0/.github/workflows/auto-close-issues.yml +48 -0
- dash_echartsx-0.1.0/.github/workflows/ci.yml +156 -0
- dash_echartsx-0.1.0/.github/workflows/dependabot-issue-lifecycle.yml +82 -0
- dash_echartsx-0.1.0/.github/workflows/docs.yml +110 -0
- dash_echartsx-0.1.0/.github/workflows/release.yml +88 -0
- dash_echartsx-0.1.0/.github/workflows/security.yml +51 -0
- dash_echartsx-0.1.0/.github/workflows/sync-pr-to-issue.yml +91 -0
- dash_echartsx-0.1.0/.github/workflows/validate-templates.yml +66 -0
- dash_echartsx-0.1.0/.gitignore +234 -0
- dash_echartsx-0.1.0/.prettierrc.json +6 -0
- dash_echartsx-0.1.0/CHANGELOG.md +22 -0
- dash_echartsx-0.1.0/LICENSE +201 -0
- dash_echartsx-0.1.0/MIGRATION.md +126 -0
- dash_echartsx-0.1.0/NOTICE +13 -0
- dash_echartsx-0.1.0/PKG-INFO +451 -0
- dash_echartsx-0.1.0/README.md +240 -0
- dash_echartsx-0.1.0/dash_echartsx/DashEChartsX.py +162 -0
- dash_echartsx-0.1.0/dash_echartsx/DashEChartsX.pyi +88 -0
- dash_echartsx-0.1.0/dash_echartsx/__init__.py +22 -0
- dash_echartsx-0.1.0/dash_echartsx/_imports_.py +5 -0
- dash_echartsx-0.1.0/dash_echartsx/dash_echartsx.es.js +30719 -0
- dash_echartsx-0.1.0/dash_echartsx/dash_echartsx.gl.umd.js +4217 -0
- dash_echartsx-0.1.0/dash_echartsx/dash_echartsx.gl.umd.js.map +1 -0
- dash_echartsx-0.1.0/dash_echartsx/dash_echartsx.umd.js +23 -0
- dash_echartsx-0.1.0/dash_echartsx/metadata.json +194 -0
- dash_echartsx-0.1.0/dash_echartsx/package.json +53 -0
- dash_echartsx-0.1.0/dash_echartsx/proptypes.js +26 -0
- dash_echartsx-0.1.0/dash_echartsx/utils.py +11 -0
- dash_echartsx-0.1.0/docs/README.md +20 -0
- dash_echartsx-0.1.0/docs/_static/playground.css +56 -0
- dash_echartsx-0.1.0/docs/_static/playground.js +100 -0
- dash_echartsx-0.1.0/docs/_static/site.css +3 -0
- dash_echartsx-0.1.0/docs/_static/version-switcher.css +16 -0
- dash_echartsx-0.1.0/docs/_static/version-switcher.js +101 -0
- dash_echartsx-0.1.0/docs/_static/version-switcher.test.mjs +146 -0
- dash_echartsx-0.1.0/docs/conf.py +72 -0
- dash_echartsx-0.1.0/docs/examples.rst +52 -0
- dash_echartsx-0.1.0/docs/guide.rst +58 -0
- dash_echartsx-0.1.0/docs/index.rst +56 -0
- dash_echartsx-0.1.0/docs/migration.rst +10 -0
- dash_echartsx-0.1.0/docs/playground.rst +38 -0
- dash_echartsx-0.1.0/docs/reference/python_api.rst +14 -0
- dash_echartsx-0.1.0/docs/reference/typescript_props.rst +75 -0
- dash_echartsx-0.1.0/eslint.config.mjs +40 -0
- dash_echartsx-0.1.0/examples/README.md +38 -0
- dash_echartsx-0.1.0/examples/data/harbor_county.geojson +59 -0
- dash_echartsx-0.1.0/examples/financial_multi_axis.py +197 -0
- dash_echartsx-0.1.0/examples/geospatial_map.py +77 -0
- dash_echartsx-0.1.0/examples/globe_and_scatter3d.py +155 -0
- dash_echartsx-0.1.0/examples/realtime_streaming.py +176 -0
- dash_echartsx-0.1.0/mcp/dash-build-validator.js +104 -0
- dash_echartsx-0.1.0/mcp/echarts-option-inspector.js +109 -0
- dash_echartsx-0.1.0/mcp/lib/stdio-rpc.js +103 -0
- dash_echartsx-0.1.0/package-lock.json +5564 -0
- dash_echartsx-0.1.0/package.json +53 -0
- dash_echartsx-0.1.0/pyproject.toml +48 -0
- dash_echartsx-0.1.0/scripts/build_versioned_docs.py +76 -0
- dash_echartsx-0.1.0/scripts/check_installed_package.py +34 -0
- dash_echartsx-0.1.0/scripts/check_release_metadata.py +75 -0
- dash_echartsx-0.1.0/scripts/generate_docs_reference.py +52 -0
- dash_echartsx-0.1.0/scripts/generate_python_stub.py +130 -0
- dash_echartsx-0.1.0/scripts/validate_echarts_option.mjs +282 -0
- dash_echartsx-0.1.0/scripts/validate_echarts_option.test.mjs +79 -0
- dash_echartsx-0.1.0/src/echarts-gl.d.ts +55 -0
- dash_echartsx-0.1.0/src/gl.ts +38 -0
- dash_echartsx-0.1.0/src/index.ts +3 -0
- dash_echartsx-0.1.0/src/lib/components/DashEChartsX.tsx +449 -0
- dash_echartsx-0.1.0/src/lib/utils/loadEChartsGL.ts +60 -0
- dash_echartsx-0.1.0/src/lib/utils/resolveJavaScriptFunctions.test.mjs +95 -0
- dash_echartsx-0.1.0/src/lib/utils/resolveJavaScriptFunctions.ts +35 -0
- dash_echartsx-0.1.0/tests/conftest.py +35 -0
- dash_echartsx-0.1.0/tests/test_dispatch_actions.py +56 -0
- dash_echartsx-0.1.0/tests/test_events.py +98 -0
- dash_echartsx-0.1.0/tests/test_examples.py +48 -0
- dash_echartsx-0.1.0/tests/test_maps_gl.py +91 -0
- dash_echartsx-0.1.0/tests/test_options.py +86 -0
- dash_echartsx-0.1.0/tests/test_prop_updates.py +87 -0
- dash_echartsx-0.1.0/tests/test_responsive_layout.py +143 -0
- dash_echartsx-0.1.0/tsconfig.json +20 -0
- dash_echartsx-0.1.0/uv.lock +2148 -0
- dash_echartsx-0.1.0/vite.config.ts +28 -0
- dash_echartsx-0.1.0/vite.gl.config.ts +26 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dash-duo-test-generator
|
|
3
|
+
description: "Use when adding Selenium/dash_duo browser tests for Dash EChartsX chart rendering, resizing, renderer/theme switching, or Dash prop callbacks."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Generate Dash Browser Tests
|
|
7
|
+
|
|
8
|
+
Use `dash[testing]` and the `dash_duo` fixture to verify behavior that Python unit tests cannot cover: the generated UMD bundle, React lifecycle, real chart rendering, and responsive layout.
|
|
9
|
+
|
|
10
|
+
## Test Pattern
|
|
11
|
+
|
|
12
|
+
```python
|
|
13
|
+
from dash import Dash, html
|
|
14
|
+
from dash_echartsx import DashEChartsX
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def test_chart_renders(dash_duo):
|
|
18
|
+
app = Dash(__name__)
|
|
19
|
+
app.layout = html.Div(
|
|
20
|
+
DashEChartsX(
|
|
21
|
+
id="chart",
|
|
22
|
+
option={
|
|
23
|
+
"xAxis": {"type": "category", "data": ["A", "B"]},
|
|
24
|
+
"yAxis": {"type": "value"},
|
|
25
|
+
"series": [{"type": "bar", "data": [2, 4]}],
|
|
26
|
+
},
|
|
27
|
+
),
|
|
28
|
+
style={"width": "60vw"},
|
|
29
|
+
)
|
|
30
|
+
dash_duo.start_server(app)
|
|
31
|
+
dash_duo.wait_for_element("#chart canvas", timeout=30)
|
|
32
|
+
assert dash_duo.get_logs() == []
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Useful Assertions
|
|
36
|
+
|
|
37
|
+
- Canvas renderer: wait for `#chart canvas`.
|
|
38
|
+
- SVG renderer: wait for `#chart svg`.
|
|
39
|
+
- Resize: change a parent width, wait for observer/frame work, then compare element and renderer dimensions.
|
|
40
|
+
- Theme/renderer update: drive a Dash callback or button, verify the old renderer is disposed and the requested new renderer appears.
|
|
41
|
+
- Capture browser console errors with `dash_duo.get_logs()`.
|
|
42
|
+
- For Dash callback behavior, assert the Python output reflects the updated component prop, not only that a click occurred.
|
|
43
|
+
|
|
44
|
+
Keep browser tests in `tests/` with clear names; the repository currently has a flat test layout. Ensure `dash[testing]` is installed with `uv sync --group dev`. Do not assume a separate `tests/integration` folder or Linux `xvfb-run` setup exists.
|
|
45
|
+
|
|
46
|
+
`tests/conftest.py` is the shared Selenium setup: it installs a matching
|
|
47
|
+
ChromeDriver, enables headless Chrome when `CI` is set, and configures
|
|
48
|
+
WebGL/SwiftShader for Linux. CI runs tests on Ubuntu and Windows. Use its
|
|
49
|
+
`dash_duo` fixture instead of installing or configuring a driver in an
|
|
50
|
+
individual test. When a browser wait fails, inspect browser logs and the
|
|
51
|
+
application's rendered state before increasing the timeout.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dash-echartsx-test-runner
|
|
3
|
+
description: "Use when adding, running, or debugging tests for dash-echartsx. Covers the current flat pytest suite, uv commands, optional dash_duo browser tests, and build/type/lint checks."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# dash-echartsx Test Runner
|
|
7
|
+
|
|
8
|
+
## Current Layout
|
|
9
|
+
|
|
10
|
+
```text
|
|
11
|
+
tests/
|
|
12
|
+
├── conftest.py
|
|
13
|
+
├── test_dispatch_actions.py
|
|
14
|
+
├── test_events.py
|
|
15
|
+
├── test_maps_gl.py
|
|
16
|
+
└── test_options.py
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Keep fast Python tests and `dash_duo` browser tests directly under `tests/`, and name them clearly so they can be selected with pytest. There are no `tests/unit/` or `tests/integration/` directories and no JavaScript test runner configured currently.
|
|
20
|
+
|
|
21
|
+
`tests/conftest.py` installs a matching ChromeDriver, enables Dash's headless
|
|
22
|
+
browser in CI, and supplies Linux WebGL/SwiftShader options. CI runs the
|
|
23
|
+
Python/ECharts test matrix on both Ubuntu and Windows. Use the standard
|
|
24
|
+
`uv run pytest` command; set `CI=true` to exercise the headless configuration
|
|
25
|
+
locally.
|
|
26
|
+
|
|
27
|
+
## Commands
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
uv sync --group dev
|
|
31
|
+
npm run build
|
|
32
|
+
npm run lint
|
|
33
|
+
npm run typecheck
|
|
34
|
+
uv run ruff check .
|
|
35
|
+
uv run black --check dash_echartsx tests
|
|
36
|
+
uv run pytest
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
For one file, run `uv run pytest tests/test_options.py`. For browser tests, install dependencies with `uv sync --group dev`. The shared
|
|
40
|
+
conftest handles ChromeDriver and browser options; do not add per-test
|
|
41
|
+
driver-installation code.
|
|
42
|
+
|
|
43
|
+
## Debugging
|
|
44
|
+
|
|
45
|
+
- Python import/wrapper failure: run `npm run build` and inspect generated files under `dash_echartsx/`.
|
|
46
|
+
- Missing component in Dash: verify `dash_echartsx/__init__.py` exposes the class/version and registers the UMD asset.
|
|
47
|
+
- Browser bundle runtime error: check that the Dash asset is UMD and React remains external in Vite.
|
|
48
|
+
- Browser startup timeout: check the `dash_duo` setup in `tests/conftest.py`, the installed Chrome version, and the browser console before extending wait timeouts.
|
|
49
|
+
- Resize failure: assert wrapper dimensions after layout changes and check observer cleanup/frame scheduling.
|
|
50
|
+
- Renderer/theme failure: verify the component is remounted for theme/renderer changes and that options are reapplied afterward.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: echarts-option-validator
|
|
3
|
+
description: "Use when reviewing Apache ECharts options, chart series, themes, renderers, datasets, or registered maps for dash-echartsx. Checks ECharts 6 option structure, modular imports, Dash JSON compatibility, and unsafe JavaScript serialization."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Validate ECharts Options
|
|
7
|
+
|
|
8
|
+
Review Python-supplied options and React module registrations against ECharts 6 and the current component API.
|
|
9
|
+
|
|
10
|
+
## Checks
|
|
11
|
+
|
|
12
|
+
1. Identify each `series[].type`; verify its chart module is registered from `echarts/charts` in `src/lib/components/DashEChartsX.tsx`.
|
|
13
|
+
2. Verify required axes/components (grid, title, legend, tooltip, visual map, data zoom, etc.) are registered from `echarts/components`.
|
|
14
|
+
3. Verify the renderer is registered from `echarts/renderers`; accepted values are `canvas` and `svg`.
|
|
15
|
+
4. Keep options and custom themes JSON-serializable. Do not promise plain JSON callbacks or execute Python strings as JavaScript.
|
|
16
|
+
5. For geographic charts, verify map names are registered with ECharts. Do not assume coordinate/projection conventions without checking the map data contract.
|
|
17
|
+
6. Preserve caller-owned data; document any normalization or defaulting.
|
|
18
|
+
|
|
19
|
+
## Verification
|
|
20
|
+
|
|
21
|
+
- Check installed ECharts 6 declarations for uncertain option fields.
|
|
22
|
+
- Add focused Python helper tests as needed.
|
|
23
|
+
- For runtime behavior, use a Dash `dash_duo` test and assert the expected canvas/SVG node and absence of browser errors.
|
|
24
|
+
- Reuse the ChromeDriver and browser setup in `tests/conftest.py`; CI runs browser tests headlessly on Ubuntu and Windows.
|
|
25
|
+
- Run `npm run build`, `npm run typecheck`, `npm run lint`, and `uv run pytest`.
|
|
26
|
+
|
|
27
|
+
Report findings as `path | issue | evidence | correction`. Do not rewrite options during an audit-only request.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: scaffold-dash-echartsx-component
|
|
3
|
+
description: "Use when adding or expanding a Dash EChartsX React component or public prop. Scaffolds TSX props, Dash exports, generated Python metadata, tests, and a usage example using this repository's Vite and uv build flow."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Scaffold a Dash EChartsX Component
|
|
7
|
+
|
|
8
|
+
Use this workflow when adding a component or public prop. The primary component is `src/lib/components/DashEChartsX.tsx`.
|
|
9
|
+
|
|
10
|
+
## Before Editing
|
|
11
|
+
|
|
12
|
+
1. Read the current TSX component, `src/index.ts`, `package.json`, and `dash_echartsx/__init__.py`.
|
|
13
|
+
2. Decide whether the request belongs in the existing chart wrapper or needs a distinct exported component.
|
|
14
|
+
3. Confirm ECharts 6 type and modular import names from installed declarations; do not guess module paths.
|
|
15
|
+
|
|
16
|
+
## Component Rules
|
|
17
|
+
|
|
18
|
+
- Use functional React components with typed props and JSDoc descriptions for public props.
|
|
19
|
+
- Create and dispose ECharts instances in effects with matching cleanup.
|
|
20
|
+
- Register only required chart, component, and renderer modules.
|
|
21
|
+
- For theme/renderer changes, reinitialize then apply the latest option.
|
|
22
|
+
- Resize with `ResizeObserver`, a coalesced animation frame, a window fallback, and complete cleanup.
|
|
23
|
+
- Keep Python-facing values JSON-compatible. Never evaluate arbitrary strings as code.
|
|
24
|
+
- Do not hand-edit generated files in `dash_echartsx/`.
|
|
25
|
+
|
|
26
|
+
## Build and Verify
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
npm run build
|
|
30
|
+
npm run lint
|
|
31
|
+
npm run typecheck
|
|
32
|
+
uv run pytest
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Inspect generated wrapper, metadata, PropTypes, and bundle diffs. Add a `dash_duo` test under `tests/` for browser-dependent behavior.
|
|
36
|
+
|
|
37
|
+
Browser tests use the shared Selenium configuration in `tests/conftest.py`.
|
|
38
|
+
The CI matrix exercises the Python and ECharts versions on both Ubuntu and
|
|
39
|
+
Windows.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# CLAUDE.md — dash-echartsx
|
|
2
|
+
|
|
3
|
+
## Project Shape
|
|
4
|
+
|
|
5
|
+
- React component: `src/lib/components/DashEChartsX.tsx`; export: `src/index.ts`.
|
|
6
|
+
- ECharts option, theme, renderer, and responsive lifecycle are managed by the functional React component.
|
|
7
|
+
- `npm run build` generates UMD/ES bundles and Python wrapper metadata in `dash_echartsx/`.
|
|
8
|
+
- Python helpers live in `dash_echartsx/utils.py`; tests live directly in `tests/`.
|
|
9
|
+
|
|
10
|
+
## Invariants
|
|
11
|
+
|
|
12
|
+
1. Initialize ECharts in an effect and dispose it in cleanup.
|
|
13
|
+
2. Disconnect resize observers/listeners and cancel scheduled frames.
|
|
14
|
+
3. Keep public prop docs in TSX; do not hand-edit generated wrappers/bundles.
|
|
15
|
+
4. Guard every Dash `setProps` call and preserve Dash ownership of input props.
|
|
16
|
+
5. Keep React external in the UMD build; register only the UMD bundle in `_js_dist`.
|
|
17
|
+
6. Renderer values are `canvas`/`svg`; themes are `light`/`dark`/custom JSON. Do not evaluate arbitrary option strings.
|
|
18
|
+
|
|
19
|
+
## Verification
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
uv sync --group dev
|
|
23
|
+
npm ci
|
|
24
|
+
npm run build
|
|
25
|
+
npm run lint
|
|
26
|
+
npm run typecheck
|
|
27
|
+
uv run ruff check .
|
|
28
|
+
uv run black --check dash_echartsx tests
|
|
29
|
+
uv run pytest
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Browser tests use the shared Selenium setup in `tests/conftest.py`, which
|
|
33
|
+
installs a matching ChromeDriver, enables headless mode in CI, and configures
|
|
34
|
+
Linux WebGL/SwiftShader. The CI matrix covers Ubuntu and Windows. Set `CI=true`
|
|
35
|
+
when reproducing the headless CI test environment locally.
|
|
36
|
+
|
|
37
|
+
Use task-specific recipes under `.agent/skills/` and architecture notes in [AI_CONTEXT.md](../.github/AI_CONTEXT.md).
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# AI Context Map — dash-echartsx
|
|
2
|
+
|
|
3
|
+
Architecture notes for agents working on the Dash/ECharts integration.
|
|
4
|
+
|
|
5
|
+
## Data Flow
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
Python Dash layout/callback
|
|
9
|
+
│ JSON component props
|
|
10
|
+
▼
|
|
11
|
+
Generated dash_echartsx.DashEChartsX wrapper
|
|
12
|
+
│ Dash renderer loads UMD component
|
|
13
|
+
▼
|
|
14
|
+
src/lib/components/DashEChartsX.tsx
|
|
15
|
+
├─ effect initializes ECharts with option/theme/renderer
|
|
16
|
+
├─ ResizeObserver schedules chart.resize()
|
|
17
|
+
└─ cleanup disconnects observers and disposes the chart
|
|
18
|
+
│
|
|
19
|
+
▼
|
|
20
|
+
ECharts Canvas or SVG renderer
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Python supplies props through Dash. For any future browser-to-Python events, use guarded `setProps({ ... })` calls; never assume the Dash bridge exists outside the renderer.
|
|
24
|
+
|
|
25
|
+
## File Boundaries
|
|
26
|
+
|
|
27
|
+
| Path | Responsibility |
|
|
28
|
+
| ------------------------------------- | ------------------------------------------------------------------------------ |
|
|
29
|
+
| `src/lib/components/DashEChartsX.tsx` | React lifecycle, ECharts initialization, option/theme/renderer props, resizing |
|
|
30
|
+
| `src/index.ts` | Vite library exports |
|
|
31
|
+
| `dash_echartsx/utils.py` | Python option helpers |
|
|
32
|
+
| `dash_echartsx/__init__.py` | Python public export and Dash asset registration |
|
|
33
|
+
| `dash_echartsx/metadata.json` | Generated prop metadata |
|
|
34
|
+
| `dash_echartsx/DashEChartsX.py` | Generated Dash Python wrapper |
|
|
35
|
+
| `dash_echartsx/dash_echartsx.es.js` | Generated ESM bundle for bundler consumers |
|
|
36
|
+
| `dash_echartsx/dash_echartsx.umd.js` | Generated UMD bundle loaded by Dash |
|
|
37
|
+
| `tests/` | Flat Python and `dash_duo` browser test suite |
|
|
38
|
+
| `tests/conftest.py` | Shared ChromeDriver, headless CI, and Linux WebGL/SwiftShader setup |
|
|
39
|
+
|
|
40
|
+
## Pitfalls
|
|
41
|
+
|
|
42
|
+
| Avoid | Prefer |
|
|
43
|
+
| ------------------------------------------------ | ------------------------------------------------------------------------ |
|
|
44
|
+
| Initialize ECharts during React render | Initialize in an effect and dispose in cleanup |
|
|
45
|
+
| Reinitialize after every option update | Call `setOption`; only recreate for theme/renderer changes |
|
|
46
|
+
| Run `chart.resize()` for every observer callback | Coalesce with an animation frame and cancel it on cleanup |
|
|
47
|
+
| Resize a collapsed, zero-size element | Wait for positive width and height |
|
|
48
|
+
| Hardcode a pixel width/height | Use responsive defaults and caller-overridable `style` |
|
|
49
|
+
| Mutate incoming option/theme objects | Treat them as caller-owned, immutable props |
|
|
50
|
+
| Pass option strings as executable callbacks | Keep JSON serializable; add a reviewed explicit callback API if required |
|
|
51
|
+
| Edit generated assets/wrappers directly | Change TSX/Python source and run `npm run build` |
|
|
52
|
+
| Add ESM to Dash `_js_dist` | Register only the UMD bundle |
|
|
53
|
+
| Bundle a second React runtime | Keep React external in Vite UMD output |
|
|
54
|
+
|
|
55
|
+
## Commands
|
|
56
|
+
|
|
57
|
+
The current checks are `npm run build`, `npm test`, `npm run lint`, `npm run typecheck`, `uv run ruff check .`, `uv run black --check dash_echartsx tests scripts`, and `uv run pytest`. JavaScript utility unit tests live in `src/lib/utils/`; Python component and Selenium integration tests live in `tests/` and use the `integration` marker. `tests/conftest.py` installs a matching ChromeDriver, configures Linux SwiftShader for WebGL, and enables headless browser mode when `CI` is set. The CI workflow tests Python 3.10–3.14 and ECharts 5/6 on Ubuntu, macOS, and Windows, and builds wheel/source distribution artifacts for every OS/Python pair; pull request runs upload those artifacts for review. Firefox integration tests run separately on Ubuntu. Use `CI=true uv run pytest` to reproduce the headless Chrome suite locally.
|
|
58
|
+
|
|
59
|
+
## AI option generation
|
|
60
|
+
|
|
61
|
+
Use `.github/skills/echarts-option-generator/SKILL.md` and its prompt
|
|
62
|
+
templates when translating Python dictionaries or Pandas data into chart
|
|
63
|
+
options. Validate JSON before using it in a Dash callback:
|
|
64
|
+
|
|
65
|
+
```sh
|
|
66
|
+
npm run echarts:validate -- path/to/option.json
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The validator checks against the pinned ECharts 5.6.0 option declarations and
|
|
70
|
+
verifies that core series types are registered by `DashEChartsX`. ECharts-GL
|
|
71
|
+
options require `--enable-gl`; their extension fields are not fully covered by
|
|
72
|
+
the core ECharts type schema. The ECharts declarations are extensible and may
|
|
73
|
+
accept unknown option keys, so this is not a complete JSON Schema validator.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Create a report to help us improve (bugs, regressions)
|
|
4
|
+
title: "[BUG] "
|
|
5
|
+
labels: bug
|
|
6
|
+
assignees: ""
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Description (required)
|
|
10
|
+
|
|
11
|
+
<!--
|
|
12
|
+
Provide a clear and concise description of the bug.
|
|
13
|
+
-->
|
|
14
|
+
|
|
15
|
+
## Acceptance Criteria
|
|
16
|
+
|
|
17
|
+
- [ ] The bug is reproducible following the steps below
|
|
18
|
+
- [ ] Clear expected vs actual behaviour is stated
|
|
19
|
+
|
|
20
|
+
## Steps to reproduce (required)
|
|
21
|
+
|
|
22
|
+
<!--
|
|
23
|
+
1.
|
|
24
|
+
2.
|
|
25
|
+
3.
|
|
26
|
+
-->
|
|
27
|
+
|
|
28
|
+
## Expected behavior
|
|
29
|
+
|
|
30
|
+
<!--
|
|
31
|
+
Describe what you expected to happen.
|
|
32
|
+
-->
|
|
33
|
+
|
|
34
|
+
## Actual behavior
|
|
35
|
+
|
|
36
|
+
<!--
|
|
37
|
+
Describe what actually happened, include error messages and stack traces.
|
|
38
|
+
-->
|
|
39
|
+
|
|
40
|
+
## Environment
|
|
41
|
+
|
|
42
|
+
<!--
|
|
43
|
+
- dash-echartsx version:
|
|
44
|
+
- Python version:
|
|
45
|
+
- Browser / OS:
|
|
46
|
+
-->
|
|
47
|
+
|
|
48
|
+
## Proposed fix (optional)
|
|
49
|
+
|
|
50
|
+
<!--
|
|
51
|
+
If known, describe a possible fix.
|
|
52
|
+
-->
|
|
53
|
+
|
|
54
|
+
## Additional context
|
|
55
|
+
|
|
56
|
+
<!--
|
|
57
|
+
Add any other context, screenshots, or logs.
|
|
58
|
+
-->
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: General issue
|
|
3
|
+
about: Report a bug, request a feature, or propose maintenance work
|
|
4
|
+
title: ""
|
|
5
|
+
labels: ""
|
|
6
|
+
assignees: ""
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Summary
|
|
10
|
+
|
|
11
|
+
<!--
|
|
12
|
+
Provide a concise summary of the issue or feature request.
|
|
13
|
+
-->
|
|
14
|
+
|
|
15
|
+
## Steps to reproduce (for bugs)
|
|
16
|
+
|
|
17
|
+
<!--
|
|
18
|
+
1. Go to '...'
|
|
19
|
+
2. Click on '...'
|
|
20
|
+
3. See error
|
|
21
|
+
-->
|
|
22
|
+
|
|
23
|
+
## Expected behavior
|
|
24
|
+
|
|
25
|
+
<!--
|
|
26
|
+
Describe what you expected to happen.
|
|
27
|
+
-->
|
|
28
|
+
|
|
29
|
+
## Actual behavior
|
|
30
|
+
|
|
31
|
+
<!--
|
|
32
|
+
Describe what actually happened, including any error messages and stack traces.
|
|
33
|
+
-->
|
|
34
|
+
|
|
35
|
+
## Proposed solution (optional)
|
|
36
|
+
|
|
37
|
+
<!--
|
|
38
|
+
If you have a suggested fix or approach, describe it here.
|
|
39
|
+
-->
|
|
40
|
+
|
|
41
|
+
## Environment
|
|
42
|
+
|
|
43
|
+
<!--
|
|
44
|
+
- dash-echartsx version:
|
|
45
|
+
- Python version:
|
|
46
|
+
- Browser / OS:
|
|
47
|
+
-->
|
|
48
|
+
|
|
49
|
+
## Additional context
|
|
50
|
+
|
|
51
|
+
<!--
|
|
52
|
+
Add any other context or screenshots about the issue here.
|
|
53
|
+
-->
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Story / Feature request
|
|
3
|
+
about: Describe a new feature or improvement
|
|
4
|
+
title: "[STORY] "
|
|
5
|
+
labels: enhancement
|
|
6
|
+
assignees: ""
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Description (required)
|
|
10
|
+
|
|
11
|
+
<!--
|
|
12
|
+
Provide a clear and concise description of the requested feature or story.
|
|
13
|
+
-->
|
|
14
|
+
|
|
15
|
+
## Acceptance Criteria (required)
|
|
16
|
+
|
|
17
|
+
- [ ] Clear success criteria for the story
|
|
18
|
+
- [ ] Any constraints or compatibility notes
|
|
19
|
+
|
|
20
|
+
## Additional context
|
|
21
|
+
|
|
22
|
+
<!--
|
|
23
|
+
Add any other context, mockups, or links.
|
|
24
|
+
-->
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# GitHub Copilot Instructions — dash-echartsx
|
|
2
|
+
|
|
3
|
+
These repository-wide rules describe the current Dash/EChartsX architecture.
|
|
4
|
+
See [AI_CONTEXT.md](AI_CONTEXT.md) for data flow and `.agent/skills/` plus
|
|
5
|
+
`.github/skills/` for task-specific workflows. Use the
|
|
6
|
+
`echarts-option-generator` skill when generating or validating option payloads.
|
|
7
|
+
|
|
8
|
+
## Project Invariants
|
|
9
|
+
|
|
10
|
+
1. **Chart lifecycle:** Initialize ECharts only in `useEffect`; always dispose the instance in cleanup. Pair observers/listeners and scheduled frames with cleanup.
|
|
11
|
+
2. **Dash bridge:** Send client state through `setProps({ ... })` only when `setProps` exists.
|
|
12
|
+
3. **Prop documentation:** Document public TSX props with JSDoc. `npm run build` generates component metadata, Python wrappers, and PropTypes from TSX.
|
|
13
|
+
4. **Options:** Keep option/theme data JSON-compatible. Never evaluate arbitrary Python strings as JavaScript callbacks.
|
|
14
|
+
5. **Source of truth:** React source is `src/lib/components/`, exports are in `src/index.ts`, Python helpers are in `dash_echartsx/`, and tests are in `tests/`. Generated bundles, wrappers, metadata, and `proptypes.js` must be regenerated with `npm run build`, not hand-edited.
|
|
15
|
+
6. **Dash assets:** Register only the UMD file in `dash_echartsx/__init__.py`; keep React external in the Vite UMD build.
|
|
16
|
+
7. **Responsive sizing:** Do not hardcode pixel dimensions. Observe the wrapper, coalesce resize notifications, skip zero-sized containers, and clean up all pending work.
|
|
17
|
+
8. **Engine props:** Supported renderer values are `canvas` and `svg`; supported themes are `light`, `dark`, or a custom JSON object.
|
|
18
|
+
|
|
19
|
+
## Verification
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
uv sync --group dev
|
|
23
|
+
npm ci
|
|
24
|
+
npm run build
|
|
25
|
+
npm run lint
|
|
26
|
+
npm run typecheck
|
|
27
|
+
uv run ruff check .
|
|
28
|
+
uv run black --check dash_echartsx tests
|
|
29
|
+
uv run pytest
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
`npm test` runs JavaScript utility tests. Browser tests use `dash_duo` from
|
|
33
|
+
`dash[testing]` in `tests/`.
|
|
34
|
+
The shared Selenium configuration is in `tests/conftest.py`: it installs a
|
|
35
|
+
matching ChromeDriver, enables headless mode when `CI` is set, and configures
|
|
36
|
+
Linux WebGL/SwiftShader. The CI matrix tests Python 3.10–3.14 with supported
|
|
37
|
+
ECharts versions on Ubuntu, macOS, and Windows. Use the standard `uv run
|
|
38
|
+
pytest` command; set `CI=true` to reproduce headless CI behavior locally.
|
|
39
|
+
|
|
40
|
+
## Skills
|
|
41
|
+
|
|
42
|
+
- `scaffold-dash-echartsx-component` for a new component or public prop.
|
|
43
|
+
- `echarts-option-validator` for option/module/theme/map reviews.
|
|
44
|
+
- `dash-duo-test-generator` for browser-level chart rendering and prop updates.
|
|
45
|
+
- `dash-echartsx-test-runner` for the current Python and browser test layout.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
# Node.js Ecosystem
|
|
4
|
+
- package-ecosystem: "npm"
|
|
5
|
+
directory: "/"
|
|
6
|
+
schedule:
|
|
7
|
+
interval: "daily"
|
|
8
|
+
time: "02:00"
|
|
9
|
+
open-pull-requests-limit: 10
|
|
10
|
+
labels:
|
|
11
|
+
- "dependencies"
|
|
12
|
+
- "security"
|
|
13
|
+
- "automated-pr"
|
|
14
|
+
commit-message:
|
|
15
|
+
prefix: "chore(deps)"
|
|
16
|
+
|
|
17
|
+
# Python Ecosystem
|
|
18
|
+
- package-ecosystem: "uv"
|
|
19
|
+
directory: "/"
|
|
20
|
+
schedule:
|
|
21
|
+
interval: "daily"
|
|
22
|
+
time: "02:00"
|
|
23
|
+
open-pull-requests-limit: 10
|
|
24
|
+
labels:
|
|
25
|
+
- "dependencies"
|
|
26
|
+
- "security"
|
|
27
|
+
- "automated-pr"
|
|
28
|
+
commit-message:
|
|
29
|
+
prefix: "chore(deps-python)"
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
## Summary
|
|
2
|
+
|
|
3
|
+
<!-- Describe the change and why it is needed. -->
|
|
4
|
+
|
|
5
|
+
## Related issue
|
|
6
|
+
|
|
7
|
+
<!-- Use Fixes #<number>, Closes #<number>, or Related to #<number>. -->
|
|
8
|
+
|
|
9
|
+
- #
|
|
10
|
+
|
|
11
|
+
## Change type
|
|
12
|
+
|
|
13
|
+
- [ ] Bug fix
|
|
14
|
+
- [ ] Feature
|
|
15
|
+
- [ ] Documentation
|
|
16
|
+
- [ ] Build/CI maintenance
|
|
17
|
+
|
|
18
|
+
## Verification
|
|
19
|
+
|
|
20
|
+
- [ ] `npm run build`
|
|
21
|
+
- [ ] `npm run lint`
|
|
22
|
+
- [ ] `npm run typecheck`
|
|
23
|
+
- [ ] `uv run ruff check .`
|
|
24
|
+
- [ ] `uv run pytest`
|
|
25
|
+
- [ ] Browser behavior checked when applicable
|
|
26
|
+
|
|
27
|
+
## Notes for reviewers
|
|
28
|
+
|
|
29
|
+
<!-- Include compatibility, generated-file, or behavior notes. -->
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: echarts-option-generator
|
|
3
|
+
description: Generate and validate ECharts 5 option objects for DashEChartsX from Python dictionaries or Pandas DataFrames.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# ECharts Option Generator
|
|
7
|
+
|
|
8
|
+
Use this skill when creating, transforming, optimizing, or reviewing an ECharts
|
|
9
|
+
option payload for this repository.
|
|
10
|
+
|
|
11
|
+
## Required context
|
|
12
|
+
|
|
13
|
+
1. Read `.github/AI_CONTEXT.md` and `.github/copilot-instructions.md`.
|
|
14
|
+
2. Use the current Python component API: `from dash_echartsx import
|
|
15
|
+
DashEChartsX`. Do not generate legacy `dash_echarts.DashECharts` code or
|
|
16
|
+
deprecated `app.run_server` calls.
|
|
17
|
+
3. Check `src/lib/components/DashEChartsX.tsx` before selecting chart types.
|
|
18
|
+
Core series types must have their ECharts chart module registered there.
|
|
19
|
+
ECharts-GL series additionally require `enable_gl=True`.
|
|
20
|
+
4. Keep the option JSON-compatible. Use only documented `js_function(...)`
|
|
21
|
+
markers for developer-authored callbacks; never translate arbitrary
|
|
22
|
+
Python strings into executable JavaScript.
|
|
23
|
+
|
|
24
|
+
## Generation procedure
|
|
25
|
+
|
|
26
|
+
1. Preserve the meaning, units, ordering, and caller-owned input data. Do not
|
|
27
|
+
silently discard columns, rows, nulls, or categories.
|
|
28
|
+
2. If chart type, axis mapping, units, aggregation, missing-value behavior, or
|
|
29
|
+
downsampling policy is ambiguous, ask before choosing.
|
|
30
|
+
3. Generate the option as a plain JSON object. Normalize NumPy/Pandas scalar
|
|
31
|
+
values and timestamps into JSON-compatible values without changing their
|
|
32
|
+
meaning. Keep large data payloads bounded only when the user requests or
|
|
33
|
+
approves a limit.
|
|
34
|
+
4. For a map, verify every `series[].map` name is registered by the component's
|
|
35
|
+
`maps=[{"name": ..., "geoJSON": ...}]` property. Do not assume a projection
|
|
36
|
+
or map provider.
|
|
37
|
+
5. Validate the option before placing it in or returning it from a Dash
|
|
38
|
+
callback:
|
|
39
|
+
|
|
40
|
+
```console
|
|
41
|
+
npm run echarts:validate -- path/to/option.json
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Pipe generated JSON to the validator when no file is needed:
|
|
45
|
+
|
|
46
|
+
```console
|
|
47
|
+
python generate_option.py | npm run echarts:validate
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
For ECharts-GL options, pass `--enable-gl` and set `enable_gl=True` on
|
|
51
|
+
`DashEChartsX`. The validator checks the option against the pinned official
|
|
52
|
+
ECharts 5.6.0 `EChartsOption` declarations and checks core series against
|
|
53
|
+
modules actually registered by this component. GL-specific nested fields
|
|
54
|
+
are not fully covered by the ECharts core declarations. The declarations
|
|
55
|
+
are extensible and may accept unknown option keys, so this is not a complete
|
|
56
|
+
JSON Schema validator; state these limits.
|
|
57
|
+
|
|
58
|
+
6. Only after validation succeeds, use the option as the `option` prop or
|
|
59
|
+
return it from a callback with `Output("chart", "option")`.
|
|
60
|
+
|
|
61
|
+
## Output format
|
|
62
|
+
|
|
63
|
+
Return:
|
|
64
|
+
|
|
65
|
+
1. The validated JSON option.
|
|
66
|
+
2. A concise DashEChartsX usage snippet, including `maps` or `enable_gl` when
|
|
67
|
+
needed.
|
|
68
|
+
3. The exact validation command and its result.
|
|
69
|
+
4. Any remaining caveat, such as ECharts-GL extension typing or a chart module
|
|
70
|
+
not currently registered by the component.
|
|
71
|
+
|
|
72
|
+
Prompt templates are in `prompts/`.
|
dash_echartsx-0.1.0/.github/skills/echarts-option-generator/prompts/pandas-dataframe-to-option.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Convert a Pandas DataFrame into a DashEChartsX option
|
|
2
|
+
|
|
3
|
+
You are generating an Apache ECharts 5 option and Python callback example for
|
|
4
|
+
this repository's `DashEChartsX` component.
|
|
5
|
+
|
|
6
|
+
## Input
|
|
7
|
+
|
|
8
|
+
```text
|
|
9
|
+
{{DATAFRAME_DESCRIPTION}}
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```python
|
|
13
|
+
{{DATAFRAME_CREATION_OR_SAMPLE}}
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Requirements
|
|
17
|
+
|
|
18
|
+
- Confirm which column is the category/time axis, which columns are measures,
|
|
19
|
+
and whether a row represents a sample, aggregate, or series. Ask if unclear.
|
|
20
|
+
- Preserve column names, row order, units, and timestamp meaning. Do not infer
|
|
21
|
+
aggregation, timezone, null handling, sorting, or downsampling policy.
|
|
22
|
+
- Keep the callback payload JSON-compatible. Convert Pandas/NumPy scalar
|
|
23
|
+
values explicitly and handle missing values only according to the user's
|
|
24
|
+
stated policy.
|
|
25
|
+
- Select only chart series whose ECharts modules are registered in
|
|
26
|
+
`src/lib/components/DashEChartsX.tsx`. Keep series data aligned with the
|
|
27
|
+
declared axes and categories.
|
|
28
|
+
- Avoid copying large frames on every callback. For streaming data, prefer a
|
|
29
|
+
bounded update or `append_data` only when the chosen ECharts series type
|
|
30
|
+
supports ECharts `appendData`.
|
|
31
|
+
- Do not encode JavaScript callbacks as strings. If requested, show the
|
|
32
|
+
explicit `js_function(...)` marker separately and identify it as executable
|
|
33
|
+
developer-authored code.
|
|
34
|
+
- If the option uses ECharts-GL, state that `enable_gl=True` is required.
|
|
35
|
+
|
|
36
|
+
## Deliverables
|
|
37
|
+
|
|
38
|
+
1. The ECharts option JSON.
|
|
39
|
+
2. The Python conversion/callback snippet, with every data transformation
|
|
40
|
+
explained.
|
|
41
|
+
3. The exact `DashEChartsX` callback wiring.
|
|
42
|
+
4. The output option validated before callback use with:
|
|
43
|
+
|
|
44
|
+
```console
|
|
45
|
+
python make_option.py | npm run echarts:validate
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Add `--enable-gl` for ECharts-GL options.
|
|
49
|
+
|
|
50
|
+
5. Validation results and any assumptions or remaining schema limitations.
|