-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(python): bump main project dependencies (#1728)
bumps main projection dependencies: - `pydantic` from 1.9 to 2.8: huge breaking change but with large performance benefits expected on serialization - `fastapi` from 0.73 to 0.110 - `uvicorn` from to 0.15 to 0.30 - `mypy` from 1.4 to 1.11 It also brings few changes inside dependencies - Drop `requests` in favor of `httpx` - Drop `fastapi-jwt-auth` as they do not and will not support pydantic v2. We've decided to fork their code and adapt it as it's really light (see new folder `/antarest/fastapi_jwt_auth`) These changes also induced other minor dependencies bump: `jinja2`, `typing_extensions`, `PyJWT`, `python-multipart` Last, this work includes fixes on the API prefix addition when running in standalone mode (desktop version). We now distinguish properties root_path (used when behind a proxy) and api_prefix (which actually makes our server add a prefix). Co-authored-by: belthlemar <[email protected]> Co-authored-by: Sylvain Leclerc <[email protected]>
- Loading branch information
Showing
204 changed files
with
3,415 additions
and
3,797 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Copyright (c) 2024, RTE (https://www.rte-france.com) | ||
# | ||
# See AUTHORS.txt | ||
# | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
# | ||
# SPDX-License-Identifier: MPL-2.0 | ||
# | ||
# This file is part of the Antares project. | ||
|
||
from dataclasses import dataclass | ||
from typing import Optional | ||
|
||
from fastapi import APIRouter, FastAPI | ||
|
||
|
||
@dataclass(frozen=True) | ||
class AppBuildContext: | ||
""" | ||
Base elements of the application, for use at construction time: | ||
- app: the actual fastapi application, where middlewares, exception handlers, etc. may be added | ||
- api_root: the route under which all API and WS endpoints must be registered | ||
API routes should not be added straight to app, but under api_root instead, | ||
so that they are correctly prefixed if needed (/api for standalone mode). | ||
Warning: the inclusion of api_root must happen AFTER all subroutes | ||
have been registered, hence the build method. | ||
""" | ||
|
||
app: FastAPI | ||
api_root: APIRouter | ||
|
||
def build(self) -> FastAPI: | ||
""" | ||
Finalizes the app construction by including the API route. | ||
Must be performed AFTER all subroutes have been added. | ||
""" | ||
self.app.include_router(self.api_root) | ||
return self.app | ||
|
||
|
||
def create_app_ctxt(app: FastAPI, api_root: Optional[APIRouter] = None) -> AppBuildContext: | ||
if not api_root: | ||
api_root = APIRouter() | ||
return AppBuildContext(app, api_root) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.