docs/DEVELOPMENT.md
This guide explains how to set up a local development environment for PyGWalker with hot-reloading support.
git clone https://github.com/Kanaries/pygwalker.git
cd pygwalker
# Create and activate virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install pygwalker in editable mode with dev dependencies
pip install -e ".[dev]"
cd app
yarn install
yarn build
app/src/cd app
yarn build:app # Faster than full build
This setup enables live reloading when you change frontend code.
cd app
yarn dev
The dev server will start at http://localhost:8769/pyg_dev_app/
In a new terminal:
source venv/bin/activate
jupyter lab --ServerProxy.servers="{'pyg_dev_app': {'command': [], 'absolute_url': True, 'port': 8769, 'timeout': 30}}"
In your Jupyter notebook, before importing pygwalker:
from pygwalker.services.global_var import GlobalVarManager
# Point pygwalker to the dev server
GlobalVarManager.set_component_url("/pyg_dev_app/")
# Now use pygwalker as normal
import pygwalker as pyg
pyg.walk(df)
Now any changes you make in app/src/ will hot-reload automatically!
GlobalVarManager.set_component_url("") # Empty string = use bundled JS
If you encounter React version errors or other strange issues, try a clean rebuild:
cd app
rm -rf node_modules
yarn install
yarn build
If you see 404 errors for .wasm files when using the dev server, ensure vite.config.ts has:
optimizeDeps: {
exclude: ['@kanaries/gw-dsl-parser'],
},
If you see CORS errors, make sure you're using the jupyter-server-proxy setup (Option B) rather than accessing the dev server directly.
pygwalker/
├── app/ # Frontend React application
│ ├── src/
│ │ ├── index.tsx # Main entry point
│ │ ├── components/ # React components
│ │ └── ...
│ ├── package.json
│ └── vite.config.ts
├── pygwalker/ # Python package
│ ├── api/ # Python API
│ ├── templates/ # HTML templates & built JS
│ │ └── dist/ # Built frontend assets
│ └── ...
└── docs/
cd app
yarn build # Builds all variants (iife, es, dsl-to-workflow, vega-to-dsl)
The built files are placed in pygwalker/templates/dist/.