Our great sponsors
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
-
ipython
Official repository for IPython itself. Other repos in the IPython organization contain things like the website, documentation builds, etc.
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
-
inquest
Discontinued Inquest lets you add log statements to python without restarting your python instance. It helps you quickly uncover what is going wrong.
`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 month or so. Still, you can pip install it if you want.
[1] https://github.com/breuleux/jurigged
Ha, I'm just working on integrating the `pydev.debugger` code reloading into `debugpy` (so that the code reloading from the PyDev debugger will be available for Python-VSCode debugger users too).
The in-memory reloading (which may be seen at: https://github.com/fabioz/PyDev.Debugger/blob/main/_pydevd_b...) unfortunately doesn't work all the time (fixing the references at runtime in Python is difficult), but it works well enough for the cases where you have a simple function and change it (that file does explain some of the issues that the reloading faces).
One major issue is that after doing the reload, you need to get out of the function and then back into it to see the difference -- so, if you're stopped in the function in a breakpoint, it's not possible to simply drop the function and restart it as Python itself doesn't support that... maybe that's a good idea for a PEP ;)
Anyways, when it works, it's pretty nice in that you don't have to restart your whole debug session to see changes (the other approach, which webservers use in general is just restart the whole process, so, for instance, Django has an initial process just monitoring for changes and a 2nd process which is actually serving requests which is restarted when something changes -- not as good if you have a heavy startup or are working with something where you have to click through multiple things to get to the state which you want).
Now tie in some ipdb [1] and you have a pretty sweet setup. Also depending on your serving framework it might also have hot reloading as well, tornado, flask, etc.
[1]https://github.com/gotcha/ipdb
[2] https://www.tornadoweb.org/en/stable/autoreload.html https://werkzeug.palletsprojects.com/en/0.14.x/serving/
There is https://github.com/RuntimeCompiledCPlusPlus/RuntimeCompiledC...
The idea is to use virtual functions, and recompile new classes into a shared library. The shared lib is linked into the running program, and old instances of the classes are deleted and replaced by new instances constructed from the share library.
I am working on a library using the same (stolen) idea here:
https://github.com/jheruty/hscpp
Proof of concept demo:
https://m.youtube.com/watch?v=pjGngeKgni8
hscpp is still very alpha, and I’m sure I’ll find lots of bugs as I work on a “real” demo. In contrast, Runtime Compiled C++ is quite mature and is used in real game projects.
Note that this approach very much limits your architecture. For example, you won’t be able to use statics, as the newly compiled shared libraries won’t see them.
It’s a finicky thing, worth it to me, but not something you can just plop in to an established project.
- https://github.com/albertz/PythonHotswap
- https://github.com/ipython/ipython/blob/f8c9ea7db42d9830f163...
- https://github.com/mikr/pyqtboiler/blob/master/baseapp/utils...
- https://github.com/mpolney/hotpatch
- https://github.com/narfdotpl/hottie with decorator
- https://github.com/yiblet/inquest
Write a similar thing [1] which can also reload functions from source before every execution but also load loop bodies from source before each iteration. Can be helpful for long running loops like when downloading or training deep learning models.
[1] https://github.com/julvo/reloading
In Julia, this can be done with even less efforts on the user-side by loading Revise (https://github.com/timholy/Revise.jl) before any other package you load.