A Python CLI tool for generating production-ready project templates
Project description
py-scaffold
A Python CLI tool for generating production-ready project templates, similar to create-next-app.
Features
- Backend API Template: Production-ready layered architecture with Models, Repositories, Services, Controllers, and DTOs
- AI Project Template: Modular pipeline architecture with RAG, NLP, and ML model training capabilities
- YAML Configuration: Easy-to-manage configuration files
- Type-Safe: Full type hints support
- Best Practices: Industry-standard project structure and patterns
Installation
From Source
git clone https://github.com/yourusername/py-scaffold.git
cd py-scaffold
pip install -e .
Using pip (once published)
pip install py-scaffold
Usage
Create a new project
Backend API:
py-scaffold my-api --template backend-api
AI Project:
py-scaffold my-ai-app --template ai-project
Interactive mode (no template specified):
py-scaffold my-project
Project Structures
Backend API Template
This will create a new project with the following structure:
my-api/
├── src/
│ ├── config.yaml # YAML configuration
│ ├── main.py
│ └── app/
│ ├── core/
│ │ └── config.py # Load YAML config into Settings object
│ ├── model/ # Domain Models / ORM Entities
│ │ └── user.py
│ ├── repository/ # Data access layer
│ │ └── user_repository.py
│ ├── service/ # Business logic
│ │ └── user_service.py
│ ├── controller/ # Request handlers
│ │ └── user_controller.py
│ └── dto/ # Data Transfer Objects
│ └── user_dto.py
└── tests/
AI Project Template
A comprehensive AI/ML project structure with modular pipelines:
my-ai-app/
├── app/
│ ├── main.py # Application entry point
│ ├── pipelines/ # Processing pipelines
│ │ ├── rag/ # Retrieval-Augmented Generation
│ │ │ ├── embedder.py # Text embedding component
│ │ │ ├── retriever.py # Document retrieval
│ │ │ └── generator.py # Response generation
│ │ └── nlp/ # Natural Language Processing
│ │ └── processor.py # Text processing utilities
│ ├── models/ # ML models
│ │ ├── embedding/ # Embedding models
│ │ │ └── embedder.py
│ │ ├── finetune/ # Fine-tuning utilities
│ │ │ └── trainer.py
│ │ └── inference.py # Inference engine
│ ├── data/ # Data management
│ │ ├── raw/ # Raw data storage
│ │ ├── processed/ # Processed data
│ │ └── loader.py # Data loading utilities
│ └── utils/ # Utility functions
│ ├── logger.py # Logging configuration
│ └── helpers.py # Helper functions
├── notebooks/ # Jupyter notebooks
│ ├── preprocessing.ipynb # Data preprocessing
│ ├── training.ipynb # Model training
│ └── evaluation.ipynb # Model evaluation
├── configs/
│ └── default.yml # YAML configuration
├── tests/ # Unit tests
├── .github/
│ └── copilot-instructions.md # GitHub Copilot instructions
├── CLAUDE.md # Claude Code documentation
├── requirements.txt
└── README.md
Command Options
py-scaffold <project-name> [OPTIONS]
Options:
-t, --template TEXT Template to use (backend-api or ai-project)
-o, --output PATH Output directory (default: current directory)
-f, --force Force overwrite if directory exists
--help Show help message
Templates
Backend API
A layered architecture template with:
- Model Layer: Domain entities and data models
- Repository Layer: Data access and persistence abstraction
- Service Layer: Business logic and orchestration
- Controller Layer: Request handling and response formatting
- DTO Layer: Data transfer objects for API contracts
- YAML Configuration: Type-safe configuration management with Pydantic
Perfect for building RESTful APIs, microservices, or any backend application.
AI Project
A modular pipeline architecture for AI/ML applications with:
- RAG Pipeline: Retrieval-Augmented Generation with embedder, retriever, and generator components
- NLP Pipeline: Natural language processing and text analysis
- Model Components: Embedding models, fine-tuning utilities, and inference engine
- Data Management: Raw and processed data storage with data loaders
- Jupyter Notebooks: Pre-configured notebooks for preprocessing, training, and evaluation
- YAML Configuration: Configurable hyperparameters for models, training, and pipelines
- AI Assistant Documentation: Built-in CLAUDE.md and GitHub Copilot instructions
Perfect for building RAG applications, NLP pipelines, ML model training, or any AI/ML project.
Development
Setup Development Environment
# Clone the repository
git clone https://github.com/yourusername/py-scaffold.git
cd py-scaffold
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install in editable mode with dev dependencies
pip install -e ".[dev]"
Project Architecture
Backend API Architecture
The Backend API template follows a clean layered architecture:
- Controller Layer: Handles HTTP requests/responses and user interaction
- Service Layer: Contains business logic and orchestrates operations
- Repository Layer: Manages data access and persistence
- Model Layer: Defines domain entities
- DTO Layer: Defines data contracts for API communication
This separation ensures:
- Clear separation of concerns
- Easy testing and mocking
- Maintainable and scalable code
- Independent layer evolution
AI Project Architecture
The AI Project template follows a modular pipeline architecture:
-
Pipeline Layer: High-level workflows that orchestrate components
- RAG Pipeline: Embedding → Retrieval → Generation
- NLP Pipeline: Text preprocessing and analysis
-
Models Layer: ML model wrappers and training utilities
- Embedding models for vector representations
- Fine-tuning utilities for model customization
- Inference engine for predictions
-
Data Layer: Data loading and preprocessing
- Raw data ingestion
- Data transformation and cleaning
- Dataset management
-
Utils Layer: Shared utilities and helpers
- Logging and monitoring
- Common helper functions
This architecture ensures:
- Modular and composable components
- Easy experimentation with Jupyter notebooks
- Reproducible training and evaluation
- Production-ready deployment patterns
- Clear data and model versioning
Contributing
Contributions are welcome! Please read our Contributing Guidelines for details on:
- Setting up the development environment
- Code style and quality standards
- Testing requirements
- Pull request process
License
MIT License - see LICENSE file for details
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 py_scaffold_kit-0.1.0.tar.gz.
File metadata
- Download URL: py_scaffold_kit-0.1.0.tar.gz
- Upload date:
- Size: 56.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0549b9dd82e03d14cd237d5cd2d6371382cb73c3c2e76dc166b70b603a2ed03
|
|
| MD5 |
3600e367cfc429f7d4143134a040d467
|
|
| BLAKE2b-256 |
dc99040f825d30853b3ebe80364ac60d0c40b83815e6cb5b8114b1c7ac207000
|
File details
Details for the file py_scaffold_kit-0.1.0-py3-none-any.whl.
File metadata
- Download URL: py_scaffold_kit-0.1.0-py3-none-any.whl
- Upload date:
- Size: 56.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25687032aa5f3ac2896089293a4310c4b9da8cc70f8f5e6eb515e58d60d14348
|
|
| MD5 |
06cad6765df06443b43b0344771a866c
|
|
| BLAKE2b-256 |
5f7bf8b6f72b9dde52376a28b491b3aea08a671ee4f72ca7e9ce1e7873c1fdd1
|