Skip to main content

Midas Open API for Python

Project description

banner

made-with-python

Midas API: Revolutionizing Engineering 🚀

Welcome to the future of engineering with Midas API! 🌟 This cutting-edge repository is designed to transcend traditional engineering methodologies. A goldmine of innovation, Midas API eagerly awaits your contributions. Let's push the boundaries of possibility together! 😊

Table of Contents

Introduction

Midas API is a state-of-the-art tool designed to revolutionize the field of engineering. By providing robust, scalable, and efficient solutions, Midas API empowers engineers to tackle complex challenges with ease. Whether you're a seasoned professional or a newcomer, Midas API is here to support your engineering journey.

Getting Started

Prerequisites

  1. Install VSCode: Download and install Visual Studio Code from the official Visual Studio Code website.
  2. Install Python: Download and install Python 3.12.1 from the official Python website. Ensure Python is added to your PATH during installation.
  3. Install Pipenv: Use pip to install Pipenv, a tool that helps manage dependencies.
    pip install pipenv
    
  4. Install Project Dependencies: Navigate to your project directory and install the necessary modules using Pipenv.
    • For running environment:
    pipenv install
    
    • For development environment:
    pipenv install --dev
    
  5. Prepare to Use Midas API: Visit the Midas API Documentation for more details.

Coding Conventions

Project Structure

  • project/: Develop each plugin within this folder.
  • base/: Contains shared utility functions and base modules like MidasAPI. Use this folder for any calculation base functions.
  • tests/: Contains test files for regression testing.
  • rod/: Extract JSON schema from this repository.
  • docs/: Sphinx document folder.

Style Guide

Adhere to the Google Python Style Guide for comprehensive coding conventions.

  • Using Flake8: Install flake8 to automatically check and enforce coding conventions during development.
    pip install flake8
    
    flake8 Visual Studio Code extension
  • Development Environment: Configure your development environment to use flake8. Ensure any issues flagged by flake8 are corrected promptly.

Documentation Guide

Proper documentation is key to maintainability. Ensure that all functions, especially those in the base module, are well-documented.

  • Using autoDocstring: Install autoDocstring to assist with writing docstrings. (ctrl + shift + 2) autoDocstring Visual Studio Code extension
  • Docstrings: Use Google-style docstrings. Install the necessary extensions to assist with writing docstrings.
    • Example: Data class with docstring:

      from dataclasses import dataclass, field as dataclass_field
      
      @dataclass
      class Person:
          """
          Person details.
          """
          name: str = dataclass_field(default="", metadata={"description": "The person's full name."})
          age: int = dataclass_field(default=0, metadata={"description": "The person's age."})
          email: str = dataclass_field(default='', metadata={"description": "The person's email address."})
      
    • Example: Pydantic model with docstring:

      from pydantic import BaseModel, Field
      from typing import List, Dict, Union
      
      class Contact(BaseModel):
          """
          Contact details.
          """
          phone: str = Field(default="", description="The contact's phone number.")
          address: str = Field(default='', description="The contact's address.")
      
      def my_function(person: Person, contacts: List[Contact], settings: Dict[str, Union[int, str]] = {}) -> bool:
          """
          Processes person and their contacts with given settings.
      
          Args:
              person: The person details.
              contacts: List of contact details.
              settings: Miscellaneous settings.
      
          Returns:
              bool: True if successful, False otherwise.
          """
          return True
      

Testing

Ensure the reliability of new code by writing comprehensive tests.

  • Regression Tests: For any additions to the base module, add corresponding regression tests using pytest.

  • Test Files: Save test files in the tests folder with the test_*.py naming convention.

    • Example Test:
      import json
      import pytest
      import moapy.plugins.baseplate_KDS41_30_2022.baseplate_KDS41_30_2022_calc
      
      def test_baseplate_KDS41_30_2022_calc():
          input = {  
              'B' : 240, 'H' : 240, 'Fc' : 24, 'Fy' : 400,  
              'Ec' : 25811.006260943130, 'Es' : 210000,  
              'bolt' : [  
                { 'X' : 90, 'Y' : 0, 'Area' : 314.15926535897933 },  
                { 'X' : -90, 'Y' : 0, 'Area' : 314.15926535897933 } ],  
              'P' : -3349.9999999999964, 'Mx' : 0, 'My' : 51009999.999999985 
          }
      
          JsonData = json.dumps(input)
          result = moapy.plugins.baseplate_KDS41_30_2022.baseplate_KDS41_30_2022_calc.calc_ground_pressure(JsonData)
          
          assert pytest.approx(result['bolt'][0]['Load']) == 0.0
          assert pytest.approx(result['bolt'][1]['Load']) == -269182.84245616524
      

Summary

  • Coding Conventions: Follow the Google Python Style Guide and use flake8 for enforcement.
  • Documentation: Write and maintain proper docstrings for all functions.
  • Testing: Develop test cases for new functions to enable regression testing.

By adhering to these rules and conventions, we can ensure our codebase remains high-quality, consistent, and reliable.

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

moapy-1.3.1.tar.gz (59.4 MB view details)

Uploaded Source

Built Distribution

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

moapy-1.3.1-py3-none-any.whl (59.9 MB view details)

Uploaded Python 3

File details

Details for the file moapy-1.3.1.tar.gz.

File metadata

  • Download URL: moapy-1.3.1.tar.gz
  • Upload date:
  • Size: 59.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.4

File hashes

Hashes for moapy-1.3.1.tar.gz
Algorithm Hash digest
SHA256 070a16b6af74b8b9aed37670e65a812f94dc0860667ec0016773619d401ab7db
MD5 768e3bcb31affbdf3c66ac3d0302545a
BLAKE2b-256 bbe4bb29f372d1b815c3b613e2f63da1ba3cb410c81e1a8f20fd2d35db3d34e4

See more details on using hashes here.

File details

Details for the file moapy-1.3.1-py3-none-any.whl.

File metadata

  • Download URL: moapy-1.3.1-py3-none-any.whl
  • Upload date:
  • Size: 59.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.4

File hashes

Hashes for moapy-1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 94f93b85ab24280d377e643b5308a8eadcc11f3e1c474cdaebde8c40dd16a374
MD5 06857ebb0408749a78121ea5cae7896f
BLAKE2b-256 8bc42e2be8e598b35b091dccd27048ff0be254afa21b6bc726dab7693eb8ca9b

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