Based on https://github.com/klayoutmatthias/canvas2canvas
From a python virtual environment run:
python -m pip install kweb
export KWEB_FILESLOCATION="/path/to/gds/folder" # or the windows equivalent with set
uvicorn --reload kweb.default:appKWeb offers two basic apps:
-
Browser:
A version that provides a version with a file browser for a folder and the kweb viewer for viewing the gds file in that folder. This can be used by importing the function
kweb.browser.get_appand settings theKWEB_FILESLOCATIONenv variable of passingfileslocation=<Path object for target folder>to the function. Alternatively there is a default one inkweb.default.appthat will only look for the env variable. -
Viewer:
Only enables the
/gds/<filename>endpoints, no root path, i.e. no file browser. Available atkweb.viewer.get_app. This version doesn't provide a listener for the env variable. Use thefileslocationparameter in the function instead.
# Clone the repository to your local
git clone https://github.com/gdsfactory/kweb.git
# Install the necessary dependencies
cd /kweb
python -m pip install -e .[dev]export KWEB_FILESLOCATION=/path/to/folder/with/gdsfilescd src/kweb
uvicorn --reload default:appCopy the link http://127.0.0.1:8000/gds/file.gds (or http://localhost:8000/gds/file.gds also works) to your browser to open the waveguide example
Please make sure you have also installed pre-commit before committing:
python -m pip install pre-commit
pre-commit install