How the hell does FastAPI's module system work? #8900
-
|
Ok, so, I'll make this super easy to understand: please, please, PLEASE review FastAPI's documentation, because it feels like reading a children's book. I honestly feel like I'm reading something aimed towards mentally challenged people and every time I open up the documentation to find a solution to something my brain is like "can you just get to the damn point?". I've been developing software for over 6 years and I don't need nor want an explanation of what a coroutine is, how dependency injection works or what HTTP is. Frankly I'm puzzled as to why a framework aimed at developers who should supposedly know what they're doing includes all of this kindergarten-level stuff. Now, to get to my question: How the hell do I make my FastAPI application modular? I have over 3500 lines of code I need to split into several modules and the docs on the topic are just retarded, sorry there's no other way to put it. I get the "but it's friendly to beginners!" thing, but this is beyond ridiculous |
Beta Was this translation helpful? Give feedback.
Replies: 14 comments
-
|
@nocturn9x That tone is not appreciated in this community. That's not how you ask for help or give feedback. |
Beta Was this translation helpful? Give feedback.
-
|
@nocturn9x Now that it's pretty clear to me that you don't like the style of the documentation, we still do not know what exact problem you are facing with splitting your code up into modules. |
Beta Was this translation helpful? Give feedback.
-
|
@chbndrhnns The problem is quite simple, the solution probably is too but the documentation does its best to dilute it into a bag of nonsense most experienced developers do not care about. I don't have a specific problem because I couldn't even figure out how use the |
Beta Was this translation helpful? Give feedback.
-
@Kludex Sorry for my tone, but I need this framework to write actual production software and not toys like the docs seem to suggest, and the way that whole website is laid out makes me go nuts |
Beta Was this translation helpful? Give feedback.
-
|
@nocturn9x If you want an example of a real app, you could look here in the source code . Regarding the docs, I think are perfect, cause everyone has a different background, and also I think that this is a framework made for everyone not only for experts. If you don't like them, you could rewrite them and open a pull request to share with the community |
Beta Was this translation helpful? Give feedback.
-
|
I, for one, really appreciate the support for beginners and the welcoming
and inclusive response to issues.
…On Tue, Jun 15, 2021 at 10:56 AM Angelo Cutaia ***@***.***> wrote:
@nocturn9x <https://github.com/nocturn9x> If you want an example of a
real app, you could look here in the source code
<https://github.com/nsidnev/fastapi-realworld-example-app>. Regarding the
docs, I think are perfect, cause everyone has a different background, and
also I think that this is a framework made for everyone not only for
experts. If you don't like them, you could rewrite them and open a pull
request to share with the community
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#3375 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABB4YOMWY4U2LWF2PFKYB3TS5S3DANCNFSM46XHJUYQ>
.
|
Beta Was this translation helpful? Give feedback.
-
|
Even after the intro was rewritten (and the tone is a lot nicer) it doesn't show what the actual problem is: This could off course just be lost somewhere in the rant about the docs. We (SURF) manage a couple of large codebases with FastAPI and all the normal python module stuff just works. There are several layers you can use the make a very modular app. Splitting models, api routes, frequently used business logic etc. I did some work on a boilerplate (it's not finished yet) that shows how you could split code in a DB heavy app: https://github.com/acidjunk/fastapi-postgres-boilerplate But that being said; I also manage quite some apps that don't even use a DB: so I think making it modular is something that you determine on a per project basis. FastAPI isn't as opinionated as Django in that sense. |
Beta Was this translation helpful? Give feedback.
-
|
There is a WHOLE PAGE dedicated to modularity and how to structure a FastAPI app: https://fastapi.tiangolo.com/tutorial/bigger-applications It's crystal clear how to split your app in several routers and how to include them in your main app. |
Beta Was this translation helpful? Give feedback.
-
One of good skills of experienced programmers is ability to filter out the junk in a tutorial and find the parts they require. Say scrolling through a tutorial for AWS deployment. I do not care about creation of my profile or the basic app they deploy on it. I already did that, but for example on a front-end CSS tutorial every single sentence is important because I don't know anything about css. |
Beta Was this translation helpful? Give feedback.
-
|
Such a grumpy request doesn't deserve any kind of effort put into good answers, like those you got already. There should be nothing more said, but a big thank you by you, to those nice people. |
Beta Was this translation helpful? Give feedback.
-
|
I really appreciate how the documentation was written, one of the many reason why i started using it |
Beta Was this translation helpful? Give feedback.
-
|
I completely agree with @dithmer. I wouldn't expect anyone to reply to such grumpy request. Documentation is absolutely fantastic and as an experienced engineer one should be able to filter out anything not important or not required at the time and focus on what you need. |
Beta Was this translation helpful? Give feedback.
-
|
Hi there, totally agreed with FastAPI supporters / contributors, specially author of this framework. I actually appreciate FastAPI community because their docs is pretty cool and easy getting started. Deployment ? yes, they have it also. And the author also give us his projects skeleton if you do read the docs thoroughly And if you really need some projects out there, check this out. For me, Flask docs is really poor. i don't mean to criticize. This is my opinion for the old Flask versions, recently its released new version, still didnt have time to check it out. How about Django? Their docs is really big and hard to getting started for beginners to understand its features completely. But these are my opinions. Actually when you want to understand a new thing completely, just go to their source code and read it. You may learn something new, cool and blow your mind. Or you can contribute for community. |
Beta Was this translation helpful? Give feedback.
-
|
@nocturn9x, the documentation isn't supposed to serve the expert developers, but also more beginner ones. With that said, there are more advanced topics, and, as stated by @frankie567, there's a page on the modularity of bigger applications:
Does this resolve your issue? 🤔 I believe restructuring the whole documentation is an effort out of question, especially if it means making it more complex for more novice developers. |
Beta Was this translation helpful? Give feedback.
There is a WHOLE PAGE dedicated to modularity and how to structure a FastAPI app: https://fastapi.tiangolo.com/tutorial/bigger-applications
It's crystal clear how to split your app in several routers and how to include them in your main app.