Giter Site home page Giter Site logo

pydantic_api's Introduction

Project structure

This FastAPI project is structured to provide a web application with functionalities around managing places and opinions about those places.

Modules Functionality

Installation

The project uses Poetry for dependency management. To install the project dependencies, use the command:

poetry install --no-root

To create tables in the database, use the command:

poetry run python -m fastapi_project.db.create_tables

To run the FastAPI application, use the command:

poetry run uvicorn fastapi_project.main:app --reload

Project Structure

Core

The core module, specifically in pydantic_core.py and sqlalchemy_core.py, defines Pydantic models for data validation and SQLAlchemy models for database interactions, respectively. These models are essential for handling the data structure of places and opinions.

Database (DB)

The db module contains scripts like create_db.py and create_tables.py for initializing the database and creating necessary tables.

Repositories

The repositories module, found in repositories.py, implements the data access layer, providing an abstraction over the database operations for places and opinions.

Routers

The routers module defines the API routes for places and opinions. These routes handle HTTP requests and responses, interacting with the repositories to perform CRUD operations.

Tests

The tests module contains unit and integration tests for API endpoints and database operations, ensuring the reliability of the application.

Async Routes

The project leverages asynchronous routes, as seen in the routers, to handle HTTP requests. This asynchronous approach is beneficial for IO-bound operations, such as database interactions, improving the application's performance.

Tests

Tests are implemented using pytest-asyncio and async-asgi-testclient. To run the tests, use the command:

poetry run pytest

Migrations

Migrations are managed through Alembic.

pydantic_api's People

Contributors

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