Giter Club home page Giter Club logo

masonite_ide_helper's Introduction

Masonite IDE Helper

Masonite IDE Helper is a utility for generating Python type hinting stub files (.pyi) for Masonite ORM models. It automates the process of extracting relevant information such as class names, properties, and methods with their return types from model files.

Installation

You can install the Masonite IDE Helper via pip:

pip install masonite-ide-helper

Usage

To use the Masonite IDE Helper, follow these steps:

  1. Import the library:

    from masonite_ide_helper import IdeHelper
  2. Instantiate the IdeHelper class:

    ide_helper = IdeHelper(models_dir="path/to/models")

    If the models_dir parameter is not provided, it defaults to the "application/models" directory.

  3. Call the make_pyi_files method:

    ide_helper.make_pyi_files()

    This will generate .pyi files for the models located in the specified directory.

Example

from masonite_ide_helper import IdeHelper

# Instantiate IdeHelper with optional models directory parameter
ide_helper = IdeHelper(models_dir="path/to/models")

# Generate .pyi files for the models
ide_helper.make_pyi_files()

Documentation

IdeHelper class

__init__(self, models_dir: str | None = None)

Initializes an instance of IdeHelper.

  • models_dir (str | None): The directory path containing the model files. If not provided, defaults to the "application/models" directory.

make_pyi_files(self)

Generates Python type hinting stub files (.pyi) for the models located in the specified directory.

get_models(self)

Retrieves the list of model files from the specified directory and extracts relevant information such as class name, module path, properties, and methods with their return types.

Notes

  • This library assumes a standard Masonite project structure where models reside in the "application/models" directory. If your project structure differs, you may need to adjust the models_dir parameter accordingly.
  • If any error occurs during the generation of stubs for a model, the error message will be printed, and the process will continue for other models.

License

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

Contribution

Contributions are welcome! If you find any issues or want to improve the library, feel free to open a pull request or create an issue in the repository.

masonite_ide_helper's People

Contributors

jarriqthetechie avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.