Skip to main content

Cognite 3D Reveal Streamlit

This is a Streamlit library that can be used to show 3D 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 cognite-streamlit-reveal

How to use

Here is an example app

import streamlit as st
import os
from cognite.streamlit import reveal
from cognite.client import CogniteClient

st.subheader("Cognite Reveal Streamlit example")
client = CogniteClient()
model_id = 123
revision_id = 234

selected_node_id = reveal(client, model_id, revision_id)
st.markdown("Selected node id: %d!" % int(selected_node_id))

Local development

It's recommended to add a clean environment. You need pip and node.

Clone repo git clone https://github.com/cognitedata/streamlit-cognite-reveal.git

Install Python packages pip install streamlit pip install cognite-sdk

Install NPM packages and start server

cd reveal/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 (reveal/init.py:8)[reveal/init.py:8] to _RELEASE = True.

Step 1) Build front end component with cd reveal/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/reveal_streamlit_component-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

steps to actually build the package

Metadata

Release files for streamlit-cognite-reveal 0.0.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for streamlit-cognite-reveal 0.0.11
File Size Uploaded Provenance Actions
streamlit_cognite_reveal-0.0.11.tar.gz 6.6 MB Without provenance Details for streamlit_cognite_reveal-0.0.11.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for streamlit-cognite-reveal 0.0.11
File Interpreter ABI Platform Actions
streamlit_cognite_reveal-0.0.11-py3-none-any.whl Python 3 none any Details for streamlit_cognite_reveal-0.0.11-py3-none-any.whl

Total release size: 13.2 MB

Release files / streamlit_cognite_reveal-0.0.11.tar.gz

Download URL streamlit_cognite_reveal-0.0.11.tar.gz
Size 6.6 MB
Tags Source
SHA-256 checksum
How to use checksums
21ec17bfac77a0f83415618f2f708fe1e49363f223e384899e0540d506dc287f
BLAKE2b-256 checksum
How to use checksums
d2019c216b00e979195a4a57ee2fb047493fd6c44247055df327bde6081bef94
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.10

Release files / streamlit_cognite_reveal-0.0.11-py3-none-any.whl

Download URL streamlit_cognite_reveal-0.0.11-py3-none-any.whl
Size 6.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
c25d7b535f1685a6e3bfe050894c105891108460d4dfd0e3c0816e3126a653fb
BLAKE2b-256 checksum
How to use checksums
b224b824e7fe7d0a04617b72cf1f6df1eaa3d67dec811f339e17a04617e1b8fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.10

Security for streamlit-cognite-reveal 0.0.11

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page