Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

As a dev, I want to explore alternative web frameworks to Flask for improved performance and developer experience #145

Closed
k-allagbe opened this issue Sep 20, 2024 · 7 comments · Fixed by #144
Assignees
Labels
enhancement New feature or request

Comments

@k-allagbe
Copy link
Member

Description

Context
Currently, we use Flask to build our APIs. While Flask has been sufficient, it is synchronous and lacks some modern features like built-in asynchronous support and automatic API documentation (OpenAPI/Swagger). There are other open-source frameworks that could better suit our needs by offering enhanced developer experience and feature sets. We are considering alternatives like FastAPI, Quart, and others that meet our criteria, but only open-source solutions will be considered.

Problem Statement
Flask’s synchronous nature and lack of modern tooling (like automatic async support and Swagger generation) requires extra effort from developers. Evaluating other open-source frameworks that offer these features could improve the developer experience, streamline API development, and potentially enhance performance. While Django is excluded for being too heavyweight and opinionated for our use case, there may be other alternatives beyond FastAPI and Quart worth exploring.

Acceptance Criteria

  • Research and compare various open-source web frameworks (including but not limited to FastAPI and Quart) with respect to developer experience, feature set, ease of use, and scalability.
  • Evaluate async capabilities, API documentation support (OpenAPI/Swagger), and community support.
  • Document potential migration challenges from Flask to any alternative framework.
  • Provide a well-reasoned recommendation, outlining the pros and cons of each alternative, and the potential benefits to the team.

Additional Information

@k-allagbe k-allagbe added the enhancement New feature or request label Sep 20, 2024
@snakedye
Copy link
Contributor

@k-allagbe
Copy link
Member Author

I suggest moving the comparison into this repository instead of making it an ADR.

@snakedye
Copy link
Contributor

snakedye commented Oct 4, 2024

@k-allagbe
So far I'm stuck at the tests. It's good that the requests are typed but the types in each fields are hard to find.
With more work I could find them and have something more robust and idiomatic but rn I jsut use the header.

I see a lot of good API wise but it definitely requires some work to mimic what we have in Flask. It's definitely an extra burden on the team and a new set of skills and knowledge. I don't think we can ask nachet to migrate to it.

@k-allagbe
Copy link
Member Author

The objective was definitely not to impact nachet.

It's definitely an extra burden on the team and a new set of skills and knowledge.

Evidently. Different tools. Please report that in the doc. I will take a crack at it too see if we can come up with something not too far from familiarity.

@snakedye
Copy link
Contributor

snakedye commented Oct 7, 2024

So far with the Quart port, the API isn't that much different with the exception of anything related to authorization. flask_httpauth has a Quart equivalent but it doesn't appear to be as well maintained so I went with quart_auth.
The main issue with it is that it doesn't really follow the same flow, even with Basic auth, as what we currently use. It's not necessarily a problem considering ai-cfia/fertiscan-backend#163 but just some food for thought.

Also whether or not we go with FastAPI or Quart, the connection manager will need to be refactored as it's not compatible with async.

@k-allagbe
Copy link
Member Author

Moving this to dev-rel-docs.

@k-allagbe k-allagbe transferred this issue from ai-cfia/fertiscan-backend Oct 28, 2024
@k-allagbe k-allagbe linked a pull request Oct 28, 2024 that will close this issue
@k-allagbe
Copy link
Member Author

Closing this as done.

@github-project-automation github-project-automation bot moved this from In review to Done in FertiScan Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants