> Fastapi is far from world class in any category other than usage.
Imho FastAPI's weakest point is maintenance. The Github repo has 800+ open issues and 400+ open PRs. Tiangolo is the only user that constantly makes non trivial contributions. I just can't see that being sustainable in the long term if all those items are not actively triaged.
OP asked for good projects to read. I think the code quality is very high, the documentation is great, it's been a joy to use, and it's been more than fast enough for my purposes.
I didn't make that speed claim, though I am aware that tidbit is controversial.
My favorite way to find good projects to explore is using GitHub.com. I go to explore page and checkout trending projects for the week/today. https://github.com/trending/python?since=daily
at the end of module files? Never seen that, why is it used? I understand that it's a guard that only runs when the module is executed directly, but what is the code put there? For developers to quickly visually test stuff by running the module?
It's a common pattern as others have said, but this specific version of it is poor practice. The code should be in a function instead of polluting the global namespace (otherwise 'console', 'table', and 'color' end up being shadowed if they're used elsewhere in the file). Keep it clean with e.g.:
def main() -> None:
pass
if __name__ == "__main__":
main()
I think, in general, most FastAPI and Pydantic related libraries are heavily typed, use poetry, GitHub pipelines, black, isort, flake8 etc. so if you want to look at the ecosystem around a package I’ll recommend a few here, that has a smaller scope than the huge libraries Pydantic/FastAPI are. All packages listed below has all these things.
FastAPI-Azure-Auth [0] is a library to do authentication and authorization through Azure AD using tokens.
ASGI—Correlation-ID[1] is a package that utilizes contextvars to store information through the asyncio stack, in order to attach correlation/request ID to every log message from a request. Django-GUID [2] does the same for both sync and async Django.
Pydantic-factories [3] is an awesome library to mock data for your pydantic models.
Gonna hijack and ask for some Django projects with a lot of forms, especially nested forms with a lot of relationships. I’d be curious to learn from other folks how to do forms, how the views work (update vs create), etc.
I've been working with Django since version 0.96. Still a lot of love for it, but for the last several years it's not my default for new projects though. The Django codebase is far from what can be called modern. As an experiment, it's easy to open up some Django core modules side by side with other frameworks that were mentioned (FastAPI for one) and to see that the code looks so different to the point where a programmer with not a lot of experience with Python might think those are different languages altogether.
Much of Django's core has not changed in a very long time, so there would be no type annotations and other modern Python constructs.
FastAPI, pydantic, uvicorn, httpx would be in my list to answer OPs question.
> the code looks so different to the point where a programmer with not a lot of experience with Python might think those are different languages altogether
Some of us actually prefer the "old" style of Python. Type annotations are too "Java-ish" for me, I hate source code that declares a function with signature takes more than half of the screen space, I hate making http requests with three layers of nested `async with`. If you are into static typing or RAII why not choose a real deal language instead.
Probably read something that is related to your project. My moment of enlightenment was reading SymPy code. It was well explained and documented. Reading the code answered so many questions that you couldn’t get an answer on SO.
World class stuff.
https://github.com/tiangolo
https://github.com/samuelcolvin/pydantic
https://github.com/encode
>Fast: Very high performance, on par with NodeJS and Go.
Is a downright lie
Imho FastAPI's weakest point is maintenance. The Github repo has 800+ open issues and 400+ open PRs. Tiangolo is the only user that constantly makes non trivial contributions. I just can't see that being sustainable in the long term if all those items are not actively triaged.
I didn't make that speed claim, though I am aware that tidbit is controversial.
I found Will’s codebase easy to read and reason about, making it easy to help extend.
Here, for example https://github.com/willmcgugan/rich/blob/master/rich/color.p...
You can run some examples using the -m flag + the submodule:
https://rich.readthedocs.io/en/stable/live.htmlhttps://rich.readthedocs.io/en/stable/markdown.htmlFastAPI-Azure-Auth [0] is a library to do authentication and authorization through Azure AD using tokens.
ASGI—Correlation-ID[1] is a package that utilizes contextvars to store information through the asyncio stack, in order to attach correlation/request ID to every log message from a request. Django-GUID [2] does the same for both sync and async Django.
Pydantic-factories [3] is an awesome library to mock data for your pydantic models.
[0] https://github.com/Intility/fastapi-azure-auth
[1] https://github.com/snok/asgi-correlation-id
[2] https://github.com/snok/django-guid
[3] https://github.com/Goldziher/pydantic-factories
https://github.com/netbox-community/netbox
Really, django is the framework to read if you are into Python.
Much of Django's core has not changed in a very long time, so there would be no type annotations and other modern Python constructs.
FastAPI, pydantic, uvicorn, httpx would be in my list to answer OPs question.
Some of us actually prefer the "old" style of Python. Type annotations are too "Java-ish" for me, I hate source code that declares a function with signature takes more than half of the screen space, I hate making http requests with three layers of nested `async with`. If you are into static typing or RAII why not choose a real deal language instead.