Python Console Development
Instructions
- •
Project setup
- •Use Python 3.13+
- •Initialize project using UV for dependency and environment management
- •Follow a clear, modular project structure (
src/,tests/,pyproject.toml)
- •
Application architecture
- •Separate concerns: CLI layer, business logic, and data models
- •Use in-memory data structures (lists, dicts) as the primary datastore
- •Implement full CRUD operations (Create, Read, Update, Delete)
- •
CLI interface
- •Design clear commands and subcommands
- •Validate all user inputs (types, ranges, required fields)
- •Provide helpful error messages and usage hints
- •Support interactive and non-interactive (arguments-based) usage
- •
Code quality
- •Follow PEP 8 style guidelines
- •Use meaningful variable, function, and module names
- •Write small, testable functions
- •Add docstrings for public functions and modules
- •
Business logic & models
- •Define explicit data models (dataclasses or typed dictionaries)
- •Encapsulate rules and validations in the business layer
- •Avoid placing logic directly in the CLI handlers
Best Practices
- •Keep CLI commands simple and predictable
- •Prefer composition over deeply nested conditionals
- •Fail fast on invalid input
- •Use type hints throughout the codebase
- •Keep the main entry point minimal
- •Design for easy future migration to persistent storage
Example Structure
text
python-console-dev/
├── pyproject.toml
├── src/
│ └── app/
│ ├── __init__.py
│ ├── cli.py
│ ├── models.py
│ ├── service.py
│ └── repository.py
└── tests/
└── test_service.py