ai3-workers


Nameai3-workers JSON
Version 0.1.3 PyPI version JSON
download
home_pagehttps://hub.nucleoo.com/aiaiai/ai3-workers
SummaryUtilities and standard configurations for creating Streamlit workers in the AIAIAI ecosystem
upload_time2024-12-04 16:39:47
maintainerNone
docs_urlNone
authorMartijn Schouten
requires_python<4.0,>=3.11
licenseCC-BY-NC-4.0
keywords streamlit aiaiai workers utilities
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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:

```bash
poetry add ai3-workers
```

Or with pip:

```bash
pip install ai3-workers
```

## Quick Start

Create a new worker with minimal boilerplate:

```python
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`:

```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:

```python
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:

```bash
git clone git@hub.nucleoo.com:aiaiai/ai3-workers.git
```

2. Install dependencies:

```bash
poetry install
```

## Running a Worker

From your worker directory:

```bash
poetry run streamlit run src/interface.py
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://hub.nucleoo.com/aiaiai/ai3-workers",
    "name": "ai3-workers",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.11",
    "maintainer_email": null,
    "keywords": "streamlit, aiaiai, workers, utilities",
    "author": "Martijn Schouten",
    "author_email": "martijn@aiaiai.eu",
    "download_url": "https://files.pythonhosted.org/packages/8d/5a/ad5948e500131960e4272a6cb6285c920d31d35f485297c41d83f1678103/ai3_workers-0.1.3.tar.gz",
    "platform": null,
    "description": "# AI3 Workers\n\nA Python package that provides utilities and standard configurations for creating Streamlit workers in the AIAIAI ecosystem.\n\n## Features\n\n- \ud83c\udfa8 Automatic styling and configuration\n- \ud83c\udf10 Built-in internationalization (i18n) support\n- \ud83d\udd11 Consistent component key management\n- \ud83d\udccf Automatic height adjustment\n- \ud83d\udd04 Worker rendering status tracking\n\n## Installation\n\nInstall using Poetry:\n\n```bash\npoetry add ai3-workers\n```\n\nOr with pip:\n\n```bash\npip install ai3-workers\n```\n\n## Quick Start\n\nCreate a new worker with minimal boilerplate:\n\n```python\nfrom ai3_workers.core.config import create_worker\n\n# Initialize the worker - must be first line after imports\nst = create_worker()\n\ndef main():\n    name = st.text_input(\"Enter your name\")\n    if st.button(\"Submit\"):\n        st.write(f\"Hello, {name}!\")\n\nif __name__ == \"__main__\":\n    main()\n```\n\n## Project Structure\n\nRecommended project structure for a worker:\n\n```\nmy-worker/\n\u251c\u2500\u2500 src/\n\u2502   \u251c\u2500\u2500 i18n.json          # Translations file\n\u2502   \u251c\u2500\u2500 interface.py       # Main worker file\n\u2502   \u2514\u2500\u2500 modules/           # Worker-specific modules\n\u251c\u2500\u2500 pyproject.toml\n\u2514\u2500\u2500 poetry.lock\n```\n\n## Internationalization\n\nAdd translations in `src/i18n.json`:\n\n```json\n{\n  \"title\": {\n    \"en\": \"My Worker\",\n    \"es\": \"Mi Worker\",\n    \"nl\": \"Mijn Worker\"\n  },\n  \"description\": {\n    \"en\": \"A simple worker example\",\n    \"es\": \"Un ejemplo simple de worker\",\n    \"nl\": \"Een eenvoudig worker voorbeeld\"\n  }\n}\n```\n\nThe package will automatically load translations and use them for the worker title and description. You can also customize these directly:\n\n```python\nst = create_worker(\n    title=\"Custom Title\",\n    description=\"Custom description\"\n)\n```\n\n## StreamlitWrapper\n\nThe package provides a wrapped version of Streamlit that automatically:\n\n- Generates consistent component keys\n- Applies standard styling\n- Sets default values for common properties\n\nSupported components include:\n\n- Button components (primary style by default)\n- Input components\n- Form components\n- Data display components\n- Media components\n\n## Development Setup\n\n1. Clone the repository:\n\n```bash\ngit clone git@hub.nucleoo.com:aiaiai/ai3-workers.git\n```\n\n2. Install dependencies:\n\n```bash\npoetry install\n```\n\n## Running a Worker\n\nFrom your worker directory:\n\n```bash\npoetry run streamlit run src/interface.py\n```\n",
    "bugtrack_url": null,
    "license": "CC-BY-NC-4.0",
    "summary": "Utilities and standard configurations for creating Streamlit workers in the AIAIAI ecosystem",
    "version": "0.1.3",
    "project_urls": {
        "Homepage": "https://hub.nucleoo.com/aiaiai/ai3-workers",
        "Repository": "https://hub.nucleoo.com/aiaiai/ai3-workers"
    },
    "split_keywords": [
        "streamlit",
        " aiaiai",
        " workers",
        " utilities"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2064ede4bc42118ddb661cc3080ffbc41285c21f748935c1d5fe6eb30c8d7a27",
                "md5": "1af62e8520c766ae459c4462f8fd280b",
                "sha256": "8ece45447e00f239fc6e15a0b0b1adfc70d39234bbf80ffc71a3cc05599d7fbf"
            },
            "downloads": -1,
            "filename": "ai3_workers-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1af62e8520c766ae459c4462f8fd280b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.11",
            "size": 5819,
            "upload_time": "2024-12-04T16:39:46",
            "upload_time_iso_8601": "2024-12-04T16:39:46.019535Z",
            "url": "https://files.pythonhosted.org/packages/20/64/ede4bc42118ddb661cc3080ffbc41285c21f748935c1d5fe6eb30c8d7a27/ai3_workers-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8d5aad5948e500131960e4272a6cb6285c920d31d35f485297c41d83f1678103",
                "md5": "82f44f838f43760943f5b756d4fea42b",
                "sha256": "eca418cc039010cc5327a1fbf2d2e7997ed21ad3b44be7f5f78ee6f46519464d"
            },
            "downloads": -1,
            "filename": "ai3_workers-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "82f44f838f43760943f5b756d4fea42b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.11",
            "size": 4913,
            "upload_time": "2024-12-04T16:39:47",
            "upload_time_iso_8601": "2024-12-04T16:39:47.036828Z",
            "url": "https://files.pythonhosted.org/packages/8d/5a/ad5948e500131960e4272a6cb6285c920d31d35f485297c41d83f1678103/ai3_workers-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-04 16:39:47",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "ai3-workers"
}
        
Elapsed time: 0.39476s