Skip to main content

A custom Streamlit component for analytics cards

Project description

streamlit-analytics-cards

A project to create custom Streamlit components using React and TypeScript for analytics and insights.

View a demo: 💾 View it on PyPI: 👾

Using the component

Prerequisites

Installation

pip install streamlit-analytics-cards

Implementation

from streamlit_analytics_cards import card as stac
# Render the component in your Streamlit app
stac(
            template="CardOne",
            title="Attrition Diversity",
            subtitle="Female Attrition",
            main_value="4.7%",
            secondary_value="52",
            delta="Y/Y 5.1%, -0.4%",
            chart_data=df["Number of Exits"].tolist(),
            x_axis_label=df.columns[0],
            color_scheme={"background": "#FFFFFF", "text": "#000000"},
            key="card_1",
        )

For developers

Prerequisites

Before you start, ensure you have the following installed on your system:


Installation

  1. Clone the repository:

    git clone https://github.com/natxc/streamlit-analytics-cards.git
    cd streamlit-analytics-cards
    
  2. Set up the Python environment:

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
    pip install -r requirements.txt
    
  3. Install frontend dependencies: Navigate to the frontend/ folder and install the required Node.js packages:

    cd frontend
    npm install
    

Development

Run the Frontend

Start the development server for the React app:

npm start

This will start a local development server at http://localhost:3000.


Run the Streamlit

In the root directory, start the Streamlit app:

streamlit run streamlit_app/app.py

Production Build

  1. Build the Frontend: Navigate to the frontend/ folder and run:

    npm run build
    

    This will create a production-ready build in the frontend/build directory.

  2. Run Streamlit in Production Mode: Ensure _RELEASE is set to True in the __init__.py file:

    _RELEASE = True
    

    Then start the Streamlit app:

    streamlit run streamlit_app/app.py
    

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

streamlit_analytics_cards-0.0.1.tar.gz (562.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

streamlit_analytics_cards-0.0.1-py3-none-any.whl (566.9 kB view details)

Uploaded Python 3

File details

Details for the file streamlit_analytics_cards-0.0.1.tar.gz.

File metadata

File hashes

Hashes for streamlit_analytics_cards-0.0.1.tar.gz
Algorithm Hash digest
SHA256 1fc3be8a8bced3c550748b936f1eb005b5d2f46e30fe55aa7b22240342c3d338
MD5 b32f5b732cf64a7b7dbc00900b8e3bb2
BLAKE2b-256 a1e206d1b26d360e5eac91f99192c6d9c720a7a8dfb27f7afdc7985210efd6d2

See more details on using hashes here.

File details

Details for the file streamlit_analytics_cards-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for streamlit_analytics_cards-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fab31a411297387dd3ed65d50a336a543a0cf4820c80adb84e4f1cf3790b1089
MD5 4ce44286b03055d27b2b70c0c75d3ebd
BLAKE2b-256 656049c372930233b3456d0cd43ea14e3a74891f9151ed124d74dd3a12866db2

See more details on using hashes here.

Supported by

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