Advanced Debugging in PyCharm

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
the fun part about this is I'm seen seated between the two people that run the dang thing lisa has been the longtime showrunner for our debugger you're now focusing on our data science work what will you be talking about today yeah thank you Paul today I'm going to show you several useful tricks which can which you can use during debugging in PyCharm I don't be using a local project for that but all of these features except for project configuring can be used for remote cases as well and also I'm going to show several tips for working on data science tasks everything comes back to data science and Andre has a background in data science and now you're going to be picking up the debugger work so what are you going to be covered so today I'm going to show you how to use remote debugging for example how to debug your applications that is run on a remote server or insider docker container then we'll discuss a less known technique which is known as Python remote debugger on configuration and at the end of my section I'll give you a brief overview of how our Python debugger works since this is a question people ask quite often I guess everybody wants to know how to do the magic the Matt you can't tell people the magic that it's not magic anymore okay as I've already said today I'm going to use a local project configure it in pycharm today we're going to show a Tetris game created with arcade module it is a very useful Python library which allows you to create eric eight games with Python really quickly you can see you can find the source code of this project and my github and this link was posted to the chat also today we're going to use this Python 3.8 is the fresh release of Python it was released in October 2000 and 19 and if for example you haven't tried walrus a greater yet today you will have a chance to look at it right during our webinar and some other news today I'm going to use Jade bronze mono it's a new font which was released just a week ago it was created by Jade brain budget brains specially for developers so it was created for reading source code and here for example you can see that page of this course of this font at our side it's extremely beautiful it's very interesting and I strongly recommend you to look at it if you wanna have time so let's go to our program to our Tetris game of course in Python when we have already well all the things configured we can just right click execute run and by charm starts our file and here we can see figures we can move them right left we can rotate them and do some other a lot of cool stuff and fill roles so they will disappear that's really great games are really interesting yeah so let's try to understand how our program works here's the instance of my game class which which is the main application Clause and it over eyes for example method on draw which calls some other math let's for example draw a grid it has some parameters like self stone self stone x justice tell self dot stone why let's try to understand what's going on inside the this map for example we have parameter of set X and offset Y what can we do of course the first thing which we can use which we can do is add printing print statements so of course we will use have strings because they are very useful and very powerful and when we execute this file a lot of output will appear in our console that's not true really good so we will be a smarter today we are having advanced debugging course so we'll replace our print with logging there is a very good built in module called logging in Python here we can just add debug way asked by charm to import this module and also we should configure logging by right into in the beginning of our file so we should pass the filename where this log should stored for example my dad log and also debugging level since we are debugging our program let's configure it as debug and now we again right-click and run our program what happens wait a minute some figures appear we are moving them we are rotating them let's stop our program and check the contents of our my log file yeah that's true it's full of numbers different strange numbers it's not so not easy to understand what's going on here but we'll try to do so well what can we do but we changed this our source code it's not very great let's just revert okay let's just revert changes of our which we did and try to do some more interesting things for example try to use the border there is a very good built-in debugger called PDB which you can start right inside your program doing coin something like this import PT b b b dot set trace it will start interaction with PT beam but since we are using patterns root 8 we can use a cool feature which was added in python 3.7 we can call built-in function breakpoint it calls default debugger which was defined with Britt with debugger hook either with environment variable or with calling method in standard module C's so we added this code by default its PDB of course so we can we call run one more time and interactive PDB session is started here we can check the location where we are we can check the value of some variable for example offset Y and of course we can continue execution but it's well it's quite not not very convenient to type all these commands and do some other stuff but we are inside the integrity development environment that means that we can use visual debugger let's try to do it how we can do it as everything is very easy inside by charm again you can right click and call debug instead of run what happens now you can see my charm started some a bit complicated program and it starts by d d dot pi file from helpers folder and passes path to the script Tetris with PI as parameter we will see it later but now yeah we can see that our program is executed as with usual run we can move figures we can do all the stuff and let's just do something with debugger for example put a breakpoint here great we put a breakpoint and that's absolutely great we can see the values of variables which is located yeah here in the center for example offset X offset Y we can see the call stack the place the functions which was which were called before we appeared in this place of our program and which is pain we will check later okay so we have breakpoint and of course we can press resume and resume execution of our program we can see resume appears many many times well we'll be tired of it let's try to remove breakpoint but I'm afraid to forget the dislocation where I put this bread point so I can right click and this mean you appears I can uncheck enabled and what happens then when I check we click resume the program execution is continued you can see the figures are started to move and everything is absolutely great but I won't forget the place where I put this breakpoint now I can go back to source code chicken a boat clicked enabled and now the program is suspended again the cool thing is that I can for example if I have many many breakpoints in my files different files on my project I can though I can go to few men view breakpoints menu I can call find action which is very useful inside by charm I can call few breath points and it will open the list of all the bread points in my project here is this data is our breakpoint on line 202 which is disabled and here is another bill point and I can manage them right from this menu ok let's check some other options which are available here for example I can uncheck option suspend and menu has become a bit bigger and there is this very interesting option evaluate and lock that means that I can put some expression here of course it will be AB stream again and I will put I can put some expression which should be evaluated on every on every time when Brit point is hit so what happens now I check enabled I unchecked suspend and I enabled logging and resume again what happens now hey where is my program my program is here yeah it works but but what happens in my console you can see that my console is full of numbers that means that this expression which was an hour breakpoint it works exactly like logging I can just go to this option again suspend and yes so I quickly converted my breakpoint into a login and I didn't change any line of the source code is I just added breakpoint right during the debug session there is no need to restart there is no need to change everything everything is just very easy and very simple and you might notice that there is one more option its condition I can define it here as well and brick point will suspend the problem if and only if the condition is true so let's define it when X offset X value is 0 and resume program again ok now we move the finger left and prick point is suspended that means that that offset x-value it was true that is the current figure is on the left side of our board okay that's great now we know how to work with breakpoints how to convert how to quickly convert them to loggers and how to define conditions for them and let's try try to do something with our code I think as you've already seen when you start our tetris program there is already this bottom line we should wait a bit this bottom line is already filled with color but board for Tetris should be empty in the very beginning I don't like this line so I would like to remove it okay let's go to our program here is our my game instance and there is this field self board let's try to call find usages for it all the usages are separated into two groups value read and ballarat when the read is not very interesting for us but really write exactly what we need self Baltic was known is not interesting for us some strange functions are also not great but there is this call self board create new board and it looks likes it this is the exact place where our new board is created we can check here and yet our board is list of list like two dimensional list and the last room is filled with once instead of zeros so we should fix it right now and let's try to run our program one more time what happens now yeah here is nan cat it's really it's really great plug-in you can I'll show you in the end how to yeah bonus tea Oh something has happened we change source code and of course we received exception what happened here we can go to console and we can see index error list index is out of French okay that's not really great but why did it by program suspended here we didn't add any breakpoints here it happened because by default by charm has exception breakpoints enabled you can see it here in the list we always have Python exception breakpoint enabled with activation policy on termination that means that if this exception leads to program termination your program will be suspended you can change it and for example enable on race and after that every exception which appears in your program even if it's surrounded by try except block it will lead your debugger to suspend the program but by default we catch only exceptions which lead to program termination so that's why we are stopped here let's try to understand why it happened we can evaluate expression I selected this value called evaluate expression and you can see this expression is already there we can evaluate it it equals 25 21 also we can check the length of our board and and it was also 21 okay now we understand why we've got this index error we're trying to call too big index let's save this expressions for the future because we'll check that we can insert them here and add them to watches this expression and another one is length of board because it's also very important and we can check this these values or equal okay let's try to fix it and looks like we need to insert some condition so we will avoid this very big ok with very big index let's check if our index is too big or some other perception blah blah blah then we should return from return true that means that collision appeared in our program but also you can see that we have this expression which is repeated here twice and we are using Python 3 rotate and now means that we can use some features of Pi 3 rotate like Boris operator let's try to introduce well variable uy and use it like this and replace this expression with new variable now it looks much more cool now we're using new features of our language our favorite language then start our debug session one more time and try to check that our issues fixed that will fix this terrible exception which we introduced into program okay do we need to play a bit let's just check that everything is okay in in it okay not very smart mood but you can see we introduced another bug the bottom row is already filled with figures but it doesn't disappear okay this is how software development worse you try to add some minor feature and you got exception you introduced yet another bug and well let's try to fix it thanks God we have great visual debugger inside Python so we can do it right here let's go to my game instance and search for usages or my board one more time with again not interested in value right here there is a method called remove row and let's try to go there and check what okay it's called here let's try to understand what's going on here in this method called drop ok we can of course put bread point somewhere for example here and start debug session or our and for example here and start our debug session wait for a moment well again something happened okay all program is suspended and we would like to understand what's going on inside this function or in these places of course we can use different applied expression or check values of my agam instance let's just call step into and here we can step over the this function join matrixes line by line okay there is a long iteration here I'm a bit bored of it I can call step out and I quickly go out of this function and do some other stuff for example if for example I can call step into my code if accidentally go into library code or even execute run to course or if I'm here I can just right click and execute run to cursor but I also need to remove breakpoints and do other stuff in fact here we can see that when we are checking for matter exists we iterate over all the values in our board row by row but we are skipping the last row here we have this index minus 1 that means that we are going to skip the index minus 1 and that means the last row so the fix for our buck is going to be quite simple we just remove this line and now let's try to execute our code one more time ok again playing Tetris again that's why I decided to use this code I just wanted to play Tetris on my working hours I think it's a great opportunity ok I'm not lucky now but we need to feel the bottom row just to check yeah it fixed our buck that's great and by charm visual debugger helped us with that greatly ok so now what we can do now we know how to work with line breakpoints how to quickly define conditions for them and how to convert them into logging without changing source code and without risk your program also know how to work with exception breakpoints and they know that they're defined by default and also we know how to work with stepping actions inside PyCharm and most like them when if you are working with Python most likely your work with some data science tasks and since I am also I'm focused on data science tasks and data science features in pycharm nowadays I just want to show you some useful features of which are available in pycharm in for these cases for example here is just a Python file with just some computations you can of course you can put brute point in any Python file that it doesn't matter is it our arcade game or data signs or just a website you can just again right-click call debug and let's wait for a bit something happens here and after that our break point is reached and the UI is this is exactly the same you can say variable values and call stick but also we have variables several variables which are numpy array or pandas the difference and you can see this magic buttons views array or URIs data frame you can just click them and pycharm shows you a beautiful table with the contents of this array so you can check it it works even with a very very big erase because by charm loads them synchronously so there is no you shouldn't be afraid about inspecting really big variables the same worse for data frames of course you can for example format this values and yeah it works it was a long and it was an old buck and thanks and rato for fixing it to be yeah and of course of course you can evaluate expressions oh sorry you can relate expressions and also check results of these expressions inside my charm right during your debug sessions and most likely if you have some data science tasks you might be using Jupiter notebooks and by charm by charm professional supports Jupiter notebooks as well as this support appeared in PyCharm in 2000 19.1 and this is how it looks on the left side you can see the source code of your notebook on the right side and see the preview and you can execute so here with run cell by turn starts a local Jupiter server for you and and and shows you values of variables available inside your kernel of course you can add bread points like put a bit points and call debug cell and after that debug session is started and it also looks like an usual Python file also not only brick point supported of course you can step into function you can see this function defined in this cell and you can iterate over values here you can step even inside functions defined in the other cell so you can see here I stepped into and I stepped into other function into other cell which was defined there yeah and even if you're importing some well code from Python file of course you can import button module inside your Jupiter notebook again you can put break point here call debug and you need to wait for a moment but yeah we're suspended here and we can step into and we stepped into Python file which we called right inside from the cell from our Jupiter notebook so this is really cool if you do some computations or work along with Jupiter normals you definitely should try it in PyCharm professional because it's really cool and of course is debugger is also very useful it looks like my part is almost done I think now I'm ready to answer questions if we have some time we have a lot of questions a lot of good questions and you know what's nice about being the host I can ask the first question it's me wanting to promote the thing that I always wanted yes so we have a nice pretty visual debunker right yes we have a nice pretty visual testing tool right that's true is it possible to do debugging during testing yes exactly thank you very much for your question Paul unfortunately I don't have a dog show oh yeah right now but you can configure your tests and of course as an usual Python file you can just put breakpoints there start debug session because pycharm automatically grades run configuration for you and you can debug your tests that's absolutely great you can also do stepping check exception breakpoints and all the features of usual debugger are available for tests I do TDD and I do this all the time in fact three years ago when you did those C Python speed ups yeah I just run a debug all the time now switch over from Dimitri your first question it's a good one if you can read this in Python I'll read it yeah empire charm is there an alternative to running Python - um PDB script PI which will drop to the debugger upon an exception there's actually in yeah I thought there's something better than that right yeah we have I think yeah one figured to stop your debugger at exception we already have Python exception breakpoints which I show showed during my demo and you can define either by default they stop your program if this exception leads to program termination but also you can configure them so your program will be stopped at any exception even if it doesn't lead to program stop which leads to the next question about house more under barking yeah it's available yeah that this is how exceptional break points with on termination policy works this is exactly what I showed during my demo with Tetris game yeah so what happens if you did when it terminated it wasn't running in debug you can do post for him anyway no I think no but pycharm debugger is almost as fast as usual run so you can run it all the time and you after multiple stop at exception right inside your program alright we have a question about running the about debugging in docker and I believe Andre will be talking yeah Andre will be talking about remote debugging and all the possible configurations for that so yeah and as a point I believe everything you showed is available in community edition right except of Jupiter no Andre is going to show some things that are available just in pie chart professional ok so that takes care of that can you log to a file from the breakpoint the value 8 feature yeah in fact breakpoints have a lot of lot of options and the best thing I think even check it not here but go to run view breakpoints and for ok would you Peter no that's better put Python line breakpoint well it's not the best place for breakpoint but yeah you can do a lot of stuff here and yeah you can log it ah log into the file ok now I think now I'm it is questions are coming in faster you really have a bunch of people that are interested ok is there way to view variables in the ID while the program is stopped at a breakpoint did you show that like the just the normal variables yeah yeah they usually are the variables available in the current context ok program cool this is one that I think you will enjoy answering about displaying functions and methods in the debugging window variables like collar bowls and all that kind of stuff yeah we buy the family related features and things like that yeah I think uh is it about variable view oh machine is quite big now structure yeah by default we show only fields which are not callable so for example here we can just start our debug session and you can see that well it it doesn't show it shows only fills which are not gonna but yeah for example here this is the instance of my game it shows only like instance of classes or some primitive types but not methods available of this class and for you intermediate users out there as you move around in the stack and the left column all the values yeah yeah yeah but you can check the call stack on the left side okay we had so many questions so we're gonna have to move on but we have to answer the most important question yeah do you get the rainbow cat oh yes yeah yeah oh yeah this is a very important theme you should go to PyCharm preferences for settings and here if this is just a usual Python plugging so we can go to plugins market plans and type non-cat okay it's installed for me it's called non progress bar bar it was created in fact by JetBrains developer and you can just install it install it like any other usual python plug-in but by charm plop plug-in and yeah you will get this beautiful produce by yeah yeah it's very important all right thank you very much Lisa for this part please help us answer questions and we are going to switch over to Andrey and let me get the mic sorry for the noise all right all right here we go is my screen is visible it looks good looks good hello again everyone so okay remote debugging remote debugging comes in two main forms and pie charts which are realist interpreters and Python remote the background configuration you will say the difference shortly as you may guess of the main use case for remote debugging is web development for example when you develop your application on your laptop and then deploy it to a remote server I'm gonna use the jungle tutorial poles application which can be found here it's by the way a great starting point if you don't know Django I have also prepared a virtual machine where I will deploy the app with Django pre-installed so just to save us some time all right now we're all set up let's discuss the remote interpreters and start with the SSH interpreter I'm opening the project let's run the project locally just to make sure everything is working alright here we are so let's try to open the application so it's located on the localhost and the entry point is here okay so you can see the list of available of poles for example are you enjoying the webinar here are the possible answers I can say for you but I'm really enjoying it so let's vote for yes I am vote okay everything seems to work now I'm gonna add every mode python interpreter that is located on the virtual machine and use it for running the application alright let's stop the local application so we are going to add interpreter or going to add SSH interpreter ok host host is the IP address of the virtual machine I'm gonna deploy my application to so let's figure it out because I don't remember which one it is ok terminal it seems to be it trophy and copy and paste it here username very secret password he's so I think interpreters pythons really since I'm using Python Street and here is an important part we need to choose the folder where our product will be stored on a remote machine damn doesn't look a reasonable candidate for me so let's pick something better here you can see that we can navigate through the remote machine file system so I'm going to choose something like home projects and it like it danced jogging debugging art - okay here we go finish now let's run the do let's run our application using the remote using the remote interpreter in debug mode so here we go the application has started oh no something went wrong so what's what was wrong a little of me is let me get out okay let's figure it out so let's see if my application is okay it's on the remote machine so let's let me check it out once again so let's make sure that the application is uploaded okay so here we are so it is here so let's try to run it once again without debugging be ok - now the trial directory ok so let me hit this out alright so parallels only three so who knows the trial of directory but it should be there you know this from chance matters why it's here it's like you have a tight ball you have advanced debugging part - oh yeah so thank you thank you thank you so I need to put it okay thank you Lisa and thanks dollar its own mapping so advanced debugging so here it is yeah yeah thanks like your piece Oh so could you point me out to the mister the final part contains GED and that should be advanced can he can I see the file but where is it cuties okay Karen oh yeah right now yeah so that's debugger so all right I see where did you type your so let's let's just okay I know what to do let's remove this remote interpreter just to be sure and do it once again as an interpreter as a safety interpreter oh not this one so I just need to copy and paste the IP address here wow that's not it here we go sorry guys for this let's just let's remove this from the remote machine to be sure python 3 here let's check how the bass again projects okay so and advanced debugging and to Lisa thank you thank you for chicken ok finish and let's try to debug it once again and so what is happening so the mapping should be no it should be fine okay I know it's we are not sync now so here we are all synced and now try to restart it one more time restart the debugger yeah oh yeah that's now we are synced now we're sync and now the debugger should work as expected yes yes here we are here we are so sorry guys so for my bed typing now we sort it out and this is how the development is actually happen all the time so now we can see that our application is run on the virtual machine and here is the IP a yes we can get access to it so let's do it by the way we forgot the important part let's put a breakpoint here in the boat function and let's try to vote using the remote application tolls so what's what's wrong again okay I forgot the port number so are you in are you still enjoying the webinar I'm in general oh and we have hit the breakpoint from here you can see you can inspect the request that you just got you can do stepping and all the standard debugging stuff all right now the good news are the pycharm allows you to debug jungle templates not actually on the jungle templates only ginger to templates but I'm using jungle applies here so let's put a breakpoint to the results template here we are let's put the break point on this line and resume our application execution and now we have hit the template breakpoint as usual you can inspect the variables that are that are available in this context you can do stepping we're in the cycles of this expected okay so let's remove this breakpoint and resume and let's check all right so what everything is working as expected so far so good not actually that good but we sorted that out now let's try using docker let's stop the virtual machine application and let's try using docker at interpreter choosing docker now PyCharm will allow us to select one of the docker images available locally so I'm gonna use webinar jungle app this is a standard Python jungle image where I've added jungle just in order to save us some time again okay created and now we're using docker image to run our application let's try to debug it again now you can see that our application is run inside the docker we can use the local host to get access to the application because dr. Maps its ports to the local machine let's try to vote again I think of course it's the only option we haven't tried yet and we have hit the heat of the breakpoint again and again you can inspect the variables you can stepping through the code and so on great okay resume let's check that the application is working great okay now there is an interesting use case imagining that you are developing and micro service that will be deployed to some micro services cloud infrastructure as a consequence you are out of control of how this micro service will be run but you still want to debug it so in other words you cannot just click this funny bug button and debug your application the solution is to inject some debugger code into the app and ask it to connect to the ID as soon as it reaches some place in a program this is exactly what the Python remote debug run configuration is made for let's create one for the brevity I'm going to use the same jungle application and I'm going to deploy it on the same virtual machine but this time I'm not going to use the debug button to get access to my running up before we start I need to obtain my host machine IP address because I will need it because my virtual machine will need the IP address in order to get access to it so let's try to figure out what's IP address I think this one looks like the this one looks like the right one all right so let's now go to edit configurations right and remove debug local host name this one for can be pretty much anything named webinar all right so far so good but you can see that pycharm advises us that we should do a few extra actions in order to make things work the first one is to add the pycharm debugger to the host machine to to the remote machine let's do this I'm just copy and paste talking everything is good and the second important part we should topi and paste this chunk of code right before the place we're gonna we need to stop so I'm gonna remove this breakpoint here I'm gonna paste this code here now I'm gonna change my remote interpreter to the one on virtual machine and let's make sure this time that everything is in sync with the virtual machine so we are and now let's try run this remote debug run configuration first and then this is an interesting part I'm gonna run my application but this time I'm gonna run it without debug mode I'm just gonna run it on the virtual machine here we are so I will need at least IP address again let's get access to the web application oh here we are I do in the webinar and let's now try to vote what is happening okay so PyCharm asks us for something so what does this window means PyCharm ask us about mapping between the remote code and your project code luckily how to detect option works in the majority of cases so let's give it a try and the top one looks fine to me okay let's do it and you can see that we've just stopped on a breakpoint not not exactly on the breakpoint but right after the code we've just injected and from this place all the debugging functionality is available so we can step through the code we can resume let's resume and see so yeah we're on the results page summoner use remote interpreters when you have access to the remote server and is able to run the app in the debug mode use the debug remote user Python the remote debug configuration when you are out of control of how the app is running alright so this concludes the remote debugging part well do we have any questions we have a hundred people who said Paul stop whispering stop typing you're too loud so unfortunately our cables really short and it's right beside my keyboard so I will try to do a better job about not typing too that way so we have three big questions I'll ask you can you connect to a docker image running on a remote host can I connect to a docker image running on the remote host let me think of it actually you think you can by doing some magic with your network saying something like but it's something we know about yeah okay it's something that we've talked about can you this should be a straightforward one can ID bug unit tests in a Django project running inside docker yes why not just regular ones which will be related to this next one was the debugger running locally or in don't answer and we're in the VM directly audience do you know the answer yes I do audience give you a chance you have a little bet on this and now Andre will give the answer what's the answer so the answer is the debugger is run on VM it's named locally where the Python interpreter yes where the Python interpreter is running so the thing is the PI the debuggers code is copied to the virtual machine when you run debug and pretty much as same happens with doctor but in the doctor case we just mount the debuggers code to the docker image that's it for those are you interested in how this magic works go back and find Lisa's talk at PyCon for maybe three years ago about how to write your own debugger because that's what we all want to do every day when we wake up right right around the month okay so let's move on to your next part which is about architectural stuff right oh yeah yeah thank you for your questions now let's briefly discuss how the debugger works it won't be possible to cover the whole topic but it would be nice to give you some ideas of on where to start if you want to learn more about the buggers so I have a few slides right here so go fullscreen all right so the debugger debugging may look like magic it actually comes as a platform API and this API allows you to add hoops to events like a function call like moving to the next line of your code rising an exception and so on by platform here we understand some environment that trans your code for example operating system that running CPU instruction JVM running bytecode Python VM running Python Python and so on the example debugging facilities from different platforms are on the slide you can go google them if you are interested now let's move to the Python tracing API so Python provides us with this sis set trace function that is used for setting a trace and callback being said this callback is called every time the program enters a new context the contexts here usually means a function on the slide you can see an example of a tracing function that does nothing you know that the callback function and this is the important information in this slide must follow some conventions it must take exactly three arguments these arguments are framed and after that contains all the information about the current context of the information like function name position in the source code local variables and so on event which is just a string designate in the event that just happened for function call is just call and arcs which are the arguments that function that you pass to your function so that's pretty much it so now having this information we already can implement somewhat usable debugger the debugger code is on the slide this debugger accepts a Python file path path runs it and while running prints the information about every function about about every function that being called to the SD out so because demonstrates the general approach that every debugger uses so the first thing is activating the debugging API and this is what you see in the red box here we are we setting the callback using this set trace function and the second part is run the debugging code from inside the debugger using some kind of exec function the green box on the slide alright so now we know how to trace function calls but in order to be able to know we have reached a breakpoint we must have the ability to trace a program line by line how to do this this can be easily done with the Python debugging API the tracing function can return another function and by the convention this time tree will be used as a line tracer the platform will call this line tracing function every time the exit the execution moves to the next line or function returns or exceptions rest oh do we have time for a short demo we have about to be about two minutes so only questions we will do the demo and not more questions okay give the demo okay so let's move forward to the demo so I'm going to switch to another project so let's call this one and okay so let's just let me show you the techniques that I've just shown you on the slides so the first one is tracing function calls you here you can see this tracer here we set the trace function and a few function calls just to make sure that everything works so let's run this and look at the output all right here we can see that the tracer function has been called each time we entered a new context and in the right order so first we call the H function next G and next F and then G so sounds good so now let's see what will happen if we return the tracing function from the tracing function itself so here what we expect is we expect to see that our tracing function now can every step that our problem a makes it so let's run it and a bit more output so here you can see that the function H is called and we can see that line numbers are increasing here so we can see that our trace in our tracer can catch the line change in event and the last one is the debugger that prints every function current accepts the script as parameter I have prepared a run configuration for it so you can see that we pass example dot PI as a as an argument to this program let's run it and see what is happening alright so we can see that by the way you can see here that python runs some internal stuff first and we catch these events too and then you can see that this tracer can trace every function call and I think that concludes my short intro the links that will be useful for those who know want to know more details will be available yeah will publish it with the blog post and tweet yeah thanks this is fun I got it watching this is really fun because you think of the debugger is freaking magic right and in seeing that these events are generated in an actual human could kind of get into a little bit of that tracing process yeah so this is I think magic at the end of the day live long and debug everyone go out make a new debugger do something fun all right let's switch back over and go ahead and wrap up on this I apologize we won't take more questions because we have a lot of great questions frankly I think we're gonna spend a while following up on all these questions so let's go ahead and wrap up so thanks Lisa thanks right thank you yeah this is a lot of fun taking the time to talk with us about pycharm debugging if any of you have any questions later some of you set the world record for number of questions and some of them were really gonna blaze you have some good questions Tom I have some good questions others had some really good questions but we will follow up on all of us if you have any more questions later don't hesitate to reach out to us by email social media on Twitter it will come to me I will not have the answer then I will send it to them easy if you'd like to get more information on PyCharm please go to our website at JetBrains comm slash platform we'd love your feedback on this webinar so feel free to contact us on twitter or the after webinar survey we read it fill it out tell us what we should do better next time other topics you'd like to hear and any questions that you thought of afterwards yes the recording will be available on our youtube channel soon soon meaning eventually because I might be jet lag for a few weeks if you haven't already please check out our pycharm blog on the blog you'll find up-to-date information PyCharm news about releases and events in addition to educational resources those of you that are still with us get a sneaky peeky anthony shaw will be talking to us about security assertions in February so look for that announcement if for example the recording of this webinar we'll put it on the blog we'll tweet it and we'll also post additional links write the things that we put in the chat window that not all you could see the links to the repository and on that so thanks from all of us for today thank you very much for joining us and hope you have a nice rest of the day you
Info
Channel: JetBrainsTV
Views: 18,901
Rating: undefined out of 5
Keywords: software development, developer tools, programming, developer, debugging, webinar, PyCharm, python, advanced debugging, debugging python, advanced debugging in pycharm, remote debugging, python ide, video
Id: k6j1NkVAsuU
Channel Id: undefined
Length: 59min 43sec (3583 seconds)
Published: Tue Jan 28 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.