# Watt42 Viewlib Supports building a view for Watt42 systems. ## Prerequisites You should be familiar with Python. You need poetry installed: - [Poetry](https://python-poetry.org/docs/#installing-with-the-official-installer) ## Demo You can [run the sample online](https://viewlib-demo.watt42.com). The sample code is in [sample.py](./sample.py). TODO: provide more sophisticated demos online. ## Documentation ### Installation Make sure you have poetry installed (see above), then run: ```bash poetry install ``` You can now run the sample view in dev mode with: ```bash poetry run panel serve sample.py --dev ``` Dev mode enables hot reloading, so any changes you make to the code will be reflected immediately in the browser. Your view will be available at `http://localhost:5006/sample`. In order for the view to work, you need to configure an access token, and the Watt42 system that you want to use. See #how-to-use below. ### How to use Build your own front end for a Watt42 system by creating a Python script that uses Viewlib. Start off with the sample code in [sample.py](./sample.py). You can then extend the view by adding more widgets and logic. 1. Follow the installation instructions above. 2. Make sure you have a Watt42 system set up, and you have an access token for it. (TODO: link on how to do this) 3. Set the following environment variables: - `WATT42_SYSTEM_ID`: The ID of your Watt42 system. - `WATT42_API_TOKEN`: Your access token. ### Howtos - See above on how to use Viewlib to build your own view. - [How to add a diagram](https://source.c3.uber5.com/watt42-public/watt42_viewlib/src/branch/main/docs/howto_add_diagram.md) - Learn more about how to build views with Panel: - [Panel Tutorials](https://panel.holoviz.org/tutorials/index.html) - [Panel Explanation](https://panel.holoviz.org/explanation/index.html) ## Reference - [Watt42 Viewlib Documentation](https://source.c3.uber5.com/watt42-public/watt42_viewlib/src/branch/main/docs/reference.md) - Visual components: - [Panel Component Gallery](https://panel.holoviz.org/reference/index.html) - [Panel App Gallery](https://panel.holoviz.org/gallery/index.html) - [Panel API Reference](https://panel.holoviz.org/api/index.html)