Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gdsfactory/kweb
KLayout Web Viewer
https://github.com/gdsfactory/kweb
Last synced: 3 months ago
JSON representation
KLayout Web Viewer
- Host: GitHub
- URL: https://github.com/gdsfactory/kweb
- Owner: gdsfactory
- License: mit
- Created: 2023-01-23T19:09:04.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-16T10:28:44.000Z (4 months ago)
- Last Synced: 2024-07-17T10:57:23.870Z (4 months ago)
- Language: CSS
- Size: 522 KB
- Stars: 26
- Watchers: 3
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome_photonics - kweb
- awesome-opensource-hardware - kweb
README
# kweb 2.0.3
KLayout Web Viewer ![demo](docs/_static/kweb.png)
Based on https://github.com/klayoutmatthias/canvas2canvas
## Install & Run
### Through pypi
From a python virtual environment run:
```bash
python -m pip install kweb
export KWEB_FILESLOCATION="/path/to/gds/folder" # or the windows equivalent with set
uvicorn --reload kweb.default:app
````#### Advanced Usage
KWeb 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_app` and settings the `KWEB_FILESLOCATION` env variable of passing
`fileslocation=` to the function. Alternatively there is a default one in `kweb.default.app` that
will only look for the env variable.- Viewer:
Only enables the `/gds/` endpoints, no root path, i.e. no file browser. Available at `kweb.viewer.get_app`. This version
doesn't provide a listener for the env variable. Use the `fileslocation` parameter in the function instead.### Development
#### Clone & Install
```bash
# 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]
```#### Set a folder for kweb to use when looking for gds files
```bash
export KWEB_FILESLOCATION=/path/to/folder/with/gdsfiles
```#### Run
```bash
cd src/kweb
uvicorn --reload default:app
```Copy 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
#### Contributing
Please make sure you have also installed pre-commit before committing:
```bash
python -m pip install pre-commit
pre-commit install
```