Skip to main content

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

  1. Navigate to your project:

    cd my-awesome-api
    
  2. Install dependencies:

    poetry install
    
  3. Copy environment file:

    cp .env.example .env
    
  4. Run the application:

    make run
    # or
    poetry run uvicorn app.main:app --reload
    
  5. Visit the API documentation:

Available Make Commands

  • make run - Start the development server
  • make test - Run tests
  • make test-cov - Run tests with coverage report
  • make format - Format code (Black + isort)
  • make lint - Lint code (flake8 + mypy)
  • make clean - Remove cache files
  • make build - Build the package
  • make docker-build - Build Docker image
  • make 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:

  1. Clone the repository
  2. Install development dependencies: pip install -e .[dev]
  3. Run tests: pytest
  4. Format code: black . && isort .
  5. 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

dreipc_python-1.0.5.tar.gz (52.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dreipc_python-1.0.5-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file dreipc_python-1.0.5.tar.gz.

File metadata

  • Download URL: dreipc_python-1.0.5.tar.gz
  • Upload date:
  • Size: 52.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for dreipc_python-1.0.5.tar.gz
Algorithm Hash digest
SHA256 db858cfe699702498412a3443588689f22d9da0aa326edf733fbc024f38f3c45
MD5 47d1acb32e94a91b6555a052690c769b
BLAKE2b-256 bfbac9f750b56fc663406f0ded79e30becd8f37dd64cd3c4ef62791f98c9fc5b

See more details on using hashes here.

File details

Details for the file dreipc_python-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: dreipc_python-1.0.5-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

Hashes for dreipc_python-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 eaaaec41ae5e3a4dd92a2725d047b4ffd72d0cff12229c76f600dbaa8dd36ea2
MD5 60a193ab1899294ac7d0c945b7efe40f
BLAKE2b-256 4daf21699755be8b730a2cae6ee8a2e3bcedf4c15338f816d1b85be578a34a0e

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