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
- Clone the repository:
git clone git@hub.nucleoo.com:aiaiai/ai3-workers.git
- Install dependencies:
poetry install
Running a Worker
From your worker directory:
poetry run streamlit run src/interface.py
Metadata
Release files for ai3-workers 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| ai3_workers-0.1.3.tar.gz | 4.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ai3_workers-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.7 kB
Release files / ai3_workers-0.1.3.tar.gz
| Download URL | ai3_workers-0.1.3.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eca418cc039010cc5327a1fbf2d2e7997ed21ad3b44be7f5f78ee6f46519464d
|
|
BLAKE2b-256 checksum How to use checksums |
8d5aad5948e500131960e4272a6cb6285c920d31d35f485297c41d83f1678103
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.9.12 Darwin/24.0.0
|
Release files / ai3_workers-0.1.3-py3-none-any.whl
| Download URL | ai3_workers-0.1.3-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8ece45447e00f239fc6e15a0b0b1adfc70d39234bbf80ffc71a3cc05599d7fbf
|
|
BLAKE2b-256 checksum How to use checksums |
2064ede4bc42118ddb661cc3080ffbc41285c21f748935c1d5fe6eb30c8d7a27
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.9.12 Darwin/24.0.0
|
Security for ai3-workers 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.