FastOpp 0.4.3 - Restructure oppman improve clean command
Pre-releaseDjango-Style Migration Commands & Demo Scripts Consolidation
Overview
This release introduces Django-style migration commands to oppman.py and consolidates all demo scripts into a unified scripts/demo/ directory structure. The changes improve developer experience by providing familiar Django-like commands while maintaining backward compatibility with existing Alembic functionality.
🚀 New Features
Django-Style Migration Commands
Added three new top-level commands to oppman.py that mirror Django's migration workflow:
makemigrations- Create new migration files (with optional message prompt)sqlmigrate <revision>- Show SQL statements for a specific migrationshowmigrations- Display migration status with[X]for applied and[ ]for pending
Enhanced Clean Command
The oppman.py clean command now includes comprehensive project cleanup and setup:
- Complete Project Reset: Removes
.git,.github,.cursordirectories for fresh start - File Backup: Moves all demo files, docs, tests, and project metadata to backup
- Interactive Setup Wizard: Prompts for project name, author, and description
- Configuration Updates: Updates
pyproject.tomlwith new metadata and resets version to "0.1.0" - Fresh README: Creates project-specific
README.mdwith setup instructions
🏗️ Architecture Improvements
Modular oppman.py Structure
Refactored the monolithic oppman.py (856 lines → 201 lines, 76% reduction) into organized modules:
scripts/
├── commands/
│ ├── database.py # Database operations
│ ├── server.py # Server management
│ ├── users.py # User management
│ └── project.py # Project operations
└── help/
└── text.py # Help documentation
Demo Scripts Consolidation
Consolidated scattered demo scripts into a single location:
- Before: Duplicate scripts in
demo_scripts/andscripts/ - After: All demo scripts in
scripts/demo/ - Updated: All imports across
oppdemo.pyandroutes/oppdemo.py
📝 Changes Made
Core Files Modified
oppman.py- Modularized and added Django-style commandsoppdemo.py- Updated imports and file management functionsroutes/oppdemo.py- Updated demo script importsscripts/migrate/cli.py- Added Django-style command handlersscripts/migrate/core.py- Addedsqlmigrate()andshow_migrations()methodsscripts/commands/project.py- Enhanced clean command with comprehensive cleanupdocs/DATABASE.md- Consolidated migration documentationdocs/MIGRATION_GUIDE.md- Removed (consolidated into DATABASE.md)
New Files Created
scripts/commands/database.py- Database operations modulescripts/commands/server.py- Server management modulescripts/commands/users.py- User management modulescripts/commands/project.py- Project operations modulescripts/help/text.py- Help documentation modulescripts/demo/- Consolidated demo scripts directory
Files Removed
oppman_new.py- Temporary file from modularizationdocs/MIGRATION_GUIDE.md- Consolidated into DATABASE.md- Duplicate demo scripts from
scripts/directory demo_scripts/directory (moved toscripts/demo/)
🔧 Technical Details
Migration Command Implementation
# Django-style commands
uv run python oppman.py makemigrations [message]
uv run python oppman.py migrate
uv run python oppman.py sqlmigrate <revision>
uv run python oppman.py showmigrations
# Alembic-style commands (still supported)
uv run python oppman.py migrate init
uv run python oppman.py migrate upgrade
uv run python oppman.py migrate downgradeEnhanced Clean Command Workflow
- Step 1: Run
oppdemo.py destroyto switch to minimal app - Step 2: Move remaining files to backup directory (including
.git,.github,.cursor) - Step 3: Interactive wizard for project setup
- Step 4: Update
pyproject.tomland create newREADME.md
Files moved to backup during clean:
demo_assets/,base_assets/,scripts/demo/,docs/,tests/oppdemo.py,pytest.ini,LICENSE,fastopp/,README.md.github/,.cursor/,.git/(project metadata for fresh start)
File Management Functions Updated
All oppdemo.py file management functions now properly handle scripts/demo/:
save_demo_files()- Backs upscripts/demo/todemo_assets/scripts/restore_demo_files()- Restores fromdemo_assets/scripts/toscripts/demo/destroy_demo_files()- Removesscripts/demo/directorydiff_demo_files()- Comparesscripts/demo/with backup
✅ Testing
All functionality has been tested and verified:
- ✅ Django-style migration commands work correctly
- ✅ Enhanced clean command with interactive wizard
- ✅ Demo script consolidation and imports
- ✅ File management functions (save/restore/destroy/diff)
- ✅ Web interface endpoints work with new structure
- ✅ Backward compatibility with existing Alembic commands
🎯 Benefits
- Developer Experience: Familiar Django-like migration commands
- Code Organization: Modular structure improves maintainability
- Consistency: Unified demo script location eliminates confusion
- Maintainability: 76% reduction in main file size
- Backward Compatibility: All existing functionality preserved
- Project Setup: Streamlined project initialization with clean command
📚 Documentation Updates
- Consolidated Migration Docs: Merged
MIGRATION_GUIDE.mdintoDATABASE.mdfor better organization - Enhanced DATABASE.md: Added comprehensive Django-style command documentation
- Updated Help Text: Added detailed help for all new commands
- Usage Examples: Updated examples and usage instructions throughout
🔄 Migration Guide
For Existing Users
No breaking changes - all existing commands continue to work:
# Existing commands still work
uv run python oppman.py migrate init
uv run python oppman.py migrate upgrade
uv run python oppdemo.py init
# New Django-style commands available
uv run python oppman.py makemigrations
uv run python oppman.py showmigrationsFor New Projects
Use the enhanced clean command for project setup:
uv run python oppman.py clean
# Follow interactive wizard prompts