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.1.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.1-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: create_fastapi_cli-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 7ae74fb28a15d81febac36bd3ac47768f064b270e7e8da87c35f9bf747a298d6
MD5 4f22301904f30d6fe0c2c12f99798aee
BLAKE2b-256 cf5fe7e14512d0612dff055fc1caa1792701ef2b0182332337564aa3f743a8a4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: create_fastapi_cli-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 72d12a4f0f67c8c8bf391a64b75f810bef05ea7e8e76cad5cfb115b462e83ca3
MD5 b6a4eead7d66ca6a4b0b69074e177024
BLAKE2b-256 b4826beb31f5b7c6b0944a3bdad43d5faa2102f18c409261336d1f6448c2525a

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