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.5.tar.gz (5.3 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.5-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: resource_generator-0.1.5.tar.gz
  • Upload date:
  • Size: 5.3 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.5.tar.gz
Algorithm Hash digest
SHA256 d6e5d08b6af3939200050dbb9b97b34d9415f913582986812ecccc2b5220b365
MD5 6779b4b97476c02ec2f0c1d0a20091cd
BLAKE2b-256 0bb572af04c462d22550c2030e257e3e3873bdfc96c79bbe59c8be47cd63d633

See more details on using hashes here.

File details

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

File metadata

  • Download URL: resource_generator-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 8.5 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c8c3874420587f3fa1605b2ab41ad26d6c52690bfe8796aac258eed9eb31819f
MD5 535a95b5ee63e6d9b2818e686216981c
BLAKE2b-256 59239ddf53cdddc6feb9893a0731fe35c451acc91bdf9dcf4b4a060315567cd4

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