Name | stlin JSON |
Version |
0.1.0
JSON |
| download |
home_page | None |
Summary | A Streamlit component for rendering data lineage from Cognite Data Fusion |
upload_time | 2025-08-26 18:39:56 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | None |
keywords |
streamlit
lineage
cognite
visualization
component
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Stlin - Streamlit Data Lineage Component
A Streamlit component for rendering interactive data lineage graphs from Cognite Data Fusion. Built with React, TypeScript, and React Flow.
## Installation
```bash
pip install stlin
```
## Quick Start
```python
import streamlit as st
from stlin import render_lineage
# Your lineage data (list of data processes with sources and destinations)
lineage_data = [
{
"externalId": "transformation_1",
"name": "Process Raw Assets",
"query": "SELECT * FROM raw_assets WHERE status = 'active'",
"destination": {"type": "raw", "database": "processed", "table": "assets"},
"sources": ["raw_assets", "_cdf.assets"],
"destinations": ["processed.assets"],
"lastFinishedJob": {
"status": "success",
"startedTime": 1692345600000,
"finishedTime": 1692345660000
}
}
# ... more transformations
]
# Render the component
selected_data = render_lineage(
data=lineage_data,
focus_mode=True,
side_bar_width=300,
height=800
)
# Handle selection
if selected_data:
st.write("Selected:", selected_data)
# Example of returned data structure:
# For transformation: [{"type": "Data Process", "subType": "Transformation", "address": "transformation_1", "sources": [...], "destinations": [...], "query": "SELECT ..."}]
# For data object: [{"type": "Data Object", "subType": "Staging", "address": "raw_assets", "producedBy": [...], "consumedBy": [...]}]
```
## API Reference
### `render_lineage`
The main component function for rendering data lineage.
**Parameters:**
- `data` *(list)*: List of transformation dictionaries containing lineage information
- `focus_mode` *(bool, default=True)*: Whether to show only direct lineage path or full graph
- `side_bar_width` *(int, default=300)*: Initial width of navigation sidebar in pixels
- `height` *(int, default=800)*: Height of the component in pixels
- `key` *(str, optional)*: Unique component key for Streamlit
**Returns:**
- For **data process nodes**: Returns a structured record with:
- `type`: "Data Process"
- `subType`: "Transformation"
- `address`: transformation external ID
- `sources`: list of source identifiers
- `destinations`: list of destination identifiers
- `query`: SQL query or transformation logic
- For **data object nodes**: Returns a structured record with:
- `type`: "Data Object"
- `subType`: specific data object type (e.g., "Staging", "Assets", "Data Model View", etc.)
- `address`: data object identifier
- `producedBy`: list of transformation IDs that produce this data object
- `consumedBy`: list of transformation IDs that consume this data object
- Returns **empty list** if nothing is selected
## Data Format
The component expects transformation data in the following format:
```python
{
"externalId": "unique_transformation_id",
"name": "Human Readable Name",
"query": "SELECT * FROM source_table",
"destination": {
"type": "raw",
"database": "target_db",
"table": "target_table"
},
"sources": ["source1", "source2"], # List of source identifiers
"destinations": ["dest1", "dest2"], # List of destination identifiers
"lastFinishedJob": {
"status": "success",
"startedTime": 1692345600000,
"finishedTime": 1692345660000
}
}
```
### Supported Data Object Types
The component automatically categorizes data objects based on their identifiers:
- **Legacy CDF Resources**: `_cdf.assets`, `_cdf.events`, `_cdf.timeseries`, etc.
- **Data Model Instances**: `cdf_data_models()`, `cdf_nodes()`, `cdf_edges()`
- **Raw/Staging Tables**: `database.table` format
- **Unknown**: Any unrecognized format
## Development
### Building from Source
```bash
git clone https://github.com/evertoncolling/stlin.git
cd stlin
# Install dependencies
uv sync
# Build frontend
cd stlin/frontend
npm install
npm run build
# Build Python package
cd ../..
python -m build
```
### Running the Example
```bash
# Install in development mode
uv pip install -e .
# Run the example app
streamlit run example_app.py
```
## License
MIT License - see LICENSE file for details.
Raw data
{
"_id": null,
"home_page": null,
"name": "stlin",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "streamlit, lineage, cognite, visualization, component",
"author": null,
"author_email": "Everton Colling <evertoncolling@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/05/c5/3a54aade359501bc4d1d6a3f3dfe7e852e2fc38f6f964a16808815cec1b8/stlin-0.1.0.tar.gz",
"platform": null,
"description": "# Stlin - Streamlit Data Lineage Component\n\nA Streamlit component for rendering interactive data lineage graphs from Cognite Data Fusion. Built with React, TypeScript, and React Flow.\n\n## Installation\n\n```bash\npip install stlin\n```\n\n## Quick Start\n\n```python\nimport streamlit as st\nfrom stlin import render_lineage\n\n# Your lineage data (list of data processes with sources and destinations)\nlineage_data = [\n {\n \"externalId\": \"transformation_1\",\n \"name\": \"Process Raw Assets\",\n \"query\": \"SELECT * FROM raw_assets WHERE status = 'active'\",\n \"destination\": {\"type\": \"raw\", \"database\": \"processed\", \"table\": \"assets\"},\n \"sources\": [\"raw_assets\", \"_cdf.assets\"],\n \"destinations\": [\"processed.assets\"],\n \"lastFinishedJob\": {\n \"status\": \"success\",\n \"startedTime\": 1692345600000,\n \"finishedTime\": 1692345660000\n }\n }\n # ... more transformations\n]\n\n# Render the component\nselected_data = render_lineage(\n data=lineage_data,\n focus_mode=True,\n side_bar_width=300,\n height=800\n)\n\n# Handle selection\nif selected_data:\n st.write(\"Selected:\", selected_data)\n # Example of returned data structure:\n # For transformation: [{\"type\": \"Data Process\", \"subType\": \"Transformation\", \"address\": \"transformation_1\", \"sources\": [...], \"destinations\": [...], \"query\": \"SELECT ...\"}]\n # For data object: [{\"type\": \"Data Object\", \"subType\": \"Staging\", \"address\": \"raw_assets\", \"producedBy\": [...], \"consumedBy\": [...]}]\n```\n\n## API Reference\n\n### `render_lineage`\n\nThe main component function for rendering data lineage.\n\n**Parameters:**\n\n- `data` *(list)*: List of transformation dictionaries containing lineage information\n- `focus_mode` *(bool, default=True)*: Whether to show only direct lineage path or full graph\n- `side_bar_width` *(int, default=300)*: Initial width of navigation sidebar in pixels\n- `height` *(int, default=800)*: Height of the component in pixels\n- `key` *(str, optional)*: Unique component key for Streamlit\n\n**Returns:**\n\n- For **data process nodes**: Returns a structured record with:\n - `type`: \"Data Process\"\n - `subType`: \"Transformation\"\n - `address`: transformation external ID\n - `sources`: list of source identifiers\n - `destinations`: list of destination identifiers\n - `query`: SQL query or transformation logic\n- For **data object nodes**: Returns a structured record with:\n - `type`: \"Data Object\"\n - `subType`: specific data object type (e.g., \"Staging\", \"Assets\", \"Data Model View\", etc.)\n - `address`: data object identifier\n - `producedBy`: list of transformation IDs that produce this data object\n - `consumedBy`: list of transformation IDs that consume this data object\n- Returns **empty list** if nothing is selected\n\n## Data Format\n\nThe component expects transformation data in the following format:\n\n```python\n{\n \"externalId\": \"unique_transformation_id\",\n \"name\": \"Human Readable Name\",\n \"query\": \"SELECT * FROM source_table\",\n \"destination\": {\n \"type\": \"raw\",\n \"database\": \"target_db\",\n \"table\": \"target_table\"\n },\n \"sources\": [\"source1\", \"source2\"], # List of source identifiers\n \"destinations\": [\"dest1\", \"dest2\"], # List of destination identifiers\n \"lastFinishedJob\": {\n \"status\": \"success\",\n \"startedTime\": 1692345600000,\n \"finishedTime\": 1692345660000\n }\n}\n```\n\n### Supported Data Object Types\n\nThe component automatically categorizes data objects based on their identifiers:\n\n- **Legacy CDF Resources**: `_cdf.assets`, `_cdf.events`, `_cdf.timeseries`, etc.\n- **Data Model Instances**: `cdf_data_models()`, `cdf_nodes()`, `cdf_edges()`\n- **Raw/Staging Tables**: `database.table` format\n- **Unknown**: Any unrecognized format\n\n## Development\n\n### Building from Source\n\n```bash\ngit clone https://github.com/evertoncolling/stlin.git\ncd stlin\n\n# Install dependencies\nuv sync\n\n# Build frontend\ncd stlin/frontend\nnpm install\nnpm run build\n\n# Build Python package\ncd ../..\npython -m build\n```\n\n### Running the Example\n\n```bash\n# Install in development mode\nuv pip install -e .\n\n# Run the example app\nstreamlit run example_app.py\n```\n\n## License\n\nMIT License - see LICENSE file for details.\n",
"bugtrack_url": null,
"license": null,
"summary": "A Streamlit component for rendering data lineage from Cognite Data Fusion",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/evertoncolling/stlin",
"Issues": "https://github.com/evertoncolling/stlin/issues",
"Repository": "https://github.com/evertoncolling/stlin"
},
"split_keywords": [
"streamlit",
" lineage",
" cognite",
" visualization",
" component"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "c5d6e11ef77aeae19d1f40cf8250721cc83256b2db3c79641d97237b60f44a7f",
"md5": "fedfcd2525ce5e28b8ddc6a40478a44c",
"sha256": "008977f2cca78d9493f7bf11bfb58ac8ce78d7ec21e30bb764e020272c38cf6a"
},
"downloads": -1,
"filename": "stlin-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fedfcd2525ce5e28b8ddc6a40478a44c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 169493,
"upload_time": "2025-08-26T18:39:55",
"upload_time_iso_8601": "2025-08-26T18:39:55.303207Z",
"url": "https://files.pythonhosted.org/packages/c5/d6/e11ef77aeae19d1f40cf8250721cc83256b2db3c79641d97237b60f44a7f/stlin-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "05c53a54aade359501bc4d1d6a3f3dfe7e852e2fc38f6f964a16808815cec1b8",
"md5": "24367ad9bfc8368ade01fa4f89da49e3",
"sha256": "839cb643a836569aad4e6363fee76593e6c76bfeaced7ea08b689e1d52c5c39b"
},
"downloads": -1,
"filename": "stlin-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "24367ad9bfc8368ade01fa4f89da49e3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 170795,
"upload_time": "2025-08-26T18:39:56",
"upload_time_iso_8601": "2025-08-26T18:39:56.717487Z",
"url": "https://files.pythonhosted.org/packages/05/c5/3a54aade359501bc4d1d6a3f3dfe7e852e2fc38f6f964a16808815cec1b8/stlin-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-26 18:39:56",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "evertoncolling",
"github_project": "stlin",
"github_not_found": true,
"lcname": "stlin"
}