Terminal UI toolkit for file packaging and Pydantic form generation. Includes dual-panel file organizer, archive creation, and auto-generated forms for Pydantic models using Textual.
Project description
FSTUI - Filesystem and Form UI Tools
Interactive TUI (Terminal User Interface) tools for:
- File Packaging - Create ZIP/TAR archives with custom directory structures
- Form Generation - Auto-generate forms from Pydantic models
๐ฆ Installation
# Clone and install
git clone <repository>
cd fstui
uv venv
uv pip install -e .
๐ Quick Start
File Packaging
Create custom archives with drag-and-drop style operations:
# Package files interactively
uv run fstui package /path/to/source
Features:
- Dual-panel interface (source | destination)
- Add files/folders (
a) - Create folders (
n) - Rename items (
r) - Delete items (
d) - Export as ZIP or TAR.GZ
Form Generation
Create New Models
from fstui import create_model
from pydantic import BaseModel
class User(BaseModel):
name: str
email: str
age: int
# Interactive form
user = create_model(User)
if user:
print(f"Created: {user.name}")
Edit Existing Models
from fstui import update_model, show_changes
# Load existing data
user = User(name="Alice", email="alice@example.com", age=30)
# Edit interactively
updated = update_model(user)
if updated:
show_changes(user, updated)
Run Examples
# Form examples
uv run fstui form --example task
uv run fstui form --example blog
# Edit examples
uv run fstui edit task
uv run fstui edit blog
๐ Project Structure
fstui/
โโโ fstui/ # Core package
โ โโโ __init__.py # Public API
โ โโโ packager.py # File packaging widget
โ โโโ form_generator.py # Form generation widget
โ โโโ model_app.py # create_model/update_model functions
โโโ examples/ # Example models and demos
โ โโโ example_models.py
โ โโโ form_app.py
โ โโโ edit_demo.py
โโโ tests/ # Test files
โ โโโ test_list_parsing.py
โ โโโ test_list_widget.py
โโโ docs/ # Documentation
โ โโโ MODEL_APP_API.md
โ โโโ QUICKSTART.md
โ โโโ ...
โโโ main.py # CLI entry point
โโโ README.md # This file
๐ฏ API Reference
File Packaging
from fstui import FilePackager
from textual.app import App
class MyApp(App):
def compose(self):
yield FilePackager("/path/to/source")
app = MyApp()
app.run()
Form Generation - Main API
from fstui import create_model, update_model, show_changes
# Create
new_instance = create_model(ModelClass)
# Update
updated_instance = update_model(existing_instance)
# Show changes
show_changes(original, updated)
Form Generation - Advanced
from fstui import PydanticFormGenerator, ModelFormApp
# Custom form widget
form = PydanticFormGenerator(ModelClass, initial_data={...})
# Custom app
app = ModelFormApp(ModelClass, model_instance=existing)
result = app.run()
๐ Documentation
- Quick Start Guide - Get started quickly
- Model App API - Complete API reference
- Form Features - New features and testing
๐ง Supported Field Types
| Type | Widget | Notes |
|---|---|---|
str |
Input | TextArea for long text |
int, float |
Input | Numeric validation |
bool |
Switch | Toggle on/off |
Enum |
Select | Dropdown menu |
date |
Input | YYYY-MM-DD format |
list[T] |
Input | Comma-separated |
Optional[T] |
Any | Allow blank |
Markdown Support: Fields named description, content, notes or with json_schema_extra={"format": "markdown"} use a TextArea widget.
๐ก Examples
Task Management
from enum import Enum
from pydantic import BaseModel
from fstui import create_model
class Priority(Enum):
LOW = "low"
HIGH = "high"
class Task(BaseModel):
title: str
priority: Priority
completed: bool = False
task = create_model(Task)
Blog Post Editor
from datetime import date
from pydantic import BaseModel, Field
from fstui import update_model
class BlogPost(BaseModel):
title: str
content: str = Field(..., json_schema_extra={"format": "markdown"})
published_date: date
post = BlogPost(title="Hello", content="# Welcome\n\nHello world!", published_date=date.today())
updated = update_model(post)
๐ Known Issues
All major bugs have been fixed:
- โ Enum select values
- โ PydanticUndefined handling
- โ List field parsing
- โ Optional[list[T]] support
See docs/FORM_FIXES.md for details.
๐ค Contributing
Contributions welcome! Please check the project structure and follow existing patterns.
๐ License
[Add license information]
๐ Acknowledgments
Built with:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fstui-0.1.0.tar.gz.
File metadata
- Download URL: fstui-0.1.0.tar.gz
- Upload date:
- Size: 71.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36fb91ddcf5feef6faa9d1c832be20e93cfdc176af02a8a4123902c0b2d25783
|
|
| MD5 |
c8b4375b82498174976a13f77a23229b
|
|
| BLAKE2b-256 |
333c717d47a234f3c90d0b436d188923e96880f73f0fb22cdd4aceadeb1f25ad
|
File details
Details for the file fstui-0.1.0-py3-none-any.whl.
File metadata
- Download URL: fstui-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76557d5ca5182ff11a519bb34ffca5caac9e48d661b1ab5eb4c41400486f440e
|
|
| MD5 |
69a2d1edb410252cffb070a2d57d4391
|
|
| BLAKE2b-256 |
bc09f532950330086c748c09dd3405ce06bbf28977ffb3eb1d28d313117ed37c
|