Skip to main content

A cli for creating fastapi project quickly.

Project description

Create-fastapi-cli

A powerful CLI tool for quickly creating FastAPI projects, support >=Python 3.10.

Table of Contents

Features

  • Quick project setup with best practices
  • Support for both pip and poetry dependency management
  • Customizable project templates
  • Built-in testing and linting tools

Installation

pip install create-fastapi-cli

Quick Start

Create a new FastAPI project in seconds:

# poetry recommended
create-fastapi-cli --name myapp --install --poetry
# pip
create-fastapi-cli --name myapp --install
Option Description
--name The name of the project.
--install Install dependencies.
--poetry Use poetry to manage project, if not specified, will use pip to manage project.
--version The version of the cli.

Usage

Run

Start the FastAPI server:

cd myapp

# pip
uvicorn src.main:app --host 0.0.0.0 --port 8000 --log-level=info --reload

# poetry
poetry run uvicorn src.main:app --host 0.0.0.0 --port 8000 --log-level=info --reload

Lint

ruff check --fix

Format

ruff format

Type check

pytype

Test

pytest

Project Structure

myapp
├── confs
│   ├── config.yaml
│   └── unit-test.yaml
├── Dockerfile
├── pyproject.toml
├── pytest.ini
├── README.md
├── requirements.txt
├── src
│   ├── config.py
│   ├── constants.py
│   ├── database.py
│   ├── decos.py
│   ├── __init__.py
│   ├── main.py
│   ├── routers
│   │   ├── base.py
│   │   ├── greeting
│   │   │   ├── __init__.py
│   │   │   └── router.py
|   |   |   └── schemas.py
│   │   ├── __init__.py
│   └── utils.py
└── tests
    ├── conftest.py
    ├── __int__.py
    └── test_greeting.py

Development

Update the template code and test it locally. You need to test service and run test before publish.

pip install -e .

# pip
create-fastapi-cli --name myapp --install

# poetry
create-fastapi-cli --name myapp --install --poetry

Testing

Test will create two projects(>=Python 3.10), one is with Poetry, another is with Pip.

Publish

poetry publish --repository deeproute -u <username> -p <password>

Support

If you have any questions or need support, please contact us at yugang.cao12@gmail.com.

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

create_fastapi_cli-0.1.0.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

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

create_fastapi_cli-0.1.0-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file create_fastapi_cli-0.1.0.tar.gz.

File metadata

  • Download URL: create_fastapi_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.7 Linux/6.5.0-1025-azure

File hashes

Hashes for create_fastapi_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f18e549f9ff20027b86da500c60dd67f0d851427c374258a62be768fce6ec48d
MD5 bf5313469aeca8de67959b6e2365c7a0
BLAKE2b-256 00f25b7ef880e2445ceec6239597255a3e194e038aea7cc46d41df8877585a05

See more details on using hashes here.

File details

Details for the file create_fastapi_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: create_fastapi_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.7 Linux/6.5.0-1025-azure

File hashes

Hashes for create_fastapi_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7160a1e2d1548f4b473d6c165794bf70f428d2caccca9fd9376c9b882b511e12
MD5 7ecc13bfe28820302d977a4f4e3c82fe
BLAKE2b-256 5ed6ded5a57afe88daa9d33257f59a8ca09af85c50871d7f305dd9e3fc775c41

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