Cognite STP renderer
This is a Streamlit library that can be used to show CAD models inside a Streamlit app. It works especially good when used inside Streamlit in Fusion, but can also be used in standalone Streamlit apps.
How to install
You simply install it by running
pip install streamlit-cognite-stp-renderer
How to use
Here is an example app
import streamlit as st
from stp_renderer import StpRendererParams, stp_renderer
from cognite.client import CogniteClient
client = CogniteClient()
state = stp_renderer(
client=client,
file_id=1234,
params=StpRendererParams(height=400),
key='stp_renderer'
)
st.header("STP Renderer:")
st.json(state)
Local development
It's recommended to add a clean environment. You need pip and node.
Clone repo
git clone git@github.com:cognitedata/streamlit-cognite-stp-renderer.git
Install Python packages
pip install streamlit
pip install cognite-sdk
Install NPM packages and start server
cd stp_renderer/frontend
yarn
HTTPS=true yarn start
Then open https://localhost:3001/ to accept bad certificate.
Open repo folder in another terminal. Install this package as development package
pip install -e .
Extract a token from Fusion, and start with
COGNITE_TOKEN="TOKEN" streamlit run examples/demo.py
Local development in fusion stlite
Make sure you have set stp_renderer/init.py:8
to _RELEASE = True.
Step 1) Build front end component with cd stp_renderer/frontend && yarn && yarn build Step 2) Build streamlit component with python -m build (hint: pip install build)
Step 3) Start local server python server.py
Open Fusion, create a Streamlit app and add the following the installed package
http://localhost:8000/dist/streamlit_stp_renderer-0.0.1-py3-none-any.whl
It will then load successfully inside Stlite.
Building a release version
In order to build a packaged release version, follow steps:
Set the 'RELEASE' environment variable to indicate to build system that you are
building a release version: export RELEASE=1.
Metadata
Release files for streamlit-cognite-stp-renderer 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| streamlit_cognite_stp_renderer-0.0.1.tar.gz | 16.7 MB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| streamlit_cognite_stp_renderer-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.5 MB
Release files / streamlit_cognite_stp_renderer-0.0.1.tar.gz
| Download URL | streamlit_cognite_stp_renderer-0.0.1.tar.gz |
|---|---|
| Size | 16.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8ae34940cc89cb252ad833d8f154eb653081dabe1afbb1059933665f11a435d9
|
|
BLAKE2b-256 checksum How to use checksums |
1db1117244351f6b774ac336eec9f7dfa6fdc0c7a1356db07991d42a17b7ab12
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.15
|
Release files / streamlit_cognite_stp_renderer-0.0.1-py3-none-any.whl
| Download URL | streamlit_cognite_stp_renderer-0.0.1-py3-none-any.whl |
|---|---|
| Size | 16.8 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0178b723d6358a936b02cb51fd96a17292b5fccad57c5dce0defb18c36589cb4
|
|
BLAKE2b-256 checksum How to use checksums |
7e505b7123aa853de1f72aa32c202548187978f4b6e4a2e79b8c257e11a5dfa9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.15
|
Security for streamlit-cognite-stp-renderer 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.