Robyn icon indicating copy to clipboard operation
Robyn copied to clipboard

feat: live reloading when running as a module

Open VishnuSanal opened this issue 1 year ago • 13 comments

Description

This PR fixes #654

how to run: python3 -m app --dev

VishnuSanal avatar Jun 17 '24 14:06 VishnuSanal

@VishnuSanal is attempting to deploy a commit to the sparckles Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Jun 17 '24 14:06 vercel[bot]

CodSpeed Performance Report

Merging #858 will not alter performance

Comparing VishnuSanal:module-hot-reload (a7272e5) with main (1e33769)

Summary

✅ 109 untouched benchmarks

codspeed-hq[bot] avatar Jun 17 '24 14:06 codspeed-hq[bot]

Hey @VishnuSanal 👋

I am unable to understand the changes. Could you add an example on why we need the new parameters?

And how you'd invoke the changes?

sansyrox avatar Jun 17 '24 21:06 sansyrox

Hey @VishnuSanal 👋

I am unable to understand the changes. Could you add an example on why we need the new parameters?

And how you'd invoke the changes?

Hey @VishnuSanal , Could you please update the PR description with the above??

sansyrox avatar Jun 18 '24 10:06 sansyrox

uh, oh. my previous comment never got sent.

Could you add an example on why we need the new parameters?

I have changed the implementation, PTAL. removed the need for new params.

And how you'd invoke the changes?

running as a module usually, like python3 -m app --dev would do.

please CMIIW.

VishnuSanal avatar Jun 19 '24 07:06 VishnuSanal

@VishnuSanal , I just saw your description. That is not what we want to solve for 😄

We want to allow the dev mode to work like robyn -m src --dev. The robyn_app in description is src here

where src

src/
  - __init__.py
  - __main__.py

The --dev flag should rerender based on app changes.

sansyrox avatar Jun 19 '24 08:06 sansyrox

thank you for the review, Sanskar! this currently works as expected in my testing, PTAL & LMK what you think. :)

VishnuSanal avatar Jun 19 '24 13:06 VishnuSanal

Hey @VishnuSanal 👋

Thanks for the PR, I have some comments 😄

sansyrox avatar Jun 20 '24 18:06 sansyrox

Hey @VishnuSanal 👋

Thanks for the update. I have some follow up comments

sansyrox avatar Jun 21 '24 15:06 sansyrox

current issues:

  • [ ] doesn't work when using robyn -m src --dev. sys.argv[0] returns the path to the executable. but, from here, it seems like we shouldn't run it like it, but like python3 -m src --dev.
  • [ ] doesn't work during python3 app.py --dev (since path is not present in unknown_args in arguement_parser)
  • [x] doesn't work during robyn app.py --dev

(will edit & update this comment as I fix them...)

VishnuSanal avatar Jun 26 '24 07:06 VishnuSanal

note to self:

the flow of control is like: cli#run => cli#start_dev_server => reloader#setup_reloader => EventHandler#reload => Robyn#start and, we are getting the file object at the last stage. my current implementation starts a new dev server from there.

we need a way to bypass it the first time (inorder to reach robyn#start) and, then kill the previous reloader & start new one from there.

as of now, I am getting an infinite loop! will address. :)

VishnuSanal avatar Jul 03 '24 18:07 VishnuSanal

⚠️ Only 5 files will be analyzed due to processing limits.

recurseml[bot] avatar May 27 '25 19:05 recurseml[bot]

😱 Found 3 issues. Time to roll up your sleeves! 😱

recurseml[bot] avatar May 27 '25 19:05 recurseml[bot]