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.1.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.1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ai3_workers-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 62c4b4c90dc98eb9c4664f24ba7a054c3ebf2eed1fb47bc8bcf8141825dcab34
MD5 33f932969cfc849c960fba7bcffd94c0
BLAKE2b-256 9eb2e58d76de3c717010d8e307192e52ef4de3874694cee65f63a01ae2f572b3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ai3_workers-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 76df478ddb01a159721919897cbc4ac422d013ac2b7e9816249820e069b5b2f8
MD5 0fbfccf14ca94ca5729ffb39d09062ab
BLAKE2b-256 1b810d0a3597850334a67f4681a3cd3021a668c3c3e24074b47abc71ea91158f

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