 Hello there, welcome back. And I hope you have a very good coffee break. And so what do you do during coffee break? Do you really get a coffee physically? Or do you just chat with people in the chat? So yeah, like now, I guess we're back. And then we are very great to have our next speaker, Rush joining us. Did I pronounce your name correctly? Hello. Hello. Hello. Yeah, so where are you calling in? I'm calling in from France, the Southern Elbs in France. Yeah, yeah, so it's great. I hope the weather in France is great because it's very crowded here in London. So I don't know, across the channel, maybe the weather is a little bit better. Here's really super. It's summertime here. We live here in a place where it's 300 days a year with sunshine. So no complaints at all. Yeah, amazing. So you are going to tell us about debugging, right? Yeah, yeah, that's correct. Yeah, so when your slides is ready, then maybe you can tell us all about debugging. OK, I'm ready. Yeah. Yeah. So is the screen on? Yeah. OK, I would like to talk about a package I developed over the last month, a package called Ice Cream. It's meant to make debugging and benchmarking sweeter. First of all, let me shortly introduce myself. I'm a consultant in the field of logistics simulations, particularly in port automation. Besides that, I'm also an active open source pricing developer, particularly with a my main package is called Salibim, which is a package to do discrete defense simulation for fields like port automation, robotics, materials handling, hospital logistics, warehousing, et cetera. Here you see a small demo of a container port automation done completely in this Salibim package. And I'm also a developer of a package called Ice Cream. That's the one I want to talk about you today. I want to talk a little bit about the inspiration, then about how it can help debugging, how it can help benchmarking, highlight some of the advanced features, how you can customize it, compare it with the package from which I got the inspiration, and then come with some conclusions. The inspiration actually came from a package I found, I think, the beginning of the year. Package from Ice Cream, which is built in the correct way. It's a package by Ansgar Grandzait. It's a nice package, but I had some complaints about it. It doesn't have a pythonic interface, which is quite a nuisance. It also had quite a lot of requirements in the way of modules you had to install. And I found that there were several parts missing, particularly in the field of benchmarking and easy customization. And then it was actually too much to propose as a push request. So then I decided to create my own package, and I called it Ice Cream. It's the same spelling, but now it just was a lie. When you see it was a lie, that's my package. As I said, it's debugging and benchmarking. And debugging is the most important part of it. So debugging, what do people usually do for debugging? Well, they have built-up debugging tools, like we integrated debuckers in IDEs, like VS Code or PyCharm. But they're not always useful. So often we also just have a couple of print calls, like print, A, C, or B. But if you have many of those, you don't know actually what it is, and then you have to add something else. You have to add, OK, this is A, and this is B, et cetera. And from Python 3.8 on, it's possible to use an F string, which is quite useful, but it's not ideal. There's still a lot of typing for debugging, and you will also miss about some functionality. So what about just saying, why A comma B? That's actually what ice cream does. And I just wanted to show you that by looking at a small program, a small program that's supposed to remove all the elements that are less than or equal to one of a given list. So this is the list, and we have this little program for EL in L. If it's, then we remove the package, and then we print the list. So if we run this, and let me just do it in real time, but the output is wrong. You see several items are still not left out correctly. So now I just wanted to show you that in reality. So if we just run this program, you will see the wrong output. Well, what most people do then in those cases, for instance, they just put a breakpoint here, and then they run the debugger. It's slow, I think, because of the connection. Well, then you run the debugger, and then you can just see the elements. It doesn't really work at the moment, but you are familiar with that, I suppose. The disadvantage of that is that you can't really see the context. So you could just see a number of variables, but not in time. So what a lot of people then do, they just say, OK, I just print EL here, and let's at least check that we only have values that are indeed less than or equal to 1, because that might be also a really problem. If we just run this, I hope that will work now. So we see here the elements. And now it's already difficult, because we don't know actually which print statement is what, which is which. So we have possibly just add here line three. And we add here line number five. And then we can at least see already a little bit more of where the problem is. And we'll see that in a minute. Let me mistake this one here. Sorry about that. It's very sorry about that. We're in a very remote place here where the internet is not that stable. OK, now we can see at least the line number. And we could see that the elements are indeed correct. I'm not going into all the details. But now I just wanted to show you what you can do with the line screen. You can just add here the line from ice cream input Y. And then we see here Y element, YEL. Let's say we also want to add the list itself. And here we say also element and list. And now you will see an output, which is a bit similar to this one. But you will also see already that the elements are mentioned. So it's the element and the EL and L is in the output. So you'll see EL is and L is. And now we would like to see the line number. And then all we have to do is add dot show line number. And then you will see immediately on top of this output, you will see the line number, which can be very useful information. You'll see the line number. And if we put this into a function, for instance, you will also see the function name. If it's even in another file, you will also see the file. So let's go back to the presentation. Well, ice cream also formats the output nicely. So here, for instance, depending on the line length, if I have the squares here, the normal is it. When I have a short, very short line length, it will just format correctly. Which is done via the pprint package. What else can we do? We can also just say, OK, we have a function. And I want to trace actually what the bot goes into the function with got out of the function. And what we just then do, we just add the decorator Y. Then we say, OK, we just call this function. And then we can just print the output. So here, you see actually the effect of this is actually that the output just says, OK, this is called with the parameter 2, this one. And it returns 4. And you can also see some different information. If you go to benchmarking, benchmarking is quite often done with specialized tools like time it. And there are many others. But if you just want to do something simple, you want to have also the deputy functionality. Ice cream could maybe help with that. And you could do that with decorator. Let me just show you that in a real example. Let's say we have this function. It's a function that sorts 10 to the power of i numbers. That's not really very important. So we just add the form ice cream in point Y. And then we make a short test run for i in range 7 to do sort i. That's all. Then we add the decorator to give the debuting information. So here we see actually now an overview of the timings. So with 10 to the power of 7, we see it will take 0.6 in a minute. What we can now do, we can say, OK, we don't want to have all this information. That information that shows the enter is not very important. So we just show enter, also demonstration how to set attributes. So enter is false. And then we just run it again. And then you'll see a very nice overview of the timing of this function. You can see it's an exponential square, an exponential equation. What we can also do is, as a contact manager, and in that case, I just do this. I have another example here. Just built up a list of 10 to the power of 8, I think, elements. Add to the i-spin again. And now all I have to do it with with y. And then I can run it. And then you'll see it enters here the function. It will take a while, and then you'll see in four seconds it's ready. And then you can just use that, of course, and print it and all that. There's even another possibility. You can also do this. The second counter is also part of, instead of part of, I just don't do this. But I do this. I say i dot delta is 0 as a kind of timer. And I must just say print i delta. And the nice thing of this is then delta is just an ordinary variable. You can put it into an array, for instance, or do whatever, and then make a nice graph with it. That's easy to handle. So here you see the time now. For benchmarking, you can just only at the time. That can be useful information, particularly when it's very long. It takes minutes, for instance, with a response from a website or something like that. So you just say, OK, show time is true. And then you say, hello, and you get the output. You can also do relative times. You can add the relative time. So here you can see I do show time and show delta. And the delta is that counter. And then you can see it relative to either the start of the program or relative to the timer set here. I wanted to show you a couple of things to change attributes and all that. Let me just go back to this example. You see already that we've added a line number. Let's just say we don't want to have that same prefix. It was always a prefix is some examples. And then for standard, normally the output goes to standard error. But they can also standard out. But you can't really see when you run it on their VS code what I'm doing. But you can send it to a file. You can also send it to a logger, which can be very useful. So now you see here, indeed, that the prefix has changed. And we have sent it to an output. Let's suppose we have done this. And now we have debugged it. And we know how to handle it. Oh, I didn't tell the trick to correct this. The trick is actually to make a copy here of L. And then it's OK. So then it will work. But if we just say, OK, we have done. And we don't need to see the debugging information anymore. We can just say enabled. Enabled is false. And if you run it now, you will see there will be absolutely no new output. Then you can just only just print the information. So not anymore the output information. I just want to do something else. This is a small program to show you some sort of the output specification. So if we run this one, I've set here a line length of 160. So that means that this will all fit. If I just say, OK, I have some more squares to print like this, then you will see the output will change. Because this doesn't fit anymore on one line. And then you will see we put two lines. If we don't have even more, let's say we have 70 of those squares to print. Then you will see that it's more lines. And then actually it spreads up squares into various lines. And that can be extremely powerful. You can also show tracebacks. So then if you just call it from a certain point, you can see actually from where it's called. That can be useful to track calls from. And you don't know exactly what came from. There are a lot of advanced features. There's a whole list of them. And you can also use for each one, you have a shortcut. So instead of line length, for instance, you could say LL or things that are prefitted against P. And these things are you can just add them to your GND debugger. Nice thing of ice cream is that you can customize it with a JSON file. You just put the JSON file in the current directory or in the side package folder where the program is installed. And then you could just say, for instance, this is my setting. And you set the line length to 160. And compact has to be true. And then this becomes part of the package. So it looks like this is actually a part of the settings of the program itself. And you could do that, of course, then on the project base by putting it into proper current directory. Installation is very simple. Just respect and store or get it from GitHub. And one of the nice things is ice cream. The ice cream is just one file on the file ice cream.py. And if you put it in your current directory, it just works. There are absolutely no requirements. And no other files required, which makes installation extremely, extremely easy, of course. Little bit about the technical information. Ice cream is, in contrast to most packages that you see in Python, is one big source file in order to avoid dependencies. It includes actually the complete source of the ASD tokens module, the executing module, and the preprint model, 3.8. That's for shorting of dictionaries. And I've made some special code to make it random number 2.7 and 3.6 and higher up. And to give you an impression, the package itself is actually something around 800 lines of code. And the rest is actually the whole package is 3,000 lines of code. So these modified sources are actually about 2,200 lines of code. And just a short word of comparison with my inspiration package, ice cream with an eye. What ice cream does, ice cream does the color, the output. So in ice cream, you will see, in this case, you will see the strings in color, in blue, usually. I don't do that. That's particularly because the inclusion of that package would make it big. And I personally don't like all those colors that much as a personal preference. Ice cream with an eye doesn't have any benchmarking facility. My package has a very Pythonic interface, as you also just saw in my examples. My package is highly customizable. You can even make new, let's say, wise with those deep-diving states by forging and cloning. It's really very sophisticated. I don't know whether I'm on the feed or not used. But if you need it, it's very, very useful. You can use my package as decorator and context manager. What you can't do with ice cream with an eye is control the deep-diving parameters, which you can use my package for sure. And I have some more extensive tests. And I use another package. I use Pyth test and Ice Cream with an eye uses unit test. So to conclude, I would say ice cream might make deep-diving and benchmarking a bit sweeter. So if you want to use it, just go to my GitHub address. And then I just want to say thank you. And you can always contact me at this email address. Thank you. Bye-bye. That's good. That's really good to see how this is done. And very impressive live coding as well. I think it's very brave. I'm so scared to do live coding. I think this is a really, really cool demonstration. So actually, people have a question to ask. OK, super. Yeah, so what about a very long list? So this question come up when you was showing something. I think I forgot which part, but it was something that you were demonstrating. And then so are there kind of structures? So how do they display? I think it's really related to if you're using pandas, what should you do? Yeah. Well, actually, that's all done by the P-Print module. And P-Print can do all those things. So very long lists are indeed split up in the number of lines. As you saw already with that one example, I showed you where I put 70 squares instead of 10. Data frames in pandas are also handled by P-Print. So they will be quite nicely formatted the way P-Print actually works. So which is very popular package, as you might know. Yeah, I use P-Print all the time because in my work, I do it with a lot of dictionary that is very nested. So that's really good. Yeah, yeah. And one of the weird things with P-Print is by default, P-Print sort of direct the dictionaries. I don't know if I've ever noticed that. But from Python 3.6 on, dictionaries are sorted by themselves. So therefore, I, in ice cream, disable by default this sorted, which can be very useful actually. Yeah, so there's another question. So usually, execution is slower in debug mode. So what about ice cream? Oh, I think it means, yeah. So does it slow down the code as much? Yeah, that's for sure. But of course, you also have to look at some output but it's more or less the same as the P-Print statement. The only thing I can add to that, which is it might be important if you have disabled ice cream and you still have the statements, then it slows it down as well. But I've made some special provisions. So then the effect of that is actually not very big. So yes, it will slow it down. But you also have to look at it. So I don't see that as really a major problem. Yeah, absolutely. Absolutely. So thank you so much for that. This was a pleasure. Thank you. Yeah, so yeah, sure. And then if people have more questions, they can, of course, find Joe in the chat, I guess, in Matrix. See ya. Bye-bye. Bye-bye.