promptius-gui-schema


Namepromptius-gui-schema JSON
Version 2.0.0 PyPI version JSON
download
home_pageNone
SummaryType-safe UI schema definitions for cross-platform UI generation
upload_time2025-10-26 09:20:45
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8.1
licenseMIT License Copyright (c) 2024 Kanishk Gupta Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords angular pydantic react schema typescript ui validation vue
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Promptius GUI Schema

[![PyPI version](https://badge.fury.io/py/promptius-gui-schema.svg)](https://badge.fury.io/py/promptius-gui-schema)
[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

**Type-safe UI schema definitions for cross-platform UI generation**

Promptius GUI Schema provides robust, type-safe UI schema definitions that can be used to generate UI components across different frameworks (React, Vue, Angular, etc.) with full TypeScript compatibility.

## Features

- 🎯 **Type-Safe**: Built with Pydantic for runtime validation and type safety
- 🔄 **Cross-Platform**: Compatible with React, Vue, Angular, and other frameworks
- 📝 **TypeScript Compatible**: Full TypeScript definitions available
- 🎨 **Framework Agnostic**: Works with shadcn/ui, Material-UI, Chakra UI, Ant Design
- 🚀 **Zero Dependencies**: Only requires Pydantic (no heavy framework dependencies)
- 📦 **Lightweight**: Minimal package size for maximum performance

## Installation

```bash
pip install promptius-gui-schema
```

## Quick Start

```python
from promptius_gui_schema import UISchema, UIMetadata, ButtonComponent, ButtonProps, ButtonVariant

# Create a simple button schema
schema = UISchema(
    metadata=UIMetadata(
        title="My App",
        description="A simple application",
        framework="shadcn"
    ),
    root=ButtonComponent(
        id="submit-btn",
        props=ButtonProps(
            label="Submit",
            variant=ButtonVariant.PRIMARY
        )
    )
)

# Export as JSON for frontend consumption
json_schema = schema.to_json()
print(json_schema)
```

## Supported Components

### Layout Components
- **Container**: Responsive container with max-width and padding
- **Grid**: Flexible grid layout with configurable columns
- **Stack**: Vertical or horizontal stack layout

### Form Components
- **Button**: Interactive buttons with variants and states
- **Input**: Text inputs with validation and helper text
- **Textarea**: Multi-line text input with configurable rows

### Display Components
- **Text**: Typography with semantic tags and styling
- **Card**: Content containers with elevation and padding
- **Alert**: Notifications with different severity levels
- **Chart**: Data visualization with multiple chart types

## Framework Support

| Framework | Status | Notes |
|-----------|--------|-------|
| **shadcn/ui** | ✅ Full Support | Default framework |
| **Material-UI** | ✅ Full Support | Complete component mapping |
| **Chakra UI** | ✅ Full Support | All components supported |
| **Ant Design** | ✅ Full Support | Enterprise-ready components |

## Advanced Usage

### Event Handling

```python
from promptius_gui_schema import (
    EventType, SetStateAction, SubmitFormAction, 
    NavigateAction, EventBinding
)

# Button with click event
button = ButtonComponent(
    id="submit-btn",
    props=ButtonProps(label="Submit"),
    events=[
        (EventType.CLICK, SubmitFormAction(
            type="submitForm",
            endpoint="/api/submit",
            method="POST"
        ))
    ]
)
```

### Complex Layouts

```python
from promptius_gui_schema import (
    ContainerComponent, ContainerProps,
    GridComponent, GridProps,
    CardComponent, CardProps,
    TextComponent, TextProps, TextTag
)

# Dashboard layout
dashboard = UISchema(
    metadata=UIMetadata(title="Dashboard", framework="material-ui"),
    root=ContainerComponent(
        id="dashboard",
        props=ContainerProps(maxWidth=1200, padding=24),
        children=[
            GridComponent(
                id="metrics-grid",
                props=GridProps(columns=3, gap=16),
                children=[
                    CardComponent(
                        id="users-card",
                        props=CardProps(title="Total Users"),
                        children=[
                            TextComponent(
                                id="users-count",
                                props=TextProps(
                                    content="12,345",
                                    tag=TextTag.H2
                                )
                            )
                        ]
                    )
                ]
            )
        ]
    )
)
```

### Chart Components

```python
from promptius_gui_schema import (
    ChartComponent, ChartProps, ChartType, ChartSeries
)

# Bar chart
chart = ChartComponent(
    id="sales-chart",
    props=ChartProps(
        chartType=ChartType.BAR,
        title="Sales Data",
        series=[
            ChartSeries(name="Q1", data=[100, 200, 150]),
            ChartSeries(name="Q2", data=[120, 180, 200])
        ],
        labels=["Jan", "Feb", "Mar"]
    )
)
```

## TypeScript Integration

The package is designed to work seamlessly with TypeScript. The corresponding TypeScript definitions are available in the main Promptius GUI repository:

```typescript
import { UISchema, ButtonComponent, ButtonProps } from '@promptius-gui/schemas';

const schema: UISchema = {
  metadata: {
    title: "My App",
    framework: "shadcn"
  },
  root: {
    type: "button",
    id: "submit-btn",
    props: {
      label: "Submit",
      variant: "primary"
    }
  }
};
```

## Validation

All schemas are validated at runtime using Pydantic:

```python
from promptius_gui_schema import UISchema, UIMetadata, ButtonComponent, ButtonProps

try:
    # This will raise a validation error
    invalid_schema = UISchema(
        metadata=UIMetadata(title=""),  # Empty title not allowed
        root=ButtonComponent(
            id="btn",
            props=ButtonProps(label="")  # Empty label not allowed
        )
    )
except ValidationError as e:
    print(f"Validation failed: {e}")
```

## Development

### Installation for Development

```bash
git clone https://github.com/AgentBossMode/promptius-gui.git
cd promptius-gui/python
pip install -e .
```

### Running Tests

```bash
pip install -e ".[dev]"
pytest
```

### Code Formatting

```bash
black promptius_gui_schema/
isort promptius_gui_schema/
```

## API Reference

### Core Classes

- **`UISchema`**: Top-level schema container
- **`UIMetadata`**: Schema metadata and framework information
- **`UIComponent`**: Union type for all component types

### Component Types

- **Layout**: `ContainerComponent`, `GridComponent`, `StackComponent`
- **Form**: `ButtonComponent`, `InputComponent`, `TextareaComponent`
- **Display**: `TextComponent`, `CardComponent`, `AlertComponent`, `ChartComponent`

### Event System

- **Event Types**: `EventType` enum (CLICK, SUBMIT, CHANGE, etc.)
- **Actions**: `NavigateAction`, `SetStateAction`, `SubmitFormAction`, etc.
- **Binding**: Tuple format `(EventType, EventAction)` for TypeScript compatibility

## Contributing

Contributions are welcome! Please read our [Contributing Guide](https://github.com/AgentBossMode/promptius-gui/blob/main/CONTRIBUTING.md) for details.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Related Projects

- [Promptius GUI Core](https://github.com/AgentBossMode/promptius-gui) - Main Promptius GUI repository
- [Promptius GUI React](https://github.com/AgentBossMode/promptius-gui/tree/main/js/packages/core) - React renderer
- [Promptius GUI Vue](https://github.com/AgentBossMode/promptius-gui) - Vue renderer (coming soon)

## Support

- 📖 [Documentation](https://github.com/AgentBossMode/promptius-gui#readme)
- 🐛 [Issue Tracker](https://github.com/AgentBossMode/promptius-gui/issues)
- 💬 [Discussions](https://github.com/AgentBossMode/promptius-gui/discussions)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "promptius-gui-schema",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8.1",
    "maintainer_email": "Kanishk Gupta <51890299+kanishkgupta2000@users.noreply.github.com>",
    "keywords": "angular, pydantic, react, schema, typescript, ui, validation, vue",
    "author": null,
    "author_email": "Kanishk Gupta <51890299+kanishkgupta2000@users.noreply.github.com>",
    "download_url": "https://files.pythonhosted.org/packages/04/07/d41f93a73709d2a47c7b6372071beac6c4e59936e69ab9e57458a05ab666/promptius_gui_schema-2.0.0.tar.gz",
    "platform": null,
    "description": "# Promptius GUI Schema\n\n[![PyPI version](https://badge.fury.io/py/promptius-gui-schema.svg)](https://badge.fury.io/py/promptius-gui-schema)\n[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n**Type-safe UI schema definitions for cross-platform UI generation**\n\nPromptius GUI Schema provides robust, type-safe UI schema definitions that can be used to generate UI components across different frameworks (React, Vue, Angular, etc.) with full TypeScript compatibility.\n\n## Features\n\n- \ud83c\udfaf **Type-Safe**: Built with Pydantic for runtime validation and type safety\n- \ud83d\udd04 **Cross-Platform**: Compatible with React, Vue, Angular, and other frameworks\n- \ud83d\udcdd **TypeScript Compatible**: Full TypeScript definitions available\n- \ud83c\udfa8 **Framework Agnostic**: Works with shadcn/ui, Material-UI, Chakra UI, Ant Design\n- \ud83d\ude80 **Zero Dependencies**: Only requires Pydantic (no heavy framework dependencies)\n- \ud83d\udce6 **Lightweight**: Minimal package size for maximum performance\n\n## Installation\n\n```bash\npip install promptius-gui-schema\n```\n\n## Quick Start\n\n```python\nfrom promptius_gui_schema import UISchema, UIMetadata, ButtonComponent, ButtonProps, ButtonVariant\n\n# Create a simple button schema\nschema = UISchema(\n    metadata=UIMetadata(\n        title=\"My App\",\n        description=\"A simple application\",\n        framework=\"shadcn\"\n    ),\n    root=ButtonComponent(\n        id=\"submit-btn\",\n        props=ButtonProps(\n            label=\"Submit\",\n            variant=ButtonVariant.PRIMARY\n        )\n    )\n)\n\n# Export as JSON for frontend consumption\njson_schema = schema.to_json()\nprint(json_schema)\n```\n\n## Supported Components\n\n### Layout Components\n- **Container**: Responsive container with max-width and padding\n- **Grid**: Flexible grid layout with configurable columns\n- **Stack**: Vertical or horizontal stack layout\n\n### Form Components\n- **Button**: Interactive buttons with variants and states\n- **Input**: Text inputs with validation and helper text\n- **Textarea**: Multi-line text input with configurable rows\n\n### Display Components\n- **Text**: Typography with semantic tags and styling\n- **Card**: Content containers with elevation and padding\n- **Alert**: Notifications with different severity levels\n- **Chart**: Data visualization with multiple chart types\n\n## Framework Support\n\n| Framework | Status | Notes |\n|-----------|--------|-------|\n| **shadcn/ui** | \u2705 Full Support | Default framework |\n| **Material-UI** | \u2705 Full Support | Complete component mapping |\n| **Chakra UI** | \u2705 Full Support | All components supported |\n| **Ant Design** | \u2705 Full Support | Enterprise-ready components |\n\n## Advanced Usage\n\n### Event Handling\n\n```python\nfrom promptius_gui_schema import (\n    EventType, SetStateAction, SubmitFormAction, \n    NavigateAction, EventBinding\n)\n\n# Button with click event\nbutton = ButtonComponent(\n    id=\"submit-btn\",\n    props=ButtonProps(label=\"Submit\"),\n    events=[\n        (EventType.CLICK, SubmitFormAction(\n            type=\"submitForm\",\n            endpoint=\"/api/submit\",\n            method=\"POST\"\n        ))\n    ]\n)\n```\n\n### Complex Layouts\n\n```python\nfrom promptius_gui_schema import (\n    ContainerComponent, ContainerProps,\n    GridComponent, GridProps,\n    CardComponent, CardProps,\n    TextComponent, TextProps, TextTag\n)\n\n# Dashboard layout\ndashboard = UISchema(\n    metadata=UIMetadata(title=\"Dashboard\", framework=\"material-ui\"),\n    root=ContainerComponent(\n        id=\"dashboard\",\n        props=ContainerProps(maxWidth=1200, padding=24),\n        children=[\n            GridComponent(\n                id=\"metrics-grid\",\n                props=GridProps(columns=3, gap=16),\n                children=[\n                    CardComponent(\n                        id=\"users-card\",\n                        props=CardProps(title=\"Total Users\"),\n                        children=[\n                            TextComponent(\n                                id=\"users-count\",\n                                props=TextProps(\n                                    content=\"12,345\",\n                                    tag=TextTag.H2\n                                )\n                            )\n                        ]\n                    )\n                ]\n            )\n        ]\n    )\n)\n```\n\n### Chart Components\n\n```python\nfrom promptius_gui_schema import (\n    ChartComponent, ChartProps, ChartType, ChartSeries\n)\n\n# Bar chart\nchart = ChartComponent(\n    id=\"sales-chart\",\n    props=ChartProps(\n        chartType=ChartType.BAR,\n        title=\"Sales Data\",\n        series=[\n            ChartSeries(name=\"Q1\", data=[100, 200, 150]),\n            ChartSeries(name=\"Q2\", data=[120, 180, 200])\n        ],\n        labels=[\"Jan\", \"Feb\", \"Mar\"]\n    )\n)\n```\n\n## TypeScript Integration\n\nThe package is designed to work seamlessly with TypeScript. The corresponding TypeScript definitions are available in the main Promptius GUI repository:\n\n```typescript\nimport { UISchema, ButtonComponent, ButtonProps } from '@promptius-gui/schemas';\n\nconst schema: UISchema = {\n  metadata: {\n    title: \"My App\",\n    framework: \"shadcn\"\n  },\n  root: {\n    type: \"button\",\n    id: \"submit-btn\",\n    props: {\n      label: \"Submit\",\n      variant: \"primary\"\n    }\n  }\n};\n```\n\n## Validation\n\nAll schemas are validated at runtime using Pydantic:\n\n```python\nfrom promptius_gui_schema import UISchema, UIMetadata, ButtonComponent, ButtonProps\n\ntry:\n    # This will raise a validation error\n    invalid_schema = UISchema(\n        metadata=UIMetadata(title=\"\"),  # Empty title not allowed\n        root=ButtonComponent(\n            id=\"btn\",\n            props=ButtonProps(label=\"\")  # Empty label not allowed\n        )\n    )\nexcept ValidationError as e:\n    print(f\"Validation failed: {e}\")\n```\n\n## Development\n\n### Installation for Development\n\n```bash\ngit clone https://github.com/AgentBossMode/promptius-gui.git\ncd promptius-gui/python\npip install -e .\n```\n\n### Running Tests\n\n```bash\npip install -e \".[dev]\"\npytest\n```\n\n### Code Formatting\n\n```bash\nblack promptius_gui_schema/\nisort promptius_gui_schema/\n```\n\n## API Reference\n\n### Core Classes\n\n- **`UISchema`**: Top-level schema container\n- **`UIMetadata`**: Schema metadata and framework information\n- **`UIComponent`**: Union type for all component types\n\n### Component Types\n\n- **Layout**: `ContainerComponent`, `GridComponent`, `StackComponent`\n- **Form**: `ButtonComponent`, `InputComponent`, `TextareaComponent`\n- **Display**: `TextComponent`, `CardComponent`, `AlertComponent`, `ChartComponent`\n\n### Event System\n\n- **Event Types**: `EventType` enum (CLICK, SUBMIT, CHANGE, etc.)\n- **Actions**: `NavigateAction`, `SetStateAction`, `SubmitFormAction`, etc.\n- **Binding**: Tuple format `(EventType, EventAction)` for TypeScript compatibility\n\n## Contributing\n\nContributions are welcome! Please read our [Contributing Guide](https://github.com/AgentBossMode/promptius-gui/blob/main/CONTRIBUTING.md) for details.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Related Projects\n\n- [Promptius GUI Core](https://github.com/AgentBossMode/promptius-gui) - Main Promptius GUI repository\n- [Promptius GUI React](https://github.com/AgentBossMode/promptius-gui/tree/main/js/packages/core) - React renderer\n- [Promptius GUI Vue](https://github.com/AgentBossMode/promptius-gui) - Vue renderer (coming soon)\n\n## Support\n\n- \ud83d\udcd6 [Documentation](https://github.com/AgentBossMode/promptius-gui#readme)\n- \ud83d\udc1b [Issue Tracker](https://github.com/AgentBossMode/promptius-gui/issues)\n- \ud83d\udcac [Discussions](https://github.com/AgentBossMode/promptius-gui/discussions)\n",
    "bugtrack_url": null,
    "license": "MIT License\n        \n        Copyright (c) 2024 Kanishk Gupta\n        \n        Permission is hereby granted, free of charge, to any person obtaining a copy\n        of this software and associated documentation files (the \"Software\"), to deal\n        in the Software without restriction, including without limitation the rights\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n        copies of the Software, and to permit persons to whom the Software is\n        furnished to do so, subject to the following conditions:\n        \n        The above copyright notice and this permission notice shall be included in all\n        copies or substantial portions of the Software.\n        \n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n        SOFTWARE.",
    "summary": "Type-safe UI schema definitions for cross-platform UI generation",
    "version": "2.0.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/AgentBossMode/promptius-gui/issues",
        "Documentation": "https://github.com/AgentBossMode/promptius-gui#readme",
        "Homepage": "https://github.com/AgentBossMode/promptius-gui",
        "Repository": "https://github.com/AgentBossMode/promptius-gui"
    },
    "split_keywords": [
        "angular",
        " pydantic",
        " react",
        " schema",
        " typescript",
        " ui",
        " validation",
        " vue"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b8f93940be9dc04fe370e068618cb8f0ed99769e4d14d6eef25302ee18c8f426",
                "md5": "08ff40af29658386191fb66e28220915",
                "sha256": "9a6f9a368d1369725a4dc2a3e3d80e87333eb8d1a27f7310dfe06b07c4c12725"
            },
            "downloads": -1,
            "filename": "promptius_gui_schema-2.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "08ff40af29658386191fb66e28220915",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8.1",
            "size": 8549,
            "upload_time": "2025-10-26T09:20:44",
            "upload_time_iso_8601": "2025-10-26T09:20:44.898238Z",
            "url": "https://files.pythonhosted.org/packages/b8/f9/3940be9dc04fe370e068618cb8f0ed99769e4d14d6eef25302ee18c8f426/promptius_gui_schema-2.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "0407d41f93a73709d2a47c7b6372071beac6c4e59936e69ab9e57458a05ab666",
                "md5": "c23741eb25ed01d55c5bd58b375f7c8d",
                "sha256": "183e50d20ab5f4dd3c40126cc22f5ab7d17a0cb61510fe127db6ca020f18475b"
            },
            "downloads": -1,
            "filename": "promptius_gui_schema-2.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "c23741eb25ed01d55c5bd58b375f7c8d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8.1",
            "size": 205345,
            "upload_time": "2025-10-26T09:20:45",
            "upload_time_iso_8601": "2025-10-26T09:20:45.910069Z",
            "url": "https://files.pythonhosted.org/packages/04/07/d41f93a73709d2a47c7b6372071beac6c4e59936e69ab9e57458a05ab666/promptius_gui_schema-2.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-26 09:20:45",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "AgentBossMode",
    "github_project": "promptius-gui",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "promptius-gui-schema"
}
        
Elapsed time: 1.03417s