Skip to main content

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

Python 3.13+ Textual

Interactive TUI (Terminal User Interface) tools for:

  1. File Packaging - Create ZIP/TAR archives with custom directory structures
  2. 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

๐Ÿ”ง 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fstui-0.1.0.tar.gz (71.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fstui-0.1.0-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

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

Hashes for fstui-0.1.0.tar.gz
Algorithm Hash digest
SHA256 36fb91ddcf5feef6faa9d1c832be20e93cfdc176af02a8a4123902c0b2d25783
MD5 c8b4375b82498174976a13f77a23229b
BLAKE2b-256 333c717d47a234f3c90d0b436d188923e96880f73f0fb22cdd4aceadeb1f25ad

See more details on using hashes here.

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

Hashes for fstui-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 76557d5ca5182ff11a519bb34ffca5caac9e48d661b1ab5eb4c41400486f440e
MD5 69a2d1edb410252cffb070a2d57d4391
BLAKE2b-256 bc09f532950330086c748c09dd3405ce06bbf28977ffb3eb1d28d313117ed37c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page