Skip to main content

KLayout API implementation of gdsfactory

Project description

kweb 2.0.4

KLayout Web Viewer demo

Based on https://github.com/klayoutmatthias/canvas2canvas

Install & Run

Through pypi

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: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=<Path object for target folder> 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/<filename> 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

# 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

export KWEB_FILESLOCATION=/path/to/folder/with/gdsfiles

Run

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:

python -m pip install pre-commit
pre-commit install

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kweb-2.0.4.tar.gz (430.0 kB view details)

Uploaded Source

Built Distribution

kweb-2.0.4-py3-none-any.whl (369.3 kB view details)

Uploaded Python 3

File details

Details for the file kweb-2.0.4.tar.gz.

File metadata

  • Download URL: kweb-2.0.4.tar.gz
  • Upload date:
  • Size: 430.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for kweb-2.0.4.tar.gz
Algorithm Hash digest
SHA256 d7a0f128e39a14daffcec7729639a80b6b94f45c1f95306dca7a0120f4cc6095
MD5 2b1d4b04531f934ab5e24cae6b054091
BLAKE2b-256 2cc1323720d064f7fdce9c5097aa351ec0144edf9680d65d719c63f6c3c37082

See more details on using hashes here.

File details

Details for the file kweb-2.0.4-py3-none-any.whl.

File metadata

  • Download URL: kweb-2.0.4-py3-none-any.whl
  • Upload date:
  • Size: 369.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for kweb-2.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 80c6b6a3c98306cdb896e1fb6280319c57aa438052afc94dba0a04f4273bc3c6
MD5 9ecd1a19c2d95d42fa1602652700be0d
BLAKE2b-256 7c4ac3357993793769904822d7b4f038fe92a4b5b30de213091ff4f201c7520c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page