A simple CLI tool for creating FastAPI projects for 3pc
Project description
DreiPC Python CLI
A simple command-line tool for creating FastAPI projects
Installation
From PyPI (when published)
pip install dreipc-python
From Source
git clone https://github.com/yourusername/dreipc-python.git
cd dreipc-python
pip install -e .
Usage
Create a new project
dreipc-python create my-awesome-api
Interactive mode
dreipc-python create my-api --interactive
With custom details
dreipc-python create my-api \
--author "Your Name" \
--email "your@email.com" \
--description "My awesome FastAPI application"
Get help
dreipc-python --help
dreipc-python create --help
Generated Project Features
✅ FastAPI with async/await support
✅ Dependency Injection using dependency-injector
✅ Pydantic Models for data validation
✅ Structured Layout with separation of concerns
✅ Testing Suite with pytest and pytest-asyncio
✅ Code Quality tools (Black, isort, flake8, mypy)
✅ Poetry for dependency management
✅ Docker support with Dockerfile
✅ Makefile with common development tasks
✅ Environment Configuration with pydantic-settings
✅ CORS Middleware preconfigured
✅ API Documentation with FastAPI's built-in Swagger UI
Generated Project Structure
my-awesome-api/
├── app/
│ ├── api/
│ │ ├── endpoints/
│ │ │ ├── health.py # Health check endpoints
│ │ │ └── users.py # User CRUD endpoints
│ │ └── routes.py # API router configuration
│ ├── core/
│ │ ├── config.py # Application settings
│ │ └── container.py # DI container setup
│ ├── dependencies/
│ │ └── container.py # FastAPI dependencies
│ ├── models/
│ │ └── user.py # Pydantic models
│ ├── services/
│ │ ├── base.py # Base service class
│ │ └── user_service.py # Business logic
│ └── main.py # Application entry point
├── tests/
│ ├── unit/
│ │ └── test_user_service.py
│ ├── integration/
│ │ └── test_api.py
│ └── conftest.py
├── pyproject.toml # Poetry configuration
├── Dockerfile # Docker configuration
├── Makefile # Development commands
├── .env.example # Environment variables template
├── .gitignore # Git ignore rules
└── README.md # Project documentation
Quick Start After Project Creation
-
Navigate to your project:
cd my-awesome-api
-
Install dependencies:
poetry install -
Copy environment file:
cp .env.example .env
-
Run the application:
make run # or poetry run uvicorn app.main:app --reload
-
Visit the API documentation:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
Available Make Commands
make run- Start the development servermake test- Run testsmake test-cov- Run tests with coverage reportmake format- Format code (Black + isort)make lint- Lint code (flake8 + mypy)make clean- Remove cache filesmake build- Build the packagemake docker-build- Build Docker imagemake docker-run- Run Docker container
Example API Usage
The generated project includes a complete user management API:
Create a user
curl -X POST "http://localhost:8000/api/v1/users/" \
-H "Content-Type: application/json" \
-d '{"name": "John Doe", "email": "john@example.com"}'
Get all users
curl "http://localhost:8000/api/v1/users/"
Get a specific user
curl "http://localhost:8000/api/v1/users/1"
Update a user
curl -X PUT "http://localhost:8000/api/v1/users/1" \
-H "Content-Type: application/json" \
-d '{"name": "Jane Doe"}'
Delete a user
curl -X DELETE "http://localhost:8000/api/v1/users/1"
Requirements
- Python 3.8+
- Poetry (for dependency management)
Development
To contribute to this project:
- Clone the repository
- Install development dependencies:
pip install -e .[dev] - Run tests:
pytest - Format code:
black . && isort . - Lint code:
flake8 && mypy fastapi_cli/
License
MIT License - see LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
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
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 dreipc_python-1.0.3.tar.gz.
File metadata
- Download URL: dreipc_python-1.0.3.tar.gz
- Upload date:
- Size: 51.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee728424cdb52ef0dee5a07e63c385957f577dbc740bc766756ee60877775bc1
|
|
| MD5 |
c572bce52109c42b23f5be68a1570eb6
|
|
| BLAKE2b-256 |
44e749fa0343c082cd8c5e10cee1e1489c75ed44a392673380bb9c849cec52d9
|
File details
Details for the file dreipc_python-1.0.3-py3-none-any.whl.
File metadata
- Download URL: dreipc_python-1.0.3-py3-none-any.whl
- Upload date:
- Size: 14.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d7616ebd45711d8394de0b5a320a39d0799b6ed52100b9abaaf57bcaed8d4c9
|
|
| MD5 |
945c087d4ee9f40a545b4f972cd56a49
|
|
| BLAKE2b-256 |
bcca92de5568a15ae0b8fe587a153df2cfaa025c0d0887509e64c7c79a998bda
|