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

Switching to FastAPI instead of flask ? #1

Open
tlunet opened this issue Nov 6, 2023 · 2 comments
Open

Switching to FastAPI instead of flask ? #1

tlunet opened this issue Nov 6, 2023 · 2 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@tlunet
Copy link
Member

tlunet commented Nov 6, 2023

After looking a bit in the API to solve some issues (e.g problem getting files from the doc repository), I wonder if maybe it could be interesting to switch to FastAPI instead of flask :

  • FastAPI was developed especially with the focus on solving some know issues of previous existing tools, and was inspired rom them too to keep their best aspect (simplicity, speed, ... see alternatives and historical nodes).
  • it simplifies the usage and development by providing many tools under the hood (starlette, requests, support for file requests, ...).

In particular, it allows the automated creation of API pages since it does not requires unique names for the routes functions => the app can look at some documentation in a doc folder with some unspecified tree architecture, and create each routes depending on the tree path just like this

for ... in glob.glob('doc/**'):
      
      @app.route('.....')
      def _():
            return htmlPage(....)

This would give use more flexibility for the generation part of the website. There is also some easy-to-use tools to return files (e.g for images) that could also be used like this, allowing to use the markdown structure on the github repository and simply translate it to the website ...

What do you think @MichelKrispin ?
What's your thoughts

@tlunet tlunet added enhancement New feature or request question Further information is requested labels Nov 6, 2023
@MichelKrispin
Copy link
Collaborator

I've only had a quick glance at FastAPI but it looks very nice and has some nice functionality out of the box. I'm not really that much into Flask, it just did the job and that quite transparently, so I think if FastAPI is way easier to use, it might be a better fit for this project.

The problem of a complete switch is that it probably takes a while, especially for me as I have never worked with FastAPI before, and right now the groundwork stands and (mostly) works. Now, if there is a separate branch that focuses exclusively on switching and tries to get it to the same level of functionality as there is currently, I'm completely fine with that. But overall, I think it's faster to implement smaller new functionality with the current basis than to switch to FastAPI completely and then implement new features.

For using the markdown structure of GitHub, I think that the fastest solution would be to copy (and maybe even rename) the files with a script on deployment into separate folders.
(Thinking a little bit about the code example, exactly that should also work in flask, but maybe I never thought of using it for this project.)

Still, if the goal is to mimic the structure of a github repository and FastAPI offers functionality for that out of the box, then in the long run a switch might be worth the trouble.

@tlunet
Copy link
Member Author

tlunet commented Nov 11, 2023

Ok thanks for looking into it. From your comments, I guess that it may be worth it that I take some time to make the switch in the next week then, when I find some time for it 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants