Skip to main content

A command-line tool to scaffold FastAPI projects, inspired by vitejs.

Project description

scallpy

A command-line tool to scaffold FastAPI projects, inspired by vitejs.

Overview

scallpy helps you quickly set up new FastAPI projects with sensible defaults, providing both a "clean" and a "structured" project template.

Installation

For Users

Requirements: Python 3.10 or higher.

To install scallpy and use it to create new projects, it's recommended to use pipx. This ensures scallpy and its dependencies are installed in an isolated environment without affecting your global Python packages.

pipx install scallpy

pip install scallpy

After installation, you can use the scallpy command globally.

For Developers (Contributing to scallpy)

If you want to contribute to scallpy or modify its source code:

  1. Clone the repository:
    git clone https://github.com/jara505/fastapi-scallfolding.git
    cd fastapi-scallfolding
    
  2. Create and activate a virtual environment:
    python3 -m venv venv
    source venv/bin/activate
    
  3. Install in editable mode with dev dependencies:
    pip install -e ".[dev]"
    
  4. Run tests:
    pytest
    

Note: For stability, use Poetry 1.x (e.g., pip install poetry==1.8.3) when working with generated projects. Poetry 2.x may have compatibility issues.

Usage

scallpy provides a create command to generate new FastAPI projects.

Interactive Mode

To create a project interactively, simply run:

scallpy create

The CLI will guide you through selecting a project name, type, and other options.

Non-Interactive Mode (with parameters)

You can also provide parameters directly to bypass interactive prompts, which is useful for scripting or quick setups.

scallpy create --name <project-name> --type <project-type> [--use-db] [--use-orm] [--path <output-path>]

Parameters:

  • --name or -n: The name of your new FastAPI project. This will also be the name of the directory created for your project.
  • --type or -t: The type of project structure to generate.
    • clean: A minimal FastAPI project with a single main.py file.
    • structured: A more organized FastAPI project with separate modules for API routes, core configuration, and models.
  • --use-db (Optional): Include database support in the project. Use as a flag (e.g., --use-db).
  • --use-orm (Optional): Include ORM (Object-Relational Mapper) support in the project. Use as a flag (e.g., --use-orm).
  • --path or -p (Optional): The directory where the new project folder will be created. If not specified, the project will be created in the current working directory. If . is provided, the project folder will be created inside the current directory.

Example:

scallpy create --name my-awesome-api --type structured --path ./projects

Running Your Generated Project

After scallpy creates your project, it will provide specific instructions. Generally, the steps are:

  1. Navigate into your new project directory:
    cd <your-project-name>
    
  2. Install dependencies using Poetry:
    poetry install
    
  3. Run the FastAPI development server:
    • For clean projects:
      poetry run uvicorn <your-project-name>.main:app --reload
      
    • For structured projects:
      poetry run uvicorn <your-project-name>.main:app --reload
      
    (Replace <your-project-name> with the actual name you gave your project).

Your FastAPI application will typically be available at http://127.0.0.1:8000.

Contributing

We welcome contributions! Please feel free to open issues or submit pull requests.

Testing

To run the test suite:

pytest

Ensure all tests pass before submitting pull requests.

License

This project is licensed under the MIT License.

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

scallpy-0.1.3.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

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

scallpy-0.1.3-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file scallpy-0.1.3.tar.gz.

File metadata

  • Download URL: scallpy-0.1.3.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for scallpy-0.1.3.tar.gz
Algorithm Hash digest
SHA256 71c80bf117a94e7bfb59e5d51e981d72f9bb082fb787cf2c079a3c4f61991cb7
MD5 10db354555e256ad5745a293430fc16d
BLAKE2b-256 dedef2c57f89baffcf8b39a9b390af859a978a3b54d2c3a52976ec7b638ed60c

See more details on using hashes here.

File details

Details for the file scallpy-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: scallpy-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 16.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for scallpy-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 62ee0f8d229f85209f170a760f3af56cbb7d20c4d2fef999271b63b2a6e7b4a7
MD5 ce353a2996ffc19f20d26678706a9af3
BLAKE2b-256 eccce166f5cc832a6b55a61d01d2bb47b751052c8cca78850e49509a844e6469

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