Metadata-Version: 2.4
Name: structui
Version: 0.3.0
Summary: A format-agnostic, schema-driven, hierarchical configuration UI.
Author: structui contributors
License: MIT
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: nicegui>=1.4.0
Requires-Dist: pyyaml>=6.0.1
Requires-Dist: pywin32>=300; sys_platform == "win32"

# StructUI

[![PyPI version](https://img.shields.io/pypi/v/structui.svg)](https://pypi.org/project/structui/)
[![CI](https://github.com/MoSaeedHammad/structui/actions/workflows/ci.yml/badge.svg)](https://github.com/MoSaeedHammad/structui/actions/workflows/ci.yml)
[![CD](https://github.com/MoSaeedHammad/structui/actions/workflows/publish.yml/badge.svg)](https://github.com/MoSaeedHammad/structui/actions/workflows/publish.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

StructUI is a format-agnostic, schema-driven, hierarchical configuration UI engine built in Python. Designed as a flexible architectural backbone, it parses standard configuration files (YAML, JSON, CSV, XML) and dynamically generates a live web-based property editor based on constraints and metadata defined in a schema file.

The architecture is explicitly decoupled, making it readily extensible to strict domain-specific specifications (e.g., AUTOSAR configurators) and agent-driven programmatic workflows.

## Features

- **Pillar A: Format-Agnostic Parsers:** cleanly separate UI generation from underlying data formats. Out-of-the-box support for YAML, JSON, and XML (including schema-driven arrays and attributes), with abstract base classes extensible to CSV and others.
- **Pillar B: Hierarchical UI:** Dynamic tree-based rendering with full support for multidimensional containers, dynamic polymorphic list additions, and node mapping. Powered natively by NiceGUI.
- **Pillar C: Data Validity:** Enforces schema metadata strictly at the UI layer. Missing fields gracefully populate via defaults, required flags trigger locking, and nested typings are continuously evaluated.
- **Pillar D: Extensibility & Programmatic Control:** Decomposed core logic (App, Parser, State, Schema, UI) allowing external tools and wrappers (e.g. CLI, Agent Workflows) to invoke the editor or inject properties safely.

## Installation

### From PyPI (recommended)

```bash
pip install structui
```

### From Source (development)

```bash
git clone https://github.com/MoSaeedHammad/structui.git
cd structui
pip install -e .
```

## Quick Start

Launch the editor in the current directory against your local configuration files by simply typing:

```bash
structui --dir . --schema .structui_schema.yaml --port 8080
```

## Testing

To run the test suite and verify code coverage, first install the necessary development dependencies:

```bash
pip install -e . pytest pytest-cov pytest-asyncio pyyaml nicegui
```

Then, run `pytest` with coverage reporting:

```bash
PYTHONPATH=src python3 -m pytest tests/ --cov=structui --cov-report=term-missing
```
