Fastapi-class

Latest version: v3.6.0

Safety actively analyzes 681812 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 2

3.6.0

Fixes

* 🐛 Fix issue with `endpoint` decorator & Setup `uv` by yezz123 in https://github.com/yezz123/fastapi-class/pull/182

Dependencies

* ⬆ Bump pre-commit from 3.6.0 to 3.6.1 by dependabot in https://github.com/yezz123/fastapi-class/pull/164
* ⬆ Bump pre-commit/action from 3.0.0 to 3.0.1 by dependabot in https://github.com/yezz123/fastapi-class/pull/166
* ⬆ Bump pytest-asyncio from 0.23.4 to 0.23.5 by dependabot in https://github.com/yezz123/fastapi-class/pull/165
* ⬆ Bump pytest from 7.4.4 to 8.0.1 by dependabot in https://github.com/yezz123/fastapi-class/pull/168
* ⬆ Bump pre-commit from 3.6.1 to 3.6.2 by dependabot in https://github.com/yezz123/fastapi-class/pull/167
* ⬆ Bump pytest from 8.0.1 to 8.0.2 by dependabot in https://github.com/yezz123/fastapi-class/pull/170
* ⬆ Update fastapi requirement from <0.109.3,>=0.65.2 to >=0.65.2,<0.110.1 by dependabot in https://github.com/yezz123/fastapi-class/pull/169
* ⬆ Bump pypa/gh-action-pypi-publish from 1.8.11 to 1.8.12 by dependabot in https://github.com/yezz123/fastapi-class/pull/172
* ⬆ Bump pytest from 8.0.2 to 8.1.0 by dependabot in https://github.com/yezz123/fastapi-class/pull/171
* ⬆ Bump pypa/gh-action-pypi-publish from 1.8.12 to 1.8.14 by dependabot in https://github.com/yezz123/fastapi-class/pull/176
* ⬆ Bump pytest from 8.1.0 to 8.1.1 by dependabot in https://github.com/yezz123/fastapi-class/pull/173
* ⬆ Bump mypy from 1.8.0 to 1.9.0 by dependabot in https://github.com/yezz123/fastapi-class/pull/175
* ⬆ Bump pytest-asyncio from 0.23.5 to 0.23.5.post1 by dependabot in https://github.com/yezz123/fastapi-class/pull/174
* ⬆ Bump pytest-asyncio from 0.23.5.post1 to 0.23.6 by dependabot in https://github.com/yezz123/fastapi-class/pull/177
* ⬆ Bump pre-commit from 3.6.2 to 3.7.0 by dependabot in https://github.com/yezz123/fastapi-class/pull/179
* ⬆ Bump pytest-cov from 4.1.0 to 5.0.0 by dependabot in https://github.com/yezz123/fastapi-class/pull/178
* ⬆ Update fastapi requirement from <0.110.1,>=0.65.2 to >=0.65.2,<0.110.2 by dependabot in https://github.com/yezz123/fastapi-class/pull/181

3.5.0

What's Changed

Fixes 🐛

* ♻️ Refactor CI workflow for linting and testing by yezz123 in https://github.com/yezz123/fastapi-class/pull/162
* ♻️ Update ruff to v0.2.0 & fix type hints by yezz123 in https://github.com/yezz123/fastapi-class/pull/163

Dependencies ⬆️

* ⬆ Update fastapi requirement from <0.105.0,>=0.65.2 to >=0.65.2,<0.106.0 by dependabot in https://github.com/yezz123/fastapi-class/pull/152
* ⬆ Bump mypy from 1.7.1 to 1.8.0 by dependabot in https://github.com/yezz123/fastapi-class/pull/153
* ⬆ Update fastapi requirement from <0.106.0,>=0.65.2 to >=0.65.2,<0.109.0 by dependabot in https://github.com/yezz123/fastapi-class/pull/154
* ⬆ Bump pytest from 7.4.3 to 7.4.4 by dependabot in https://github.com/yezz123/fastapi-class/pull/155
* ⬆ Bump pytest-asyncio from 0.23.2 to 0.23.3 by dependabot in https://github.com/yezz123/fastapi-class/pull/156
* ⬆ Update fastapi requirement from <0.109.0,>=0.65.2 to >=0.65.2,<0.110.0 by dependabot in https://github.com/yezz123/fastapi-class/pull/157
* ⬆ Bump actions/cache from 3 to 4 by dependabot in https://github.com/yezz123/fastapi-class/pull/158
* ⬆ Bump codecov/codecov-action from 3 to 4 by dependabot in https://github.com/yezz123/fastapi-class/pull/161
* ⬆ Bump pytest-asyncio from 0.23.3 to 0.23.4 by dependabot in https://github.com/yezz123/fastapi-class/pull/160


**Full Changelog**: https://github.com/yezz123/fastapi-class/compare/3.4.0...3.5.0

3.4.0

What's Changed

Fixes 🐛

* ✨ support endpoint string method by wu-clan in https://github.com/yezz123/fastapi-class/pull/103
* ✨ Support python 3.12 by yezz123 in https://github.com/yezz123/fastapi-class/pull/151


Dependencies 📦

* ⬆ Bump requests from 2.28.2 to 2.29.0 by dependabot in https://github.com/yezz123/fastapi-class/pull/106
* ⬆ Bump requests from 2.29.0 to 2.30.0 by dependabot in https://github.com/yezz123/fastapi-class/pull/107
* ⬆ Bump pre-commit from 3.2.2 to 3.3.1 by dependabot in https://github.com/yezz123/fastapi-class/pull/108
* ⬆ Bump pypa/gh-action-pypi-publish from 1.8.5 to 1.8.6 by dependabot in https://github.com/yezz123/fastapi-class/pull/109
* ⬆ Bump mypy from 1.2.0 to 1.3.0 by dependabot in https://github.com/yezz123/fastapi-class/pull/110
* ⬆ Bump pre-commit from 3.3.1 to 3.3.2 by dependabot in https://github.com/yezz123/fastapi-class/pull/111
* ⬆ Bump requests from 2.30.0 to 2.31.0 by dependabot in https://github.com/yezz123/fastapi-class/pull/112
* ⬆ Bump pytest-cov from 4.0.0 to 4.1.0 by dependabot in https://github.com/yezz123/fastapi-class/pull/113
* ⬆ Update fastapi requirement from <0.96.0,>=0.65.2 to >=0.65.2,<0.97.0 by dependabot in https://github.com/yezz123/fastapi-class/pull/114
* ⬆ Update fastapi requirement from <0.97.0,>=0.65.2 to >=0.65.2,<0.98.0 by dependabot in https://github.com/yezz123/fastapi-class/pull/116
* ⬆ Bump pytest from 7.3.1 to 7.3.2 by dependabot in https://github.com/yezz123/fastapi-class/pull/115
* ⬆ Bump pre-commit from 3.3.2 to 3.3.3 by dependabot in https://github.com/yezz123/fastapi-class/pull/117
* ⬆ Bump pytest from 7.3.2 to 7.4.0 by dependabot in https://github.com/yezz123/fastapi-class/pull/119
* ⬆ Bump pypa/gh-action-pypi-publish from 1.8.6 to 1.8.7 by dependabot in https://github.com/yezz123/fastapi-class/pull/121
* ⬆ Bump mypy from 1.3.0 to 1.4.1 by dependabot in https://github.com/yezz123/fastapi-class/pull/120
* ⬆ Update fastapi requirement from <0.98.0,>=0.65.2 to >=0.65.2,<0.100.0 by dependabot in https://github.com/yezz123/fastapi-class/pull/123
* ⬆ Update fastapi requirement from <0.100.0,>=0.65.2 to >=0.65.2,<0.101.0 by dependabot in https://github.com/yezz123/fastapi-class/pull/124
* ⬆ Bump pytest-asyncio from 0.21.0 to 0.21.1 by dependabot in https://github.com/yezz123/fastapi-class/pull/125
* ⬆ Bump pypa/gh-action-pypi-publish from 1.8.7 to 1.8.8 by dependabot in https://github.com/yezz123/fastapi-class/pull/126
* Fixed typo by kjurel in https://github.com/yezz123/fastapi-class/pull/131
* ⬆ Bump pypa/gh-action-pypi-publish from 1.8.8 to 1.8.10 by dependabot in https://github.com/yezz123/fastapi-class/pull/130
* ⬆ Bump mypy from 1.4.1 to 1.5.0 by dependabot in https://github.com/yezz123/fastapi-class/pull/129
* ⬆ Bump mypy from 1.5.0 to 1.5.1 by dependabot in https://github.com/yezz123/fastapi-class/pull/132
* ⬆ Update fastapi requirement from <0.101.0,>=0.65.2 to >=0.65.2,<0.102.0 by dependabot in https://github.com/yezz123/fastapi-class/pull/128
* ⬆ Bump pre-commit from 3.3.3 to 3.4.0 by dependabot in https://github.com/yezz123/fastapi-class/pull/135
* ⬆ Bump pytest from 7.4.0 to 7.4.1 by dependabot in https://github.com/yezz123/fastapi-class/pull/134
* ⬆ Update fastapi requirement from <0.102.0,>=0.65.2 to >=0.65.2,<0.104.0 by dependabot in https://github.com/yezz123/fastapi-class/pull/133
* ⬆ Update pydantic requirement from !=1.7,!=1.7.1,!=1.7.2,!=1.7.3,!=1.8,!=1.8.1,<2.0.0,>=1.6.2 to >=1.6.2,!=1.7,!=1.7.1,!=1.7.2,!=1.7.3,!=1.8,!=1.8.1,<3.0.0 by dependabot in https://github.com/yezz123/fastapi-class/pull/122
* ⬆ Bump actions/checkout from 3 to 4 by dependabot in https://github.com/yezz123/fastapi-class/pull/137
* ⬆ Bump pytest from 7.4.1 to 7.4.2 by dependabot in https://github.com/yezz123/fastapi-class/pull/136
* ⬆ Bump pre-commit from 3.4.0 to 3.5.0 by dependabot in https://github.com/yezz123/fastapi-class/pull/139
* ⬆ Bump mypy from 1.5.1 to 1.6.0 by dependabot in https://github.com/yezz123/fastapi-class/pull/138
* ⬆ Bump mypy from 1.5.1 to 1.6.1 by dependabot in https://github.com/yezz123/fastapi-class/pull/140
* ⬆ Update fastapi requirement from <0.104.0,>=0.65.2 to >=0.65.2,<0.105.0 by dependabot in https://github.com/yezz123/fastapi-class/pull/141
* ⬆ Bump pytest from 7.4.2 to 7.4.3 by dependabot in https://github.com/yezz123/fastapi-class/pull/142
* ⬆ Bump pytest-asyncio from 0.21.1 to 0.23.1 by dependabot in https://github.com/yezz123/fastapi-class/pull/146
* ⬆ Bump mypy from 1.6.1 to 1.7.1 by dependabot in https://github.com/yezz123/fastapi-class/pull/144
* ⬆ Bump pypa/gh-action-pypi-publish from 1.8.10 to 1.8.11 by dependabot in https://github.com/yezz123/fastapi-class/pull/145
* ⬆ Bump actions/setup-python from 4 to 5 by dependabot in https://github.com/yezz123/fastapi-class/pull/149
* ⬆ Bump pytest-asyncio from 0.23.1 to 0.23.2 by dependabot in https://github.com/yezz123/fastapi-class/pull/147
* ⬆ Bump pre-commit from 3.5.0 to 3.6.0 by dependabot in https://github.com/yezz123/fastapi-class/pull/148


New Contributors
* kjurel made their first contribution in https://github.com/yezz123/fastapi-class/pull/131

**Full Changelog**: https://github.com/yezz123/fastapi-class/compare/3.3.0...3.4.0

3.3.0

What's Changed

- Supporting python 3.8 & 3.9

* ✨ feat: Support `PEP563` by yezz123 in https://github.com/yezz123/fastapi-class/pull/102


New Contributors
* wu-clan made their first contribution at https://github.com/yezz123/fastapi-class/pull/101

**Full Changelog**: https://github.com/yezz123/fastapi-class/compare/3.2.0...3.3.0

3.2.0

What's Changed

* Feat: Customise status code & Enhance exceptions by yezz123 in https://github.com/yezz123/fastapi-class/pull/100

Dependencies 🔨

* ⬆ Bump pre-commit from 3.2.0 to 3.2.1 by dependabot in https://github.com/yezz123/fastapi-class/pull/89
* ⬆ Bump pytest-pretty from 1.1.0 to 1.1.1 by dependabot in https://github.com/yezz123/fastapi-class/pull/90
* ⬆ Bump pypa/gh-action-pypi-publish from 1.8.1 to 1.8.3 by dependabot in https://github.com/yezz123/fastapi-class/pull/91
* ⬆ Bump pypa/gh-action-pypi-publish from 1.8.3 to 1.8.4 by dependabot in https://github.com/yezz123/fastapi-class/pull/92
* ⬆ Bump pytest from 7.2.2 to 7.3.0 by dependabot in https://github.com/yezz123/fastapi-class/pull/93
* ⬆ Bump pytest-pretty from 1.1.1 to 1.2.0 by dependabot in https://github.com/yezz123/fastapi-class/pull/94
* ⬆ Bump pre-commit from 3.2.1 to 3.2.2 by dependabot in https://github.com/yezz123/fastapi-class/pull/95
* ⬆ Bump mypy from 1.1.1 to 1.2.0 by dependabot in https://github.com/yezz123/fastapi-class/pull/96
* ⬆ Bump pypa/gh-action-pypi-publish from 1.8.4 to 1.8.5 by dependabot in https://github.com/yezz123/fastapi-class/pull/97
* ⬆ Bump pytest from 7.3.0 to 7.3.1 by dependabot in https://github.com/yezz123/fastapi-class/pull/98


**Full Changelog**: https://github.com/yezz123/fastapi-class/compare/3.1.0...3.2.0

3.1.0

⚠️ Drop Support of Python 3.8 | 3.9 & New Break Changes

As you create more complex FastAPI applications, you may find yourself frequently repeating the same dependencies in multiple related endpoints.

We Introduce this new version **showcases the usage of CVB in FastAPI** by yezz123 in https://github.com/yezz123/fastapi-class/pull/82

A common question people have as they become more comfortable with FastAPI is how they can reduce the number of times they have to copy/paste the same dependency into related routes.

`fastapi_class` provides a `class-based view` decorator `View` to help reduce the amount of boilerplate necessary when developing related routes.

> Highly inspired by [Fastapi-utils](https://fastapi-utils.davidmontague.xyz/user-guide/class-based-views/), Thanks to [dmontagu](https://github.com/dmontagu) for the great work.

- Example:

python
from fastapi import FastAPI, APIRouter, Query
from pydantic import BaseModel
from fastapi_class import View

app = FastAPI()
router = APIRouter()

class ItemModel(BaseModel):
id: int
name: str
description: str = None

View(router)
class ItemView:
def post(self, item: ItemModel):
return item

def get(self, item_id: int = Query(..., gt=0)):
return {"item_id": item_id}

app.include_router(router)


Response model 📦

`Exception` in list need to be either function that return `fastapi.HTTPException` itself. In case of a function it is required to have all of it's arguments to be `optional`.

py
from fastapi import FastAPI, APIRouter, HTTPException, status
from fastapi.responses import PlainTextResponse
from pydantic import BaseModel

from fastapi_class import View

app = FastAPI()
router = APIRouter()

NOT_AUTHORIZED = HTTPException(401, "Not authorized.")
NOT_ALLOWED = HTTPException(405, "Method not allowed.")
NOT_FOUND = lambda item_id="item_id": HTTPException(404, f"Item with {item_id} not found.")

class ItemResponse(BaseModel):
field: str | None = None

view(router)
class MyView:
exceptions = {
"__all__": [NOT_AUTHORIZED],
"put": [NOT_ALLOWED, NOT_FOUND]
}

RESPONSE_MODEL = {
"put": ItemResponse
}

RESPONSE_CLASS = {
"delete": PlainTextResponse
}

def get(self):
...
def put(self):
...
def delete(self):
...

app.include_router(router)


Customized Endpoints

py
from fastapi import FastAPI, APIRouter, HTTPException
from fastapi.responses import PlainTextResponse
from pydantic import BaseModel

from fastapi_class import View, endpoint

app = FastAPI()
router = APIRouter()

NOT_AUTHORIZED = HTTPException(401, "Not authorized.")
NOT_ALLOWED = HTTPException(405, "Method not allowed.")
NOT_FOUND = lambda item_id="item_id": HTTPException(404, f"Item with {item_id} not found.")
EXCEPTION = HTTPException(400, "Example.")

class UserResponse(BaseModel):
field: str | None = None

View(router)
class MyView:
exceptions = {
"__all__": [NOT_AUTHORIZED],
"put": [NOT_ALLOWED, NOT_FOUND],
"edit": [EXCEPTION]
}

RESPONSE_MODEL = {
"put": UserResponse,
"edit": UserResponse
}

RESPONSE_CLASS = {
"delete": PlainTextResponse
}

def get(self):
...
def put(self):
...
def delete(self):
...
endpoint(("PUT",), path="edit")
def edit(self):
...


Dependencies 🔨

* ⬆ Bump requests from 2.28.1 to 2.28.2 by dependabot in https://github.com/yezz123/fastapi-class/pull/62
* ⬆ Bump pytest from 7.2.0 to 7.2.1 by dependabot in https://github.com/yezz123/fastapi-class/pull/63
* ⬆ Bump pre-commit from 2.21.0 to 3.0.0 by dependabot in https://github.com/yezz123/fastapi-class/pull/64
* ⬆ Bump pre-commit from 3.0.0 to 3.0.1 by dependabot in https://github.com/yezz123/fastapi-class/pull/65
* ⬆ Bump pre-commit from 3.1.1 to 3.2.0 by dependabot in https://github.com/yezz123/fastapi-class/pull/85
* ⬆ Update fastapi requirement from <0.95.0,>=0.65.2 to >=0.65.2,<0.96.0 by dependabot in https://github.com/yezz123/fastapi-class/pull/86
* ⬆ Bump pytest-asyncio from 0.20.3 to 0.21.0 by dependabot in https://github.com/yezz123/fastapi-class/pull/87
* ⬆ Bump pypa/gh-action-pypi-publish from 1.7.1 to 1.8.1 by dependabot in https://github.com/yezz123/fastapi-class/pull/88


**Full Changelog**: https://github.com/yezz123/fastapi-class/compare/2.0.0...3.1.0

Page 1 of 2

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.