Skip to main content

A FastAPI project generator

Project description

Jackson Easy API

Easy API is a simple library for building APIs using FastAPI and SQLAlchemy. It provides an easy-to-use framework to help you create and manage APIs with minimal effort.

Installation

To install Easy API, run the following command:

pip install jackson_easy_api

After installation, run the start command to initialize your project and generate the manage.py file in the root of your project:

start

Available Commands

Commands:
  createproject <name>   Create a new project with the given name
  createapp <name>       Create a new app within your project
  makemigrations         Generate a new migration with a message
  migrate                Apply migrations to the database
  test <app_name>        Run tests for the specified app (or all apps if no app_name is provided)
  format <app_name>      Format a specified app using isort and blue
  --help, -h             Show this help message

Example Usage

  1. Create a new project:
python manage.py createproject my_project
  1. Create a new app within the project:
python manage.py createapp my_app

Important: After creating a new app, you must add the app name to the apps list in settings.py. This ensures the app's routes are included in the FastAPI application.

Here's an example of how to modify settings.py:

import importlib
from typing import List
from fastapi import FastAPI

class Settings:
    app_title: str = "API School"
    app_version: str = "1.0.0"
    apps: List[str] = ["my_app"]  # Add your app here

    @staticmethod
    def create_app() -> FastAPI:
        application: FastAPI = FastAPI(
            title=settings.app_title,
            version=settings.app_version,
        )

        # Loop through the apps and include their routes
        for app_name in settings.apps:
            app_module = importlib.import_module(f"{app_name}.routes")
            application.include_router(app_module.router, prefix=f"{app_name}", tags=[app_name])

        return application

settings = Settings()

This configuration will ensure that the routes for your app (my_app in this case) are included in the FastAPI application with a URL prefix of /my_app.

  1. Make migrations for your app:
python manage.py makemigrations
  1. Apply migrations to the database:
python manage.py migrate
  1. Run tests for a specific app:
python manage.py test my_app

Documentation

For detailed documentation and usage examples, please visit the GitHub repository.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

jackson_easy_api-0.3.301.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

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

jackson_easy_api-0.3.301-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file jackson_easy_api-0.3.301.tar.gz.

File metadata

  • Download URL: jackson_easy_api-0.3.301.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.11.10 Linux/6.5.0-1025-azure

File hashes

Hashes for jackson_easy_api-0.3.301.tar.gz
Algorithm Hash digest
SHA256 fb3b254c897f37b08e345210a115661ea91d1fcc54e2c4d0ae3e90a63e1d23dd
MD5 d60ffbf63451a64214805e12db4a1940
BLAKE2b-256 684a0ddf17fb8b7593da5f84909fdc9faf85f673ba1136de8ecb0484c08889ae

See more details on using hashes here.

File details

Details for the file jackson_easy_api-0.3.301-py3-none-any.whl.

File metadata

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

File hashes

Hashes for jackson_easy_api-0.3.301-py3-none-any.whl
Algorithm Hash digest
SHA256 7d071f1d4763886d0c08449c5bad81deb6234e8e30b82d852cd0452949c99193
MD5 737c0d805ef3cccb516beb200b1a28a7
BLAKE2b-256 ee417dc1972e63fec2feb437a7bf8b6ec2ffa28583a31539b381ffb68f5e8a45

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