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.3.tar.gz (4.9 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.3-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ai3_workers-0.1.3.tar.gz
  • Upload date:
  • Size: 4.9 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.3.tar.gz
Algorithm Hash digest
SHA256 eca418cc039010cc5327a1fbf2d2e7997ed21ad3b44be7f5f78ee6f46519464d
MD5 82f44f838f43760943f5b756d4fea42b
BLAKE2b-256 8d5aad5948e500131960e4272a6cb6285c920d31d35f485297c41d83f1678103

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ai3_workers-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 5.8 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8ece45447e00f239fc6e15a0b0b1adfc70d39234bbf80ffc71a3cc05599d7fbf
MD5 1af62e8520c766ae459c4462f8fd280b
BLAKE2b-256 2064ede4bc42118ddb661cc3080ffbc41285c21f748935c1d5fe6eb30c8d7a27

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