Lightning Talks
Transcript
By Speaker 1, Speaker 2, Speaker 3, Speaker 4, Speaker 5, Jon Gould, Speaker 7. From Django Day Copenhagen 2022. Published April 27, 2022.
Watch the video Markdown version 3,536 words · auto-generated · en
Transcript
Automatically transcribed, so expect mistakes in names and technical terms. Filler words are removed.
0:00 Unit Testing Decorated Functions
Speaker 1
So yeah, hello again. So this like talk it's okay? Yeah, so hello again. So this like talk is more or less ask for helping. Let's suppose that and also the way that I do this kind of test. Let's suppose that you have creating a decorator for your function, like that F. And that decorator is still in your my code, and I have applied the decorator on that function that just returns one. And if I want to unity test the function Y, then I cannot Getting a proper answer because the accession is wrong. The function is returned your code is mine because the decorator stole the execution the execution flow and
yeah and you are doing wrong things and I'm forcing this error okay and yeah but if you want unity test that that that function why then it's hard it's start to things start to get harder Of course, you can create in a second function that Y is gonna wrap up that second function, but that's not a beautiful code. And yeah. And up the second approach if you go to the documentation, what the Python community says that use a function to wraps. So you can properly create an a decorator function. And again, if you run this function, boom. Is not working properly because that's not enough to create a proper decorator and afterwards having a unity test.
The way that I do is I'm creating an unwrap function. And yeah, I decorate my function and now I'm gonna unwrap my function and then I'm gonna test it And then boom. That means that everything went fine. That's the way that I do a unit test on decorated functions. I've created a UTUs that's gonna unwrap the function. Pay attention that And that's a recursive function. They'll unwrap. That's gonna kinda peeling. It's gonna remove all the layers that have been applied to the function that I would like to test. Then I I'm able to unit test my function without creating a secondary function and
without creating that much mess on my code. That's the way that I do And I don't know if that's the most efficient way to do it. If you know a better way to unit test decorated functions. then I would love to hear from you guys but otherwise that's the that's the way and is that works fine yeah that's what I would like to say
Speaker 2
Yes, please unplug and unplug yourself, you do Mine I think we need to download the PDF maybe. Can I just download it? Come on, Google.
Speaker 3
Yes. No, okay, both. One, two, one, two , baby. Yes.
Speaker 2
Very much. Sometimes it's not fun to be here.
4:30 Comparing Version Numbers
Speaker 3
One, two, one, two. That's good. Awesome Alright, we need to go fast. I came up with this dog with procrastinating for the actual dog. Last fall, we got something wonderful, Python 3. 10. I saw this tweet by Leah about things breaking because there's double digits in the minor. Team Yates replied, he used to use this as an interview question. And that got me thinking, how far would I get if I was asked this? I would start with semantic versioning. I've heard about it. It's simple. You basically have x dot y dot z For comparing you don't need to know what they mean, but
there's the major version, like backwards breaking changes, minor, backwards compatible features, Jet is a batch And you call them one by one. Once you get the smaller one, that's when they differ. So I would write a quick piece of Python code. Feel really good about myself. Takes me a couple of minutes. Yes. I got the job, awesome. And then the interviewer is, is that all? And I'm like, is there something else? So then I sat for a beer. I did some googling. I learned that. There's also pre-release and build info. So it looks like this. You have optional pre-release
with dash and then a plus sign and optional build stuff The pre-release is taken into account the built-in for node. Anders was supposed to be a giv, but essentially this is a rex that parses semantic versioning. Once again, I wrapped this up in an interview. Job done. Awesome. Turns out not everybody uses semantic versioning. For example, Burl uses two different versions of systems. There's one that looks like 1. 2, meaning 1 and 15. And the other one is an integer separated by dots. So 1. 2 has in 1 and 2.
In the first one, 1. 1 and 1. 10 are the same because it's a decimal number. In the other one, they're not. So awesome. And sometimes you have underscores. I don't know why. For us in the Byton world, we have the simple bib. 44 or you can find this is what it looks in Python. Really simple, easy stuff, easy to remember in an interview. Something like Ubuntu uses calendar versioning Where the version number is basically when it happened. So twinny dot go for the three. And Then there's something called idiosyncratic version numbering that Lottech uses. They just have the digits of
boy. And with every new version, they just add the digit. Because why not? How about Windows? Okay. Officially not the version number, but more of a branding. But I'm sure somebody has done this for like actual versions. Funny story, I think Windows 7 was actually version 6. Because you know, good. So did we learn anything from this thought exercise? First of all If you get this question in a job interview, you know, bring up the complexity, show that you understand that not everybody uses the same system. And then ask for a spec so that you can solve just one of those things.
Because I don't think you can write a script that solves all of them. And if you have to do this in real life, well, I just hope that you only need to do it within one of the specs and not universally. Thank you. I don't think
Speaker 4
we have any trouble for Windows. Seriously. Windows.
Speaker 2
Mm -hmm. Funny. Yeah, switch bell off All right. Whenever you're ready.
9:20 Wagtail Localization
Speaker 5
Yes. Yeah, and you can hear me. That is great. So I'm gonna talk about something that I'm not an expert in, but something that got me really excited recently. I'm already using Wagtail and just wanna See here. Yes, that's how the first slide was. I want to talk about translation in Wagtail and just to give you a brief recap of how it was before Wagtail introduced a new like extend extension for localization called Wagtail Localize. It was very complicated to do translation and it's complicated because We have two different scenarios that we kind of want to mix and then we don't have any real workflow support for the translators.
And then it's it's it's hard to really include translators in our process of translating because it's so technical. But that's before. Now I would say that it's getting much more easy. The scenario to me looks intuitive. It has real workflow support for doing the translations into many different languages and the interfaces is tasty. So Wagtail is not a normal CMS. I could say some more about that, but I'm a bit afraid of the time. But you know how like WordPress everything is just like one. big pile of data, even WordPress itself is like a zip file that installs on top of another zip file. And that makes it very complicated to manage WordPress.
And that's why I love Wagtail and I see it as a complete game changer for making websites that that work great. And the wonderful people at the Torchbox has then come up with a new way to do this translation stuff. So there are two different types of translation scenarios that we use to mix. And it's good to be aware of them. One of them is like often called one-to-one. So we have like, for instance, one web page in a language and we will have that web page in all the languages. So that's a one-to-one. But that can also be a product in a shop that needs to be sold no matter what language the shop is in. But then we also have deviations, so we can talk about int independent concentries. And It can look a bit like this for the for the one-to-one.
No matter which language we look at, we want to see the same product database. And that will show us translations of each of the product for each of the languages And then we can have these independent concentries where we say if we are on the English one, we can have a page that's only visible for English version, and then we can have some other pages that maybe we have on all the languages, but we kind of just do that manually and then we can try to mix them and that's where it gets really complicated and confusing for the translators so incomes web tail localize And what Wagtail Localize first of all does is it makes it possible via the Wagtail interface to simply add a new language.
And you can say that the new language should be automatically synchronized from another existing source language. So that means that if you create a page in English, if that's the source language, it should automatically be copied to other languages and ready for translation. So that's the example here. We choose English. And then every time a new English page pops up, it will also, or product or any other kind of database item managed by Wagtail. So then it will look like this afterwards. We can you can just see it says English there and French there. So we have like different routes of the website that we can navigate and do the translations or add new unique pages because that's how you can now mix it without worrying about the different scenarios
When you want to translate, that's where the workflow comes in. One way of doing it is to simply mark a page. One minute left that you want to translate and then go into the translation flow And then you can select what language you want to translate to. And then you get the fields that are marked for translation with their source. And then you can type something in. And this is for the translator to work with. So this is super nice. You can also download PO files that you can upload into the cloud, maybe if you have machine translation. And then it comes with this nice workflow. Where you can have an overview of the things that are being translated. And that's really the end but there is most of
there's a nice tutorial available on wagtailocalize. org. I recommend starting there. And then Wagtail has a really good overview on their website of what the new localization framework does.
Speaker 2
Yeah, you're best. If you're ready? Bella, can you pass on the microphone to us? Yes. Please.
Jon Gould
Maybe you know it better than me. Is
Speaker 2
that alright?
Jon Gould
Yeah, it's fine. I'm just gonna click through here.
15:04 Planning a Job Search
Speaker 2
Yeah.
Jon Gould
Yeah. Soundworking. Yeah. Okay. Don't stop my timer yet. Thank you everyone. Just a quick lightning talk. Wrote this earlier on, haven't run through it, so hopefully we're yeah, we'll be within the five minutes today. I'm John, I'm the director of Foxy Talent, which is a recruitment company I set up last year. I have worked within recruitment for 14 years, specifically within the Python and Django world. I've been involved in communities and meetups in recru the UK. It's my first event overseas, so thank you very much for having me. Yeah, I'm going to try and skip through some of these because quite a lot on there. Right. Talking about the job search.
I think One of the key things when you're embarking on a job search is to actually understand why you are going there. Is there something that you're trying to get away from in your current company or is there something that you're not getting the fulfillment for that you want to go towards? Is there a something that can change within your current company that would help which would make you want to stay in the end anyway. So Why not address that up front? If you are thinking that it's something that's going towards, it's why? Again, what sector? Why do you want to go and work in tech for good, health tech, renewable energy? Is there a tech stack? Do you want to work in community projects, open source projects? Is that something you can't get an itch from in your current employer? Don't worry about the next bit. Writing
your CV. I think once you've understood your why about what you're looking for and when you're trying to make your move, that's where you write into your summary about you what you want to put in front of your potential employer, your future, put some skills in there, cover off your employment. And then in I think importantly, especially for everybody here If you're writing a CV in the next year, put that you've been at this event. If you've spoken here, put that you've spoken at the event. If you contribute to anything open source, link it. This is the part of a CV that people really look at. In your search, first thing is you work with colleagues who work with your technology. Somebody you know will have had a job search recently. They'll have met a company that they like
that they didn't get an offer from. Speak to them, find out, you know, who's hiring, who should I be speaking to. Again, research it if there's an industry or sector you specifically want to work in. Go and research companies who do that. There's some great resources where you can find out Websites that are built with Django, search there. If you like the website, look at the careers page. If there's nothing there, find the CTO online, message him, say you like the website and you want to join them. Speak to a trusted recruiter. I only know about the UK. So yeah, you find somebody who knows your area if you're looking to for a new job. Once you make an application, follow up. Don't just be a CV in an inbox. Make sure you make people aware that you're actually genuinely interested and there's a reason why you applied.
Throughout your process, don't take on too many applications. At the moment, with the volume of companies that are hiring and maybe a lower volume of active candidates, you will be getting invited in for interviews pretty much every time you put your CV in front of somebody. So you could easily be very overwhelmed very quickly. So just be a bit cautious about what you're doing. Take on maybe no more than two, three applications at any one time. So you can really focus on those. Complete your first stages, reflect back versus your why at the very beginning. Are you getting the ticks and the boxes that you created? Set time aside during the final interviews, answer all your questions, and then at the end reflect again, have I had my why answered
Am I getting what I wanted to get from the search? If you're in a lucky position where you've got multiple offers, great. Reflect on your why. I think that's a key thing I'm saying. Distract yourself and really like what was what's mentioned earlier if you've got a hard decision to make. Is that the whole thing One minute. Good. Distract yourself, go for a walk, play something, distract yourself. I enjoy when I've making decisions I'll go and play around a golf and it will just something will happen. That's my thing. Are you making a decision versus your head versus your heart? When you come to resign, it's not nothing that anyone likes, but you can get advice on this. And then if you're gonna get a counteroffer because it's hard to hire talent, people will want to keep
the talent they've got, reflect on your why. Are you moving away because of something? Are you moving away towards something? Yeah, make your decision and hopefully you're there. But worst case, just If you need any help, any advice, just ask somebody who knows this world and can be impartial and play devil's advocate and maybe ask you the question you didn't want to ask yourself. Yeah, there we go. Hopefully. That is it. This is me. If you want to get in touch, I'm on Twitter. I've been commenting all day. And there as well.
Do you have full screen for
Speaker 2
This is as good as you get, I'm sorry.
21:53 PyCon Italia
Speaker 7
It's working. Yeah. Okay. So time started now. Okay. I wanted to add a slide for the presentation this morning and I was Not ready to do the so I want to ask for your help because I want to try to help the organizing of ByCon Italia, the conference. but in the last two years was impossible to have this conference so I'm not a person that already organized conference. So now I'm talking to you about Pygonitalia and inviting you to join us. This is the website
and we are organizing a lot of things Sorry and not table.
Speaker 2
Yeah, we tell away.
Speaker 7
Yeah, we have also prepared this is the last two. The last edition in 2019, I think. Hotel we organized the conference in Florence and it's very close to the Arnold River and every year since ten years I think we organized the same place because it's good to have a week after the conference and Florence to have a beer or whatever that's the European original from Florence and we organize a lot of social events and to look during the
conference to this some of the participants and the guy with the yeah girls with the yellow Two shirt are the organizer and now we are trying to complete all this all these things we have to do. Okay, we invited a lot of interesting keynoters here. Maybe you know some of them. We tried very hard to concentrate on in diversity in talk in keynotes and we also have a very good program We this is the schedule.
We have first day two of June. It's a beginner day for all people that want to join that don't know about Python or Django is similar and want to learn and also for people that want to help people learning about the this stuff and then we have three day of talk with various track from various community and we have the keynotes and at the end of the day usually we have in this case pie drinks usually we go out for beer and the next day we have also other keynotes and talk with also workshop training there
And we have Pi Fiorentina, as I said before. And the last day we have Sunday also a track for Django Girls. And we are searching for coach to join us and help to organize this workshop and we also have the sorry And we also are organizing some panel about web and diversity. And for the first time this year, we also have a garden. Because it's June it's very hot, so we have a garden. We organise some tracks and talks about Green and climate
change and similar stuff So I invite you to join us that we are still have some tickets and traveling for different conference it's very good I can assure you to you because being here is great and Every time it's very welcoming and I want to encourage you to do the same things. Participate on your local conference, but try to travel and meet people in other country and if you want you can start from Italy in June. Bang on Italia