-
-
Notifications
You must be signed in to change notification settings - Fork 959
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
Help users with new project layout #705
Comments
FWIW I do think that we want to help guide users down the happy path here. I'm not sure how much of that responsibility lives with the starlette package itself, and how much should be documentation etc. Also there's probably valid use cases for both single-file and multi-file layouts, so we might want to have templates for both cases? |
I'm a big fan of the cookiecutter approach popular with a lot of Django veterans. That would, of course, live another place (or places). That "external" aside, a factory recommended "semi-manual" project layout via tutorial and/or sample project with best practice routes, settings, handlers, etc. would really help adoption by users from other platforms, especially Django. Django little blog tutorial is "just right" for newbs and is a meaningful part of its success. $.02 |
@tomchristie and @rmorison not to be self-serving, but I started a cookiecutter a few weeks ago for starlette: https://github.com/raiderrobert/cookiecutter-starlette So I'm of the strong opinion that you let my or other cookiecutters sort of figure out best practices for a while. Later on if there's still strong demand for |
I'm a fan of "your project layout should tell something about the domain of your app" (I think Robert Martin said that) which in turns I take it means different projects needs different layouts and, in my opinion, shouldn't be Starlette responsibility to provide one. The code to quickly have something running is less than 10 lines long and that includes uvicorn import and run. Due to the low-level nature of Starlette I, also, have a hard time to see what a |
While I agree with a The |
I agree with @mbeacom. I think a |
For us, Starlette is the quintessential async web toolkit just like encode/databases. The fact that frameworks are being built over Starlette(like FastAPI, Responder, etc) proves it. I hope it becomes the Python equivalent of go-kit or spring boot. So the question whether project layout falls under the scope of Starlette depends on the future path that the maintainers wish to take i.e toolkit vs framework approach. Whatever it is, I hope the decision is taken before v1.0 If its a framework, then it makes sense to dictate the project layout and other conventions. Else it is best left to the community to figure out the best way to utilize starlette for their usecase. |
All frameworks go through this crisis of scope - especially the starter vs complex ...and dictate vs assist conundrum. I think these tweets by Dan Abramov (creator of React) is very interesting in that context. "React is harder, because it cares". I think it sums up the most important variable - care for for the end user. |
The Phoenix framework has a very good directory layout: It separates web application part (web dir) from the application (lib dir). |
ember-cli also has a top-notch project layout/template https://ember-cli.com/ |
Closing this as out of scope right now. |
@tomchristie now that we have evidence... every single framework ships with a scaffolding CLI! Can we open this ticket up? Happy to work on it ... I am in the process of migrating from FastAPI to Starlette... The documentation is very limited... I could create a CLI that allows users to select what features they want, like lifespan, webhooks, background tasks, middleware, routes, etc... and create a layout with generic examples??? ... There needs to be something out for people to use and give feedback on, to give direction on the kind of features that will be useful ??? |
Opening for discussion. I may close it. What functionalities should it have? |
After years, I made an opinion that Starlette needs a higher-level framework that can incorporate layout as a feature. I can't see any valuable layout for vanilla Starlette. Because it would just include few files: |
Should we think about a CLI that you can add plugins and then make it easier for higher-level frameworks?
Those are random thoughts. |
Yes, this is a cool solution, I use this approach. It can be a separate package like |
Or maybe a What commands would be there by default? |
Probably none. Starlette is very low level, so any command will make it opinionated. Some plugins could be official-like (eg. a simple scaffold project), and some more advanced (like boilerplates with tons of features). The closest thing I see is Flask CLI. This is an output from
|
Pulling this issue out from a seperate thread here... #704 (comment)
How do we best guide users around project layouts?
starlette init
.The text was updated successfully, but these errors were encountered: