-
-
Notifications
You must be signed in to change notification settings - Fork 260
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
feat: support for structured scaffold in create command #970
base: main
Are you sure you want to change the base?
feat: support for structured scaffold in create command #970
Conversation
for more information, see https://pre-commit.ci
@pre-commit-ci[bot] is attempting to deploy a commit to the sparckles Team on Vercel. A member of the Team first needs to authorize it. |
CodSpeed Performance ReportMerging #970 will not alter performanceComparing Summary
|
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
level = WARN | ||
handlers = console | ||
qualname = | ||
|
||
[logger_sqlalchemy] | ||
level = WARN | ||
handlers = | ||
qualname = sqlalchemy.engine | ||
|
||
[logger_alembic] | ||
level = INFO | ||
handlers = | ||
qualname = alembic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do the empty assignments mean here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are alembic defaults, generated with alemic init migrations
The reason I chose to pre-run this and not leave it to users is so that we can make `migrations/env.py' changes to make is usable right away
Also, to standardize migrations directory structure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ashupednekar , since alembic is not a tool where I have direct experience. Could you add a readme?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I add it in the scaffold, or should I add more docs ?
I've added what's needed to get started under example_app/index.mdx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, added readme
# are written from script.py.mako | ||
# output_encoding = utf-8 | ||
|
||
sqlalchemy.url = driver://user:pass@localhost/dbname |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let us leave a comment, which says that you need to update it accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Also, there was a bug in the online migrations function in alembic/env.py
in structured sqlalchemy scaffold. Fixed, and added docs in example_app/index.mdx
for database migration steps as well
COPY . . | ||
RUN pip install --no-cache-dir --upgrade -r requirements.txt --target=/workspace/deps | ||
|
||
FROM gcr.io/distroless/python3-debian11 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you explain this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the --target
flag tells pip to place the site packages at the specified path, we then copy this in the second stage and set PYTHONPATH
accordingly
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Hi, Multiple SubRoutes.For example, if we take the crimes example as one subrouter within a Gotham application. If we look at the web based Gotham application we might have multiple subrouters eg crime, finance, planning, licenses, housing where do these go in the scaffold directory structure? Are they: \no-db\api\handlers\crime.py Template and Static filesWhere do the Jinja templates go? For both templates and static files I'm assuming that there will be some that are shared right across Gotham and some that are specific to crime or finance ... Thanks |
Yes, each handler.py would be a collection of routes in a sub route, akin to viewsets in DRF |
@sansyrox any updates/suggestions ? |
Thanks for the nudge @ashupednekar 😄 I will complete the review by tomorrow eve! @dave42w , do you have any more suggestions/feedback? |
I don't have anything yet as I haven't built a large app yet in Robyn. I've found this article interesting and it covers a few things the scaffold doesn't. https://dev.nando.audio/2014/04/01/large_apps_with_sqlalchemy__architecture.html I also suspect that using an event queue will be a key part of larger apps rather than a big transition (eg in an ordering process) As the scaffolding is described as opinionated whether it might be possible to support plugging in different opinions eg if a corporate has a standard they already use and want robyn to support. |
Although I think we do need to get the CI builds sorted before we merge anything |
07f28de
to
0b766c9
Compare
Description
This PR fixes #969
Summary
PR: Add Structured Scaffold Option to Robyn's Create Command
Description:
This PR introduces a new feature to Robyn's
create
command, allowing users to choose between two scaffold options:Changes:
create
command to prompt users with a new option:Would you like the scaffold to be a simple starter kit or an opinionated structure?
api/handlers
(for route handlers)middlewares
(for middleware definitions)adaptors
(withmodels
,selectors
,mutators
)utils
(helper functions likedb.py
)devops
(including Dockerfile, docker-compose)conf.py
,config.env
).Example Structured Scaffold:
PR Checklist
Please ensure that:
Pre-Commit Instructions: