Live data from Hacker News

Reloadr – Hot code reloading tool for Python

github.com

41–50 of 58 posts

Re: Reloadr – Hot code reloading tool for Python

#41
post #25

For reloading from within the repl from importlib import reload as r Then in the ipython shell you can type r(module) to reload the entire thing. So I'll often have the editor in one terminal window, and ipython in the other one, save the code and switch back the repl, and type r(t) import mymodule as t Now tie in some ipdb [1] and you have a pretty sweet setup. Also depending on your serving framework it might also…

Why not just use ipython's built-in autoreload? https://ipython.readthedocs.io/en/stable/config/extensions/a...

Re: Reloadr – Hot code reloading tool for Python

#42

That's a bit awkward, I'm currently working on a package[1] that does more or less the same thing in more or less the same way (I think), except you don't need to decorate anything. Just run `python -m jurigged script.py` or `jurigged script.py` instead of `python script.py` and it will watch everything in the current working directory. There's still some bugs I have to iron out, though, it should be better in a mont…

Have you looked at `hupper` from the Pylons Project?

The author posted here: https://news.ycombinator.com/item?id=26039366

Re: Reloadr – Hot code reloading tool for Python

#43

That's a bit awkward, I'm currently working on a package[1] that does more or less the same thing in more or less the same way (I think), except you don't need to decorate anything. Just run `python -m jurigged script.py` or `jurigged script.py` instead of `python script.py` and it will watch everything in the current working directory. There's still some bugs I have to iron out, though, it should be better in a mont…

Have you looked at `hupper` from the Pylons Project? The author posted here: https://news.ycombinator.com/item?id=26039366

Seems fairly different. My tool does not restart the process, it hot patches functions and methods whenever they are modified in the source, like the OP.

Re: Reloadr – Hot code reloading tool for Python

#44
post #9

Earlier quoted context omitted.

Have you tried PHP? :) I jest, but really I feel like we've made things so complicated it just gets in our way. Our Javascript pipeline is huge, complicated, and requires you to sit down and wrap your head around it every time you want to modify it. If I get to greenfield another project, it's going to be so bloody simple.

PHP has to bootstrap everything on every single request. It is definitely great for reloadability and local development but terrible for production performance. Most teams that do not need PHP or love it (Laravel is great I know) have moved to using languages and frameworks that provide a long running application server.

PHP isn't that bad for production performance, if you have the right mindset.

Another way of saying PHP has to bootstrap everything on each request (which is a bit of an overreach; it doesn't reload C libraries, and you can do opcode caching and data caching, etc), is that PHP throws away everything you've done after each request.

That means everything that you build that isn't output somewhere is garbage.

If you spend a lot of time making a sculpture out of garbage, only to throw it away, you'll have poor performance. If you use the minimum of scaffolding to send out the bytes you want to send, you can get pages (or api responses, whatever) with a few ms of overhead in addition to your underlying data fetches. You could certainly go faster with something else, but PHP can be decently fast.

On the other hand, your code won't look at all like what people think of as 'modern' PHP.

Re: Reloadr – Hot code reloading tool for Python

#46
I am developing my own reloader in spirit of jrebel and how hotswapping works in javascript bundlers.

While investigating the topic I found a lot of projects: - https://github.com/yiblet/inquest - https://github.com/mpolney/hotpatch - https://pypi.org/project/patchy/ - https://pypi.org/project/plone.reload/ - http://svn.python.org/projects/sandbox/trunk/xreload/ - https://pypi.org/project/hot_reload/ - https://pypi.org/project/Reloadr/ - https://pypi.org/project/hotswap/ - https://pypi.org/project/reloading/ - https://pypi.org/project/hotreload/ - https://pypi.org/project/livereload/ - https://pypi.org/project/reimport/ - https://pypi.org/project/livecoding/ - https://pypi.org/project/pylivecoding/ - https://pypi.org/project/nameko-hot-reload/ - https://github.com/albertz/PythonHotswap - https://github.com/mikr/pyqtboiler/blob/master/baseapp/utils... - https://github.com/narfdotpl/hottie with decorator - https://github.com/ipython/ipython/blob/f8c9ea7db42d9830f163... - https://github.com/breuleux/jurigged

I thing that xreload from Guido and the code inside ipython both provide the best hot-patching. But both projects miss the feature to watch for changed files.

Re: Reloadr – Hot code reloading tool for Python

#49
post #9

Earlier quoted context omitted.

Have you tried PHP? :) I jest, but really I feel like we've made things so complicated it just gets in our way. Our Javascript pipeline is huge, complicated, and requires you to sit down and wrap your head around it every time you want to modify it. If I get to greenfield another project, it's going to be so bloody simple.

PHP has to bootstrap everything on every single request. It is definitely great for reloadability and local development but terrible for production performance. Most teams that do not need PHP or love it (Laravel is great I know) have moved to using languages and frameworks that provide a long running application server.

I'm really sorry to say this but you're spreading FUD

1. slack backend is written in php and other big companies. 2. php is actually faster than python/ruby 3. opcache in production (which is both simple to activate AND a well-known best practices among people doing php professionally) eliminate the performance hit you will get. 4. your backend language performance is often far from being the bottleneck in most endpoint where performance do matters , it's often either a database optimization problem, an algorithm problem or a really CPU intensive tasks that you will offload to a dedicated library written in C.

I perfectly understand PHP does have a lot of flaws, but production performance is not one.

Re: Reloadr – Hot code reloading tool for Python

#50
post #9

Having a hot reloaded set up for both my django (It's built in) environment and Web app environment is such a force multiplier. It's not about simply saving time doing it manually. It fundamentally changes my dev-test/experiment workflow. I love being able to tab to a server file, make a change, tab to a client file, make another change, and instantly test it in a browser.

Have you tried PHP? :) I jest, but really I feel like we've made things so complicated it just gets in our way. Our Javascript pipeline is huge, complicated, and requires you to sit down and wrap your head around it every time you want to modify it. If I get to greenfield another project, it's going to be so bloody simple.

I feel you, I have currently the chance to start a greendfield project,

  * backend in php8 with symfony framework
  * postgres
  * frontend is only html+tailwind css and 2 lines of javascript here and there for a smooth transition effect (https://christopheraue.net/design/fading-pages-on-load-and-unload) 
and I just got my PWA accepted by google store , and my 18 lines react-native app embedding the website in a page view for apple store is in review.

no javascript madness, and the app is so snappy that everybody ask me which kind of react optimization i'm using : "the one where you remove it completly"

Post reply on HN