Skip to main content

Python CLI for generate resource such as model, controller, service, schema and repository

Project description

Resource Generator For FastApi


Source Code: https://github.com/RatanaKH/resource_generator

Overview

A generate command for a FastAPI project simplifies the creation of common components like models, controllers, services, and schemas. It acts as a code scaffolding tool, ensuring consistent structure, reducing boilerplate, and accelerating development.

Key Reasons for Creating a generate Command

  1. Consistency Across the Codebase: Enforcing a consistent naming convention and folder structure. Preventing errors caused by manual file creation and misplaced code. Ensuring that all components follow best practices and are aligned with project standards.

  2. Improved Developer Productivity: Automating repetitive tasks like creating models, schemas, and services. Reducing time spent writing boilerplate code for new components. Allowing developers to focus on business logic instead of setup tasks.

  3. Scalability for Large Teams: Standardizing the creation process for teams to minimize onboarding effort. Reducing human errors and misunderstandings regarding file and module organization. Making collaboration smoother by enforcing project guidelines automatically.

  4. Maintainability: Encouraging modular and predictable code organization. Generating components with pre-defined templates ensures maintainable and testable code. Easy refactoring and debugging, as all components are structured consistently.

Installation

To install this package, use pip:

  pip install resource-generator

To install this package, use poetry:

  poetry add resource-generator

How to use command

  ratana-pls make-[OPTION] name [FILE_NAME]

Example:

  ratana-pls make-model name Users
  
  # Generate model and Users Controller
  ratana-pls make-model name Users --controller 
  
  # Generate model and Users Service
  ratana-pls make-model name Users --service
  
  # Generate model and Users Schema
  ratana-pls make-model name Users --schema 
  
  # Generate model and Users Repository
  ratana-pls make-model name Users --repository 
  ratana-pls make-controller name Users
  ratana-pls make-repository name Users
  ratana-pls make-schema name Users
  ratana-pls make-service name Users

Sample project structure

Project-Name
├── app
│   ├── controllers
│   ├── services
│   ├── models
│   ├── schemas
│   ├── repository
│   ├── router.py
│   ├── main.py
├── poetry.lock
├── package.json
├── pyproject.toml
└── .gitignore

This package is built on the typer library.

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

resource_generator-0.1.7.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

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

resource_generator-0.1.7-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file resource_generator-0.1.7.tar.gz.

File metadata

  • Download URL: resource_generator-0.1.7.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.12.8 Linux/6.8.0-1017-azure

File hashes

Hashes for resource_generator-0.1.7.tar.gz
Algorithm Hash digest
SHA256 c31dc97ab1f6992a7008fbc9cae48c213d5facd2bbdd1ae019f82ca21ab4add2
MD5 52d71135f4af3b99dd462873052c31b5
BLAKE2b-256 5fe8613b6a25c6288be984702cbb6fe0be0e213fd7a1076b5752b11f080884bb

See more details on using hashes here.

File details

Details for the file resource_generator-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: resource_generator-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.12.8 Linux/6.8.0-1017-azure

File hashes

Hashes for resource_generator-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 89661ed91a17c4b2e9297a6f3b3fff81bf574bf01822e5a9ef28ad87158deaea
MD5 81918b3f0322d18a1f4ba2ce9541e6fc
BLAKE2b-256 082422d19083746988d607d3bfc0b23f376d852182b68b29e05e89dc29ea4764

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