Skip to main content

Utilities and standard configurations for creating Streamlit workers in the AIAIAI ecosystem

Project description

AI3 Workers

A Python package that provides utilities and standard configurations for creating Streamlit workers in the AIAIAI ecosystem.

Features

  • 🎨 Automatic styling and configuration
  • 🌐 Built-in internationalization (i18n) support
  • 🔑 Consistent component key management
  • 📏 Automatic height adjustment
  • 🔄 Worker rendering status tracking

Installation

Install using Poetry:

poetry add ai3-workers

Or with pip:

pip install ai3-workers

Quick Start

Create a new worker with minimal boilerplate:

from ai3_workers.core.config import create_worker

# Initialize the worker - must be first line after imports
st = create_worker()

def main():
    name = st.text_input("Enter your name")
    if st.button("Submit"):
        st.write(f"Hello, {name}!")

if __name__ == "__main__":
    main()

Project Structure

Recommended project structure for a worker:

my-worker/
├── src/
│   ├── i18n.json          # Translations file
│   ├── interface.py       # Main worker file
│   └── modules/           # Worker-specific modules
├── pyproject.toml
└── poetry.lock

Internationalization

Add translations in src/i18n.json:

{
  "title": {
    "en": "My Worker",
    "es": "Mi Worker",
    "nl": "Mijn Worker"
  },
  "description": {
    "en": "A simple worker example",
    "es": "Un ejemplo simple de worker",
    "nl": "Een eenvoudig worker voorbeeld"
  }
}

The package will automatically load translations and use them for the worker title and description. You can also customize these directly:

st = create_worker(
    title="Custom Title",
    description="Custom description"
)

StreamlitWrapper

The package provides a wrapped version of Streamlit that automatically:

  • Generates consistent component keys
  • Applies standard styling
  • Sets default values for common properties

Supported components include:

  • Button components (primary style by default)
  • Input components
  • Form components
  • Data display components
  • Media components

Development Setup

  1. Clone the repository:
git clone git@hub.nucleoo.com:aiaiai/ai3-workers.git
  1. Install dependencies:
poetry install

Running a Worker

From your worker directory:

poetry run streamlit run src/interface.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

ai3_workers-0.1.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

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

ai3_workers-0.1.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file ai3_workers-0.1.0.tar.gz.

File metadata

  • Download URL: ai3_workers-0.1.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.9.12 Darwin/24.0.0

File hashes

Hashes for ai3_workers-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c80e6a873f315d967359af075e19e6634c13f911c9cb172c611ab579cca84991
MD5 fe3e855ae75ca8b2a63f92c0245a381e
BLAKE2b-256 4a7848dff6b52c1347f27881a6cfe93b36c36f3612170bfcec0d5493bd42268e

See more details on using hashes here.

File details

Details for the file ai3_workers-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ai3_workers-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.9.12 Darwin/24.0.0

File hashes

Hashes for ai3_workers-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c2427c53c04ab88adfae59445c6dde8e20bb9d631a0cbda15fc84c8539e4edc0
MD5 ecf09fed0382a89da4dc31717e4613c7
BLAKE2b-256 875bc75276e6db3e0a7a0e9b8cd684b6e7dab82bf0fc5665bb6439f41bbb2d26

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