Back to the video

Lightning Talks III

Transcript

By Speaker 1, Speaker 2, Speaker 3, Speaker 4, Speaker 5, Speaker 6, Speaker 7, Speaker 8. From DjangoCon Europe 2018. Published May 25, 2018.

Watch the video Markdown version 7,395 words · auto-generated · en

Summary

The lightning talks covered practical lessons from Django development and conference work. Cheryl and Andrew explained how stenographers use chorded shorthand machines and translation software to provide live captions, while Anna Paula GĂłmez introduced Pytest Pickett, a plugin that runs tests associated with uncommitted changes. Other speakers described safe treehouse construction, argued for cleaning up Git history with rebase, led a short body-scan exercise for mental health, demonstrated JetBrains MPS and projectional editing, and showed how preloading Django before forking uWSGI workers can reduce memory use and request latency.

Transcript

Automatically transcribed, so expect mistakes in names and technical terms. Filler words are removed.

0:00 Lightning Talk Introductions

Speaker 1

We have more lightning talks. Do you remember how lightning talks work? Who needs a refresher? Great, lightning talks of five minutes. Five minutes of lightning talks. There is a timer down here that will countdown when the timer starts. When there are 10 seconds remaining, the gong person, who is our gong person? Lacey will be my wonderful demonstrator. The gong will start slowly making sound. Until right when it goes three, two, one! And then we all start clapping and then they have to stop talking because they can't hear themselves think and then we change over and then all the laptops will definitely work and everything will be great

Speaker 2

I'm not sure that I have anything to add. I'm gonna summed it up.

Speaker 1

You talk for a bit. I'm gonna check.

Speaker 2

Okay. So I prepared a little activity for between these sessions here. I am not nearly as good a storyteller as Russell is. I don't really have stories. I like to play games. Has anyone ever played the game Never Have I Ever? Okay, so if you haven't played the game, the way that it works is that I'll say, never have I ever done a particular thing, and if you have done that thing, you raise your hand. So if I were to say, never have I ever been to DjangoCon, what would all of you do? Yes, everyone's hand should be up because we're at DjangoCon right now. Now this is Never Have I Ever programmer Edition, so let's let's start. Never have I ever crashed a client's website. I've done that. Keep your hand up if you've done that for more than an hour We don't have more than a day.

Yeah. Sometimes we've had some kind of a bad day. Bad days here, so that's fun. Never have I ever taken a video chat with a client or my boss while wearing pajamas That's definitely me. I remote. I work from home. I know we have a talk about that today, so pajamas are a big part of that. We ready? Not quite, we're blinking. Okay. Never have I ever gotten myself caught in an infinite loop. Incident loops are fun, yeah. And I feel like this is a really reassuring game because I think we've all made kind of a lot of the same mistakes all right, never have I ever spent more than an hour debugging something when all I needed to do was restart my server. That's like literally everyone in this room, right? Yeah, we have We have all been there.

Yes. And it's so annoying too, right? Because finally you're like, all right, I'm just gonna turn it off and on again. I swear I've done this before. And then suddenly it works just fine and it just sucks All right. Never have I ever forgotten to update to master before I submitted my pull request and gotten caught in merge conflict hell. Yeah. Yeah. Gets hard. Gets hard. We're still blinking.

Speaker 1

Never have I ever made a projector work first time.

Speaker 2

Oh gosh, yeah. Oof.

Speaker 1

Lies.

Speaker 2

I know. We have we have a few liars here. Yeah. All right. Never have I ever committed my secret key to GitHub. In a public repo. Then you get to learn how to change your secret key. It's really a learning experience for everybody. It's awesome. Whoa. Are we here? Almost. Okay. Do ba doo.

Speaker 1

Never have I ever been able to say words and they immediately appear on the screen in front of me.

Speaker 2

Woo! This is magic!

Speaker 1

Well, first up, we have one of our wonderful stenographers, Cheryl, who is going to share with us her magic piano.

3:58 Live Captioning with Stenography

Speaker 3

I never realized how short I was until I've stood by here First of all I'd just like to say thanks to DVO who sponsored us to come and it's an absolute privilege and this is my fourth year and it's just been great to come. So right, we'll start with the introductions. So I'm Cheryl and I'm from Wales. And for today, my colleague captioner Andrew will be my Siri. Andrew, would you like to introduce yourself?

Thank you, Andrew. This is why your captions are delivered by humans. Okay, Andrew, can you really introduce yourself? Okay, I'll tell you more about Steno. So we type on shorthand machines, which have been for around for about a hundred years now. So the originally they were they weren't electric. It was very much like your QR -typewriter. And then they slowly evolved to the machines that we have now.

So that's the machine we type on. So it's been evolved over time and so now it's connected to computers and allows us to provide these subtitles. So you play it like a piano, so you press chords of letters all at the same time, and then they come up into the words. So typically, as I know a lot of you are fascinated by numbers I thought we'd let you know how many words are spoken on an average day at DjangoCon. Andrew, can you tell us the totals for Wednesday at DjangoCon, please?

Okay. And that would take you about seven hours. Okay, can you give me the figures for today, Zuri? Isn't karma sweet? So I'll tell you about the software and how it works. So you can see on the screen here, this is modern

stenographic software. And you see if you see the bar on the left contains the letters that Andrew is pressing sorry, on the right So on yes, on the right is because I'm backwards. Okay, on the right is the notebar. And as Andrew presses the letters, you can see the letters popping up there. And So what it does, it puts the words up and it does this by searching the database dictionary for the longest match of the group of letters and prints it to the screen and then adds a space ready for the next word. This process happens in the space of one second before the translation of the outline is thrown to screen. So Andrew will input a word and within a second it's thrown to the plasma screens on the left and right of the stage.

So if you look at the main screen and then look at the plasmas and see the connection. So how fast do people talk Traditional speed is anything from 180 words a minute up to and in excess of 250 words a minute, ranging far beyond 300 words a minute on occasion. I'm saying nothing. So for us working as captioners, our preference is that the best talks are always from those speakers whose delivery is steady and not at jet engine pace. With thinking time. Less is definitely more. So we experience lots of different words. We experience philosophers' names, Latin words, Greek words.

Double underscores, which reminds me, any chance of taking the double underscores out of Django codebase would make our lives so much easier. Thank you.

Speaker 2

Thank you so much, Cheryl and Andrew. It's so nice to have a peek behind the curtain.

Speaker 1

That was so cool. I don't have fun people

Speaker 3

, but am I allowed it? Am I allowed to carry on just a minute or two? Would that be alright or not? What do you reckon?

Speaker 2

I kind of feel like she's worked really hard this week. Okay. We will make an exception. We will make a 60-second exception

Speaker 3

Thank you. Right, okay. So we experience foreign languages such as German and Greek, as I've already stated. So we also have Welsh. So, how do we cope with that? Kreuzhoi Heidelberg Now As you will see, Andrew's Welsh is about as good as my Scottish Gaelic So you'll note that the email went out to speakers before the conference to ask for a preview of presentations and speaker notes. So I've primed Andrew with the Welsh. Should we try it again

Printhound Which is good afternoon. Sitoe, how are you? Kroisui Heidelberg, welcome to Heidelberg. So for us as captioners, the pre-information makes our lives a whole lot easier. It enables us to be accurate and not to make rude mistakes. We're a human after all.

Speaker 2

All right. I think we're gonna take a break from Never Have I Ever and Katie's gonna tell us a story.

Speaker 1

I have a story.

Speaker 2

Yes. It's storytime.

Speaker 1

Oh we don't have the stenographer up anymore. Okay, I'm gonna make sure I can see it because this is a good one. Have you heard the one about the monk? It's this old monk, he's he's trying magic and stuff, but you know, as monks do, he's up in his monastery, he doesn't have any shoes, he needs to brush his teeth You know, a little bit, you know, he's the supercallist vagile mystic hex with halitosis I got a lowercase applause, not a uppercase applause.

Speaker 2

I don't know what to tell you about that. It does look like we're just about ready though. This is like the fastest setup that we've ever had. I'm sorry that you're you know

Speaker 1

, it was it was the fastest shaggy dog story. It's fun. So up

Speaker 2

all right without further ado we have Anna Paula Gomez with Pi Test Picked.

11:55 PyTest Pickett

Speaker 4

So hi everyone, my name is Zanna. And today I will talk about with you about PyTest Pickett. So basically I have two goals in this Lightning talk. The first one is Make you understand me so it can be quite challenge. And the second one is get you to know about PyTest Picking according with one of my co-workers, even if this presentation goes wrong, maybe you like the this small plugin that I developed during the last weekend. So let's say that you were asking for developer a new feature. So basically you wrote the test and then you change

a few files And you are ready for your first commit for this feature. So basically we have a bunch of files modified so and few tests to run before commit. So after all you don't want to execute all the tests available in your code test. Just hypothetically speaking, maybe you have some code base that will take a few hours to run all the tests So basically you decide to run the tests related to the modified files. So then you decide to use PyTouch for it. So then you copy and paste the name of the files And then you go through this process. Executing git status and then copying the name of the

module and then Pythagore spacing stuff and then repeating over and over again. So I don't like to do repetitive work, do you? Ladies and gentlemen, I'd like to introduce you Pythas Pickett. So I was expecting somebody. Yeah, that's it. So basically here a small demonstration of five seconds So basically let's say we changed few tests and probably we will execute the git status just to check the name of the tests. In this project I have two test modules. Basically, I execute PyTest,

Picket, and then it will filter just the tests related to the changed files, the tests that weren't committed yet. So here you can say the test files that weren't committed before So PyTest collected 33 ether items, I mean tests, but just one module was executed. So basically that is a small plugin but looking for the future I I'm planning to Execute test is related to the branch. So instead of execute the tests that were changed, would be nice to execute all the tests modified

in branch and also to get the test from on a specific module that maybe you changed but didn't add any tests for it So the plugin of course is open source and I'm looking forward to hear your ideas and feedback about it So that's it. Thank you.

Speaker 2

Thank you so much, Anna. So

Speaker 1

who's next?

Speaker 2

So right, well Harry will be next.

Speaker 1

Harry?

Speaker 2

Harry, yes. Harry. So Harry, come on out and get set up.

Speaker 1

Come on, Harry.

Speaker 2

So are we are we storytelling or are we game playing in the interim

Speaker 1

Well, who wants another story?

Speaker 2

Stories are good.

Speaker 1

Who wants a game? Yeah, games.

Speaker 2

I win. Just give me a-story time.

Speaker 1

That was

Speaker 2

okay. Never have I ever deleted a production database Yeah, there we go. Those are the real errors. Yeah, those are the most fun. Those are really good days, aren't they? Yeah. Never have I ever and some of these by the way are taken from some of the talks that I've seen this week, so they should sound familiar. So I 'm from mine? Sorry?

Speaker 1

Are they from mine?

Speaker 2

Guess we'll have to find out. I don't know. So never have I ever run a very important and crucial command in the very exact wrong environment. Yeah, that one's fun too.

Speaker 1

Lacey, Lacey.

Speaker 2

Oh, are we ready? Yeah, there's a tree house. Oh my goodness. Okay. Well, I'm gonna stop playing this game now and I'm gonna introduce you to Harry, who's going to teach us all how to build a tree house

16:43 Building Treehouses

Speaker 5

Hello. Cool. Hey everyone. Welcome to my talk about tree houses, which is moving on automatically. Stop, stop, stop, stop, start again. Okay, cool. Yeah, so I think this is a fitting image to start with. There's something really kind of childlike about being in a treehouse. has a kind of fun and kind of escapism to being in the treehouse with your dog. On the other end of the spectrum we have a slide which won't go on. No. I'm just gonna do it like this. So the other end of the spectrum we have something like this. This is Horace's Cathedral in Tennessee. It was built by one man. Over a period of something like fifteen years.

It's 10 stories high and 30 meters high. In 2012 it was shut down too due to fire. Fire regulations. This is another really big favorite of mine. It's a hotel called the Woodpecker Hotel in Sweden. And I really love it because it's basically just a house that you've just plunked in a tree. You can stay here as a guest. You have to access it via a rope and your fed food via the rope. I don't know if you're allowed to leave during the stay. But that's a really cool one. This is on one of the crazier ends of the spectrum this is a tree house called Sam's Tree House. And the guy built the house and then thought, hey, one day he thought what I what this house really needs is a plane. So we stuck a plane in the side, and there's a boat on the other side and around on the right there's a

a some kind of Apache helicopter as well and the picture here of the dog you can see. And then this treehouse wins the award for the most inventive way to access the treehouse. You just get on the bike pedal and Up you go. I could show you pictures of beautiful treehouses and there are a lot. I could show you them all day, but I wanted to give you some practical trips tick on building a treehouse. When you think about building a treehouse, the thing you might think of doing first is getting a bunch of pieces of wood, getting lots of little nails and hammering them in. This is a really bad idea because the tree actually lives in a layer underneath the bark. So if you hammer in loads of little tiny nails, what can happen is the tree gets a kind of compartment syndrome like you get in muscles and it can die. Another bad idea is to think, hey, I can get away without with making it

no holes whatsoever just by having some kind of a collar or some kind of cladding. This is even worse because it makes a bigger cut in the bark and can completely cut off all the nutrients to the top of the tree. So if you want a happy tree and you want your tree house to last the best thing to do is to take advantage of this modern invention which is called the Ghania limb. It was invented in the World Treehouse conf conference which I've always wanted to go to in 1997 and it's basically a huge bolt. You put one in and it looks kind of destructive but the actual hole you're making in the tree is only a small circle. Most of it's living inside the dead heartwood. And that piece of hardware can hold l like three and a half metric tons. It's it's really crazy The tree you're building on is a living thing, so you've got to take account of a few pieces of movement.

The first thing you have to take account of is growth. A lot of people will think I'll put my bolt in here and over time it'll move. But actually the bolt stays exactly where it is because a tree goes from the tips of the branches. and it goes outwards in layers. So all that happens really is that your bolt gets kind of enveloped by the bark. So if you're building a treehouse, make sure that your beam is paste spaced away from the bark The tree also moves in the wind. It acts as a kind of lever. So when the wind is on the top, the amount of force on the base is absolutely huge and can brick the tree out in two. So what people do here on the left is called a treat house attachment bolt. Allows the bolt to slide up and down Or you can use cables. If you use too many cables, then you end up with a tree swing, not a tree house.

But normally what you do is you attach you fix yourself to one of the trees and then when the other trees sway Your tree house is safe. Cool. Thank you for my talk. This is a picture of me in my treehouse. It's more of a tree platform, but hopefully one day I'll be living in a big house with balls. And if you want to be inspired or know more about trees and climbing trees, I can recommend this book, The Man Who Climbs Trees, by James Aldred. It's just a really awesome collection of stories of climbing and rainforests and all that kind of stuff. Great, thank you very much.

Speaker 1

That was cool.

Speaker 2

That was really cool. Now I want to like stay in a treehouse hotel.

Speaker 1

Our next lightning talk speaker. Can we get like hi, you gotta go around and make sure you're ready. We're trying to make sure that people are going around and stuff. Yeah. People are missing. I don't know how Russell does it so well. I don't know.

Speaker 2

I know. Russell has this down Pat. Looks like we might have a do you have a quick story?

Speaker 1

Oh. Do I do I tell a story? No.

Speaker 2

Maybe not.

Speaker 1

Maybe not.

21:47 Django REST Framework Renderers and Parsers

Speaker 2

Okay, not to not write the second. Next we have Martin who's going to tell us about Django Rest Frameworks renderers and parsers.

Speaker 6

So hey, I'm Martin from Bulgaria and this is my first Django con ever, so I'm really glad to be here Today I'm going to tell you about the Django race surrenderers and parsers, but before we start I want to tell you more about the project I'm working in. In the beginning we just had Django. We used its views and templates and just a simple HTML with the Ginger tool. Template language. But after that the project became a little bit more complicated. So we decided to use React as a front-end view layer in order to have some components you know

this stuff so we migrate our views to APIs using Django Rest. We actually built something, it started working and we the system actually started to be used by the by our clients but Its design became a little bit more complicated. So we decided to move it to a single page application with React, start using Redux, it's sagas, router, and so on and so on So this actually started up like two or three weeks ago. So we're actually here. We're mainly Working with Django and ReactNow. And

to be honest, it was my first time using JavaScript. And I can't say it's like Python, you know it's not that good. So we are currently use you we are current currently have two frontlades front ends like one which is only for React and the other one we are just migrating it to you know the A schema. So I I'm pretty sure it's a pretty common architecture so I don't have enough time to tell you more about it. As I said The Python is not like JavaScript.

there are different common principles established and so on. And the one that really bored me is that Python and as a Python developer we are using snake case for mainly snake case. I mean for the functions for the variables and so on. And JavaScript it's only camo case. So The one thing that really bores me is the is that in the last system the previous front end that we are working at it's we kinda have because the Django rest returns The fields on snake case, you know. So we had like object point field name in snake case, point some function in camo case, which is awful.

I hate it. So We went through a couple of solutions of that. The first one, of course, is to use JavaScript tools to use JavaScript tools. We write some deep c deep came on case snake case transformations. So when the data comes, we transform it to camo case and when we post something to the backend we transform it to snake case. If you want to actually the JavaScript knows that you the JavaScript expects the backend to return it a snake case which the language does doesn't like it.

Second thing I did is that when I become a little bit better in React I the actually in Redux the it's redux middleware. So redux schema has middleware in it, like the junk ones, but not that good we moved the get and post transformations to the middleware. So it kinda happened in the back of the developer coding. But you know, as I told you, it wasn't that good as Django, so it was a lot of bugs with it, so we decided to remove it yeah it kind of worked but I still didn't like it. So the next thing I found is that Jung

Resk has renders and parsers. You and you can write your own custom one So that's the last thing we have. Now the logic that transforms camo case to snake case and vice versa is in the back end this is how a custom camo case renderer look. You just encase from the JSON renderer from the renders and Just sorry

Speaker 2

Thank you so much. Five minutes goes by really fast. I definitely Understand that. Next we will have Shy who's going to talk to us about Git menorahs and why they're harmful. And while Shy gets set up. Whoa, hello. Here we go.

Speaker 1

So s so Kemetha Frog goes into a bank. He and Piggy, they want to start a patisserie, they want to start making Stroop Well And he goes up to the teller and the teller goes, hello, good morning. I'm Patricia. I want to help you with your thing. What can I help you with today? And so Kim and goes, Well, I want alone And Patricia's like, Oh okay, well blitz get you set up. How did you know about our bank? Oh yeah, my godfather, you know, the You may have heard him, he's a bit famous you know, Mick Jagger. Oh I love him, oh he's so wonderful, okay, we'll get you all set up and stuff. And Kermit 's like sitting there and Patricia's just saying, Okay, well we're gonna need some collateral for your loan. And so Kermit gets his rucksack and rustles it around and then puts up this little tiny ceramic unicorn onto the counter.

And Patricia goes okay. One second, let me go get the manager. Are we set up? Yes? No? Great. Well I'm going to continue that story after this wonderful talk about Git the Norse.

28:35 Git History and Rebasing

Speaker 7

So hello, I'm Shai. I've taken Lacey's advice, thank you, from yesterday and picked subject where I have a strong opinion. So what I'm going to talk about here is my opinion. It's not really a consensus. But yeah your mileage may vary. And this is a menorah. You might be wondering what git minoras are, but first I'm going to talk about actual menorahs actually there's two kinds of menorahs. This is a bit of Jewish trivia. the temple menorah with seven branches, which used to be in the temple when it existed in Jerusalem 2000 years ago.

But this is not something that we use today in Jewish practice And there's the nine-branch menorah, or the Hanukkah menorah, which we use every year in the holiday of Hanukkah. Actually, that's this is the terminology of the English-speaking Jewish world. And in Israel we call the seven-branch menorah. and the nine branch menorah chanukiya for chanuka. But anyway these are the non-git menorahs and this is the git minora yeah, I s assume this means that you this is clear enough.

The this is the repository of a project I was involved with anonymized to protect the innocent and guilty. And basically some of you might be wondering what is wrong in this picture. So to answer this question we first need to go through something more basic. And that is what do we use version control for at all And I think that we use it for two main goals. One is to coordinate collaborative work so that we can work together on a common code base

without stepping on each other's feet. And the other is to keep a record of history. But then this begs the question why do we need the history? And there again this is my opinion, there's two main issues. Not too, sorry. There's well basically we need the history to fix mistakes. We need to find when something broke so we can fix it. And we need to Sometimes reconsider decisions because the conditions or requirements have changed. And sometimes some change was simply wrong and we need to revert it Another thing we

should consider when thinking about why we need the history is what we don't need in the history. And that is the exact details of work being done. So we don't need all the typo and typo corrections. We don't need the I fixed the white space because of review comments. All that is really noise and not interesting history. So now we can answer the question, what is wrong with this picture? Well, for one thing, git bisect gets severely limited when you have this picture. And reverting a merge commit just is

is pure damage. It undoes the individual commits in non-obvious ways. Hard to find out exactly why the thing you committed and pushed like weeks ago suddenly isn't there. And usually when you see something like this it means someone just worked on a branch and finished the work and just pushed it and without any consideration. So in summary if there's one thing you're taking from this talk, this is what I want you to take. Code history should be kept in a way which serves the project going forward and not to serve pure academic historical research, not code archaeology. So use Git rebase to reshape the history of your work before pushing.

And follow the example of the Django repository, which looks like this. And that's all I have today. Thank you.

Speaker 2

Very, very perfect timing too. Thank you, Shot. Alright, our next speaker is going to be Ducky. She's going to talk about taking five minutes for your mental health. While she gets set up, I do have or Ducky, do you have anything to set up?

Speaker 1

Oh Ducky, can't I finish my story? Woo. If I insist. Okay, so Kermit 's just put up this little ceramic unicorn onto the counter and Patricia's just going, Well what is that? So Kermit Excuse me, what was your name? Oh my name is Ms. Wack. Ms. Wack, can you please go get your manager? So the manager comes out and goes, Okay, what's the problem? And Kermit goes there with his Kermit voice that I can't do and says, Excuse me, I would like a loan And Patricia just goes, No, no, he has only this little ceramic thing for collateral. What am I supposed to do? And the manager knows who Kermit is, everyone knows who Kermit is, and so he just quietly pulls Patricia aside and goes It's a knick-knack, Paddywack. Give the frog alone.

His old man's a rolling stone. And now Ducky, who's less terrible than me. Oh, thanks. Hello. Oh

34:43 Mental Health and Body Scans

Speaker 2

hi everyone. I'm Ducky. I'm gonna stand over here because I'm short. How are you all doing? This is an interactive talk, so please actually like speak back. I hope you're all doing well, maybe. Yeah. Yeah, yeah. Anyone feeling a bit tired like this week is just no, no? Wow. You have way more energy than I do. I am really ready to nap. And this talk is definitely not an excuse to do that at all. But you know, while we're here, you know what's really important for your mental health? Sleep. Sleep is really important for you. So I'm gonna get to that in a second. But first Exercise, also really important for your mental and physical well-being. So thank you to the organizers

of Jagocon for bringing out those excellent people teaching us how to do exercises at our desk. That was really awesome. Also I'm gonna try and slow down a bit for the stenographers because I'm Australian and apparently we're very good at speaking fast. I've known Russell for a little while now. And on Russell and him talking about time, I'm gonna try and slow down not time itself, I'm not that cool yet but we're gonna try and slow down your perception of time so I'm just gonna run us through a few kind of body scans. These are just kind of little exercises you can do if you're you're feeling a lot of feelings or if you're not feeling anything at all, and you can just kind of

Run through your body and feel your feelings as weird as that sounds. Just kind of be with yourself. And so if you're feeling angry, you're just kind of like, oh. Hey there anger. What up? You're just you're just doing your thing. If you're feeling stressed or anxious, you can just kind of visualize that and feel it inside you rather than fighting it which will only make you more anxious. So I'm gonna get you all hopefully this doesn't make you feel uncomfortable, but if it does feel free to opt out. It's okay. I'm not gonna force you. But I'd love you all if you could to close your eyes and now just take some deep and slow breaths. In And

out in and out Now I want you to take your mind to your extremities, your fingertips or your toes, doesn't matter which Just feel the ends of your body. You might be able to feel them touching the floor or just feel the air around them. Now explore further up either your hands or your feet. Very slowly just feeling your feet on the ground or your hands in your lap

And then just slowly bring that up through your arms or through your legs, up into your body. Still breathing in out Now, you might be able to like, if you're having any emotions at the moment, I hear that's a common thing people do you might be able to visualize kind of what sort of shape that feeling is. It might have a color or a texture. Just kind of explore it. Be with it.

Now I want you to explore back down very slowly through your arms or legs, maybe even shake it up and go to the other limbs. Now back to your extremities, and you can open your eyes So that is a very quick demonstration of what a body scan is. And you can do these as many times as you like. any way you want. Like some people like to start at the head, go to their feet. Some people like to go up and down. It's it's up to you. It's a really good thing to just practice every day for like However much time you feel like you want to spend on it. And if the more you practice it, the more kind of you can be with your feelings and yourself

I don't have time, but I really wanted to play a game with you called Sleeping Ponies. Maybe we can catch up later and we can play that. Or you can play it for five seconds where you all close your eyes really fast and just fall asleep And then you wake up at the gong.

Speaker 8

I feel so relaxed now.

Speaker 1

Sleeping ponies is the best game.

Speaker 8

Yeah. So next we'll have Ilya talking with to us about meta programming. But while Ilya gets set up, I wonder, Katie, do you have any never have I ever I haven't ever have I ever.

Speaker 1

Never have I ever forgotten to rerun migrations.

Speaker 8

Yeah.

Speaker 1

Yes.

Speaker 8

Ooh, I have one. Never have I ever written a custom migration that just totally did not work and screwed everything up.

Speaker 1

Never have I ever tried to run make migrations on an older version of Django and wondered why it didn't work because I was running it when South was a thing before make migrations was a thing and I'm wondering what's wrong and.

Speaker 8

Those were the days, weren't they? Thank you, Andrew. Alright, I think we're ready to go.

Speaker 1

Woo! Go So

40:45 JetBrains MPS and Projectional Editing

Speaker 6

hi, my name is Ilja and I want to show you the Meta

Speaker 8

programming system. Who of you heard of the Meta programming system? Yeah, a few hands up. I'm pretty sure that you heard of the company which builds this system, JetBrains. And JetBrains is building who saf, right? So what is MPS? MPS is a language workbench, so you can create new languages, domain-specific languages, or new programming languages, and it has a projective editor. So what is a projective editor? A projective editor is something different than the traditional editor. So the traditional editor you have a file, your Python file, it's a text file, it's stored in the file system. If you open this file It gets parsed and converted to an abstract syntax tree, so a tree representation. If you added this file, this tree is regenerated.

This tree is needed for code completion, for syntax highlighting, and so on. A projectional editor takes this abstract syntax tree as the core element, as a single source of truth, and stores it

Speaker 7

on the file

Speaker 8

system. And what you can do now is define multiple editors which can be used for editing this tree. So these are projections and I want to show this in a demo So I hope it's not too small. It's a proj okay, I hope you see it. So this is a Java based programming language is a port for MPS and we are the DjangoCon, right? So I want to show you what it means to have a projection, not a real text. So I can say here I'm a Python developer, please remove all the braces And the left code will be converted in a more Pythonic representation.

And it's still working, so if I go here and say I want to return something else like example. Pattern it's still working. And the cool thing is that now I don't like this name of this class And I can rename the class without using a r rename refactoring because I'm actually referencing a note in their AC. It's not text anymore. So I can type something like configuration helper provider impuls so it looks more like Java right and you see all references are renamed on the fly in the top of the code we have this new keyword.

Maybe you knew it from Java, and I don't like this, I forgot to remove it. And down here we have the editor component for this statement. And it's just a templating language, so I can just remove this new canver new

Speaker 7

new keyword.

Speaker 8

And if I find the button, rebuild the project

Speaker 7

and it's gone.

Speaker 8

So and we can look at the generated source code

Speaker 7

so

Speaker 8

we like generate Java code out of it and you see it on the right so it's still normal Java

Speaker 7

So, what I can do with this?

Speaker 8

Actually, I can use formulas in my code

Speaker 7

and edit these formulas. I can use diagrams and edit these diagrams and it will be actual valid code. I can put date pickers into my code and maybe a selection for time zones.

Speaker 8

Or I can represent diagrams and do calculation, live calculation like you maybe know from Xcode Playground So

Speaker 7

it's quite a nice tool, download it, try it out. Yeah, thank you.

Speaker 1

Thank you for that. That was cool. We only have one more.

Speaker 8

Yes, this is our last one. Raphael is going to talk to us about saving ponies by reducing the resource consumption of our Django servers.

Speaker 1

Ooh, a Django talk. That seems relevant.

Speaker 8

It does. It does.

Speaker 1

One more never have I ever?

Speaker 8

Never have I ever accidentally CC'd instead of instead of BCC'd more than a hundred people. A few of you, alright. I think I think maybe more of you were lying.

Speaker 1

Never have I ever used the wrong emoji.

Speaker 8

Oh gosh.

Speaker 1

There you go.

Speaker 8

Alright, Raphael take it away. Woo

45:20 Reducing Django Resource Consumption

Speaker 6

Hello. So I tried to speak a bit slower than my previous talk at the Django Khan. Some people still remember it, I'm sorry. I'm going to be talking about how you could reduce the resource consumptions of your Django project. So why would you be interested in that? So that's

Speaker 8

that came from me for our program in the office. So we are running a car-sharing system in Paris. And well

Speaker 6

it's it's a bit big that project. It's it's now seven years old, we have 300 models. So manage. py run server takes 12 SIGMS to complete before accepting any request.

Speaker 8

And we thought, yeah, it's not that good. So we had some benchmark. The default setting with micro WISG said yeah startup 13 tickets memory consumption 900 megabytes on our production

Speaker 6

servers And when the first query arrives, we still need 3. 7 seconds to answer 200 okay. Just an empty response on our warm-up test endpoint. Not very good Why does that happen? How does Django and MicroWhiskey work together? Well first MicroWisky starts in its default configuration and it prepares its worker processes and then it starts accepting requests from your load balancer When the first request arrives, the work process actually starts, loads an event loads your WISGI. py file, which loads Django, Jenga und also

requests Then you handle more requests and at some point your worker dies because too many requests handled or too much memory construction or whichever settings you have decided to set. It is recycled and we go back to step

Speaker 8

Q

Speaker 6

and an important thing is the default microWisky configuration. It starts in what is called lazy

Speaker 8

mode.

Speaker 6

What does it mean? It's It will load your

Speaker 8

WisDip.

Speaker 6

py

Speaker 8

file in each worker process instead of the master. It

Speaker 6

does make sense on a custom local deployment where you have lots of small applications, not much load, and so it avoids over consuming resources. for request what might not come you might get one or two requests per hour.

Speaker 8

Well

Speaker 6

in forecation it's not gonna happen. So I set out an experiment and I decided to disable

Speaker 8

it.

Speaker 6

What happened?

Speaker 8

Well Wow, started time? Yeah, not that good. We saved a bit of memory, not much.

Speaker 6

But the first query handled by our worker went much cl much sooner. Why is that? Well, the main difference is that now microWizGi will load W your Whiskey. py file. first thing then forks its processes then the worker loads Django and once that worker is said ready MicroWiski accepts the requests. So we've moved some of our loading time in the master MicroWISG loading time instead of the worker. And since we recycle worker in our standard process lifecycle cy cycle we save time on every loading of our requests. But it

it didn't feel good enough. So

Speaker 8

we decided to make a small change and to actually load the whole Django code base

Speaker 6

before forking processes. I explained why in afterwards So basically we just changed our getWhizGee application and called a small function we determed which says warm-up Django. And it what it does is basically create a fake request And just executes it in Django 's standard system. Small tip we have to close connections afterwards because here we are not exactly firing the proper Jenga signals, it was a bit of a hack. So And what we wanted. Okay, so global startup time nine seconds, memory usage way lower, and first query same time approximately. Why that change? Well basically

here at step two we now load the whole WizGee application which means that all the Django code, all your models In memory presentation, your URL comf everything required to handle your query requests is loaded before the processes are forked and thus the memory is shared between your master process and each child. Even for recycled workers, so you consume suddenly much less memory and your infrastructure team is very happy That's it. Think of the ponies.