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.1.tar.gz (80.7 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.1-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

Details for the file fstui-0.1.1.tar.gz.

File metadata

  • Download URL: fstui-0.1.1.tar.gz
  • Upload date:
  • Size: 80.7 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.1.tar.gz
Algorithm Hash digest
SHA256 01be531545b708b837b1b3f31891a976b27b1d02d6bb8328e6f5ffd6dee6123f
MD5 80f6a423fbd6bfef79ee1e1da4236a2e
BLAKE2b-256 1e1cab0a98600127939a5a1bb147e09e014b9167c774719ead812a1f3f6e76d2

See more details on using hashes here.

File details

Details for the file fstui-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: fstui-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 75750f538b744717a05f2a119d379df05e3808025ccd362a90cb0d460028a876
MD5 f8c3709e9623c5f3e039af50e0963a2a
BLAKE2b-256 d81db6c53585c765acaf25ddbb7f7441e4505481c3177f57c2cd14a3f81ebfc8

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