Giter Club home page Giter Club logo

python-fastapi-template's Introduction

< Project Name >

Description

< Service description here >

Overview

This project is comprised of the following languages and libraries:

Auxiliary libraries and plugins were omitted but can be found in the pyproject.toml file.

Development

To start development it is recommended to have these utilities installed in a local development machine:

For better development experience, it is recommended these tools:

Be certain that you are installing Poetry with the correct version of Python in your machine, that is, Python 3.

This project is configured with VS Code in mind. To have access of tools and code analysis utilities, you only need to install project dependencies locally with poetry install and open the project workspace file on VS Code.

You will need python-dev/python3-dev packages to install packages locally. Please, consult your Linux distribution documentation.

The IDE should be automatically configured with standard rules and options for optimal development experience.

Any other IDE can be supported. If necessary, request a merge with a configuration file in the repository, considering that the development experience is consistent between IDEs and that it doesn't break compatibility and standardization with others.

Pre-commit hooks

This repository defines pre-commit hooks to help with development.

  • To install hooks, run: pre-commit install
  • To execute hooks, run: pre-commit run
  • To update hooks run: pre-commit clean followed by pre-commit install

Hooks will run before each commit when hooks are installed.

Running the API

To run the API in development mode, follow these steps:

  • Build/update image with: plis build
  • Start a container with: plis run --service-ports app bash
  • Configure your .env file, example in .env.example
  • Seed DB data with: poetry run seeder
  • Start the web server with: poetry run server
  • Check code style with: black --check app/ tests/
  • Format code with: black app/ tests/
  • Lint the code with: flake8 app/ tests/
  • Run static analysis with: mypy app/ tests/
  • Test the API with: pytest -n auto
  • Run entire validation stack with: black app tests && flake8 app tests && mypy app tests && pytest -n auto

Linting, static check and code style guide

Flake8 is the tool of choice for linting. It is configured to warn about code problems, complexity problems, common bugs and to help developers write better code.

Mypy is the tool of choice for static type checking. This project adopts gradual typing as the metodology for code typing. The rules of Mypy will be updated periodically to ensure that the entire code base is typed and consistent.

Black is the tool of choice for formating and code style guide. Black is an uncompromising formatter for Python code, that is, no code style discussions are necessary, the tool is always correct.

Linter and static type checking rules can be discussed and reviewed with the entire team. Any merge request that tries to change these rules without consent is automatically rejected and closed.

python-fastapi-template's People

Contributors

garmane avatar

Stargazers

Mark 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.