@@ -9,7 +9,7 @@ This research aims to evaluate these benefits and outline the key aspects of a p
99
1010## [ FastAPI] ( https://fastapi.tiangolo.com/ )
1111
12- ### Advantages:
12+ ### Advantages
1313
1414- automatic documentation: OpenAPI, Swagger
1515- data validation, type hints: Python’s type annotations and [ Pydantic] ( https://docs.pydantic.dev/latest/ ) for data validation
@@ -19,6 +19,14 @@ This research aims to evaluate these benefits and outline the key aspects of a p
1919- good ecosystem, community
2020- async support
2121- performance
22+ - filtering, searching, pagination should be more easier to do
23+
24+ ### Disadvantages (from our architecture discussion)
25+
26+ - frequent updates, maintenance overhead
27+ - Pydantic v2 Rust dependency: Pydantic v2 requires a Rust toolchain, which can be difficult to manage
28+ on LTS-based distributions. Since we use Fedora-based images in OpenShift and can also pin dependencies,
29+ this is unlikely to be a major blocker.
2230
2331### Considerations
2432
@@ -44,12 +52,12 @@ This research aims to evaluate these benefits and outline the key aspects of a p
4452
4553### Implementing models
4654
47- This is not strictly required (for the GET requests) but significantly improves the migration's value and is highly recommended.
48-
49- Previous attempt to document the endpoints with Flask:
50-
51- - https://github.com/packit/packit-service/pull/2089/files
52- - the biggest issues: lot of duplication and additional code, change in serialization
55+ - this is not strictly required (for the GET requests) but significantly improves the migration's value and is highly recommended.
56+ - it would be also our primary reason for migration:
57+ - could be fixed in Flask, but the effort would be similar to a full migration
58+ - previous attempt to document the endpoints with Flask:
59+ - https://github.com/packit/packit-service/pull/2089/files
60+ - the biggest issues: lot of duplication and additional code, change in serialization
5361
5462#### Using Pydantic with our existing models
5563
@@ -101,11 +109,10 @@ class User(SQLModel, table=True):
101109
102110### Gradual rewrite
103111
104- - run Flask and FastAPI together
105- - pick a few endpoints (e.g. file by file) and migrate
106- - redirect traffic to FastAPI for migrated endpoints
107- - repeat until everything is in FastAPI
108- - remove Flask completely
112+ - keep existing Flask endpoints and introduce FastAPI under e.g. ` /api/v1/ `
113+ - migrate endpoints gradually (e.g., file by file) to FastAPI
114+ - update code to use the new endpoints
115+ - once all critical endpoints are migrated, remove Flask entirely
109116
110117- smaller risk of breaking something
111118- work could be paralelised
0 commit comments