devopspp / pyliveupdate

A runtime python code manipulation framework for profiling, debugging and bugfixing
GNU General Public License v3.0
64 stars 10 forks source link

Who's using pyupdate? #1

Open EvonX opened 4 years ago

EvonX commented 4 years ago

Who's using pyupdate?

Thanks sincerely for constantly using and supporting this project. Please comment in this issue if you are using pyupdate!!

Format example:

gkapfham commented 2 years ago

Hello @EvonX I would be interested in using pyupdate. I noticed that the provided example does not show how to use the Instrument even though there is an example of Redefine. Could you please provide an example that shows how to use Instrument so that I can better evaluate the use of this project? Thanks!

EvonX commented 2 years ago

Hey @gkapfham, thanks for reaching out! Sure, here is an example for Instrument:

from pyliveupdate.update import Instrument, UpdateManager

def _line_after(a):
    print(a)

update = Instrument('__main__.bar', 
                    {('line_after', [12, 14]): _line_after})
UpdateManager.apply_update(update)

Basically, you need to instantiate Instrument to specify a customized instrumentation, and then use UpdateManager to apply it. To instantiate an Instrument, you need to provide scope, jointpoint and payload, etc. Detailed explanation can be found Here.

Hope this helps. Feel free to let me know if you have more questions.