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

Uploaded Python 3

File details

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

File metadata

  • Download URL: ai3_workers-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 4dac455782fd581db564083e29013da5abb51c63b489048fae00fdea56c3e9b7
MD5 fd215aa7590029612f9795b6d51b9a1c
BLAKE2b-256 371e618a12d67a04e6a4dbe11d8b154e3cdfb1f69780e686ec355ff17a1a6c26

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ai3_workers-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 687ff8fa6840e8efa7b599d50614fa2ef0fd6ff276bb719807556d470a5dbf88
MD5 5468e5ced2da9b3002c9641fb87cd1a7
BLAKE2b-256 d0136bccb4a893faa7a5f5993e7cad48ffe7774085681be91c3ea8f821e657ee

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