Brought to you by Michael and Brian - take a Talk Python course or get Brian's pytest book


« Return to show page

Transcript for Episode #27:
The PyCon 2017 recap and functional Python

Recorded on Tuesday, May 23, 2017.

00:00 Michael KENNEDY: Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your ear buds. This is one of your hosts, Michael Kennedy.

00:00 Brian OKKEN: And this is Brian Okken.

00:00 KENNEDY: We're here with our first post-PyCon episode. So, Brian, let's just jump straight into it. How was PyCon for you?

00:00 OKKEN: I want to bring up that right away because it was incredible. It is the first one I've been to and I got to say it was even more than I expected. Hard to put in words. We hung out, we had a booth there. Thanks to everybody that showed up to say, “Hi,” apologies to anybody that stopped by and we weren't around at the time. Michael, you were pretty good about hanging out and talking with everybody.

00:00 KENNEDY: Yeah, I went deep into the hallway track, which I mostly ended up spending time at the booth, having conversations with people or at other people's booth talking to them, or something to that effect. That's the real value of PyCon to me. I think the talks are amazing and I really enjoy the key notes and things like that, but the open spaces and these impromptu meetings, that's where it's at for me with PyCon.

00:00 OKKEN: Yeah, actually the open space, that's something I didn't really do much and I think that I’ll have to make sure to do that more next time. They put up – for anybody that hasn’t gone – they put up these boards with just like a whole bunch of empty rooms and you can just sign up for a time slot and if you get it, you have it. They start out fresh each morning, so people just hang out and do things. It's not just all testing related or, not testing related, Python-related, sometimes they do things like tie knots and stuff like that.

00:00 KENNEDY: Yeah, one thing that I went to was, “How to Start a Business,” one that I went to was, “How to Market Yourself as a Developer.” Then I actually ran two; one was a Python Podcaster Meet-up. That was really cool. A bunch of people came. Thanks to everyone who came. Then one on “Out of the Box Ideas for Improving the Diversity of Funding for PyPI.” So, that something that will be coming out later that requires some write up.

00:00 OKKEN: Wow, that’s cool.

00:00 For my benefit as well as the people of listening, I’m going to put a link to the YouTube channel with all of the the talks. Unfortunately, all these like open spaces and stuff aren’t recorded, but one of the things that also I wanted to bring up was that I was surprised how much I enjoyed the lightning talks. I think it's neat to have a full range of people that are really great at speaking and people that they're new to it as well.

00:00 KENNEDY: Yeah, if you want to try your hand at public speaking and you’re new, 5 minutes is not too tough. Although, it's a big audience, it's only 5 minutes.

00:00 OKKEN: Lastly, I wanted to say it's amazing how many people know Michael. (Laughs) Man.

00:00 KENNEDY: I also find this amazing. It's entirely humbly. You know, it was amazing.

00:00 OKKEN: Yeah, okay. Well, let's move on.

00:00 KENNEDY: Awesome, okay. So, keeping in the current, latest state-of-the-art like we talked about with many, many things at PyCon, we recently heard that AWS Lambda – which has nothing do with Python Lambda, as it’s just the server-less computing offering from AWS – has started supporting Python 3.6. Someone else who was there at the conference was Matt Makai from Full Stack Python. He put together this little, quick tutorial on just how can you quickly set up an AWS Lambda Python 3.6 function and do some interesting things, like read from the environment variables and things like that to create this little app.

00:00 OKKEN: Nice.

00:00 KENNEDY: Yeah, so basically if you can write a function, like a single function, then you can pretty much write and deploy these AWS Lambda functions. Which if you have something kind of like a micro-service, micro-architecture-type thing, then maybe it makes a lot of sense to do it, these AWS Lambdas. I’m actually going to have a guy tomorrow, a guy named Ryan, come and talk about server-less computing in general on Talk Python. But here's a little precursor, if people want to check this out.

00:00 OKKEN: That’s cool. I’ll be looking forward to listening to that. I was just curious on the Lambda, do you know if the functions you put in there have to have names?

00:00 KENNEDY: They have names, but you basically map them to in points that you can set up. There's all sorts of events they maybe are not even public, in terms of HTTP. They might not be web service in points, it's basically event driven. For example, you can say, ‘I would like this function here,’ whatever you name it, it’s kind of irrelevant, but you have to pick the name, right? ‘I would like this function here to execute when somebody uploads a file to this sub-folder, this bucket in S3.’ So, maybe you're going to do, let's say a video delivery service for a training or something. When you upload a new video, you might want to create an adaptive stream, like a low bandwidth, a high bandwidth version, different formats like MP4 versus WebM, or something like that. You could detect when a file is dropped there and automatically by effectively just uploaded S3, have this code manage and juggle all that in the background and you don't ever have to do anything. So, you can set up these cool event-triggered things, but it could just be a simple as like, ‘Here's a HTTP in point.’

00:00 OKKEN: I’ll have to try that out.

00:00 KENNEDY: One of the things I talked about at the conference was PyPI and the Python Packaging Authority and so on. That was real funding, but one of the reasons they have such a challenge with their infrastructure is because they have so many packages, right?

00:00 OKKEN: Yes, and so you should put some more out there, everybody.

00:00 KENNEDY: Yes, everybody. Let's make more. Let's do more of that.

00:00 OKKEN: There is a pretty good JetBrains article called, “How to Publish Your Package on PyPI.” I think it does a really good job on talking about what all you have to put it into your package. The structuring is pretty good, although I'd like to see them include the source directory in the article, but one of the things I liked was just a discussion of what all the contents of the setup.py file, all the stuff that you got to put in there, your license, your email. I guess it's all pretty obvious, but when you just see it all in an example set up, it can be a little overwhelming, but it's really the minimum amount of stuff you put in there it's just not that complicated to put in there. I also liked that they, I hadn't seen a decent example recently of what you ought to put in your .pyirc file, so I guess it's like a config file so that you can talk to PyPI easily.

00:00 KENNEDY: I think you can put your account information in so you don't have to login every time and stuff like that, right?

00:00 OKKEN: Yeah, and then they talked about using twine to push both to the test repository, I guess, and and then the actual one. That's something that people ought to do also. If you just want to try this out but you don't have a package that you're ready to actually put out there to the world yet, you can use their test server and push things up and try it out.

00:00 KENNEDY: Yeah, definitely make use of the test server. What surprised me is actually how easy it is to put something on PyPI. I found most of the difficulties that I ran into when I did this were actually around packaging itself, just purely packaging, and once you have that solved, it wasn't too bad.

00:00 OKKEN: I actually encourage people to just come up with something and try it out. I have to drink my own Kool-Aid with this one. I still haven’t put anything out there. I’ve got to put a couple of things up there.

00:00 KENNEDY: Yeah, maybe after you're done writing your book, huh.

00:00 OKKEN: Yeah, actually there's a lot of quite a few pytest plug-ins that I’d like to write and put up there.

00:00 KENNEDY: Oh, yeah. That'd be a good set. That’d be awesome.

00:00 OKKEN: Speaking of pythons, pythons live the same place where we there are coconuts, right? (Laughs)

00:00 KENNEDY: (Laughs)So, the next thing that we're going to talk about is called Coconut and there is a tie-in to Python. But you got to go back to the origins, back to Monty Python.

00:00 OKKEN: Oh, right, okay.

00:00 KENNEDY: You know those nights that run around and they've got those coconuts they click together because they don't actually have horses but it sounds like the galloping, basically.

00:00 OKKEN: We should have had some for the show.

00:00 KENNEDY: We should have brought some to PyCon, and just run around with them. (Laughs) Next year, we know what to bring to Ohio.

00:00 Okay, so the next thing I want to talk about is a Pythonic functional programming language. Now, functional programming, you know some people are really into it. Some people kind of stay away from it. To me, it's one of those languages where it's kind of like a good puzzle more than, I don't know, like building blocks. It's more like this thing you have to sort of, you write a little bit of code and then you think about it for a long time, deeply, and then you write two more characters and you're done, or something like this. It's very concise and very interesting to write, basically, functional programming. There's many options, there have been for a long time, Scheme, Haskell, whatever. F# (sharp), Erlang, you name it. But as Python programmers, we have all of our awesome PyPI packages, just as we talked about, and we may have some more after this session.

00:00 So, we have all of those and then we maybe have existing Python code, so Coconut is a functional programming language that is deeply functional and unique, but is a super set of Python, Python 3, specifically. So, what that means is, you can take a given existing Python 3 code and go in rewrite one function or one algorithm, functionally rather than imperatively. And you can use all the PyPI packages because it's just Python.

00:00 OKKEN: So, you can gradually add functional programming to an existing application or something.

00:00 KENNEDY: Right, you wouldn’t have to start over. You have to learn the functional programming concepts where they apply, but you don't have use them all the time. You can just use them where they make sense.

00:00 So, there's all kinds of unique things for Coconut. There's pattern matching, which I'll tell you what that is in a minute, because that's wild. There's, basically, algebraic data types which are immutable data types. Think any time you see a class, replace the word class with data and that becomes immutable, but there's some other cool stuff that happens. Really interesting parallelization operations, because once you have immutable data types, many of the problems that you saw with parallelizing them, these algorithms become what is called embarrassingly parallel, embarrassingly parallelizable, right. If there's no real interaction because everything’s read-only, well, just let it roll. Just fork it out and give the pieces to the little subprocesses or something.

00:00 So, there's a lot of cool stuff but just to give you a sense, I'll tell you about the pattern matching. Suppose I want to write a recursive function or let's just say a function that implements like say, factorial, that's their example they have. You would have a function, it would take a number, it would have a test, it would say, ‘If this number is zero, then return 1. Otherwise, do some multiplication stuff with the current number of plus times the factorial of N-1, something like that.’ And you would do this kind of recursion thing. So, you have these ‘if’ statements for different situations in your function. In Coconut, you can define one function for the degenerative case, and another function for a different situation. For example, your parameters can say, ‘I would like to take an N, but only if the N is an integer and it's greater than zero.’

00:00 OKKEN: Huh, wacky.

00:00 KENNEDY: It's kind of like a method overloading and say C++, C# (sharp), Java, where it might match by type, or type + number of parameters. It does that, but by ‘if’ statement. It’s crazy. It's pretty mind-bending. People, check it out. There's a cool tutorial, it's just pip install Coconut, so easy to get started with. It's definitely worth looking at because it will make you think a little differently, which is always good.

00:00 OKKEN: Well, thanks. I guess I'm just going to go back to packaging again. But one of the things that I have had trouble with is understanding all the open source licenses. I guess I got into open source a little bit when everybody was afraid of the GPL (General Public License), especially in the corporate circles and now I just knew that MIT (Massachusetts Institute of Technology) was not as freaky, I guess.

00:00 KENNEDY: MIT is like super simple and permissive, if you want to use it but it is hard to decide. For these more permissive licenses, for me, it's hard to decide. What if I want some restrictions, right? Like, what kind of offer is useful to people, but it has the kind of protections I would like to have in this code, right?

00:00 OKKEN: Plus, if you start reading it into, it there's a bunch of legalese that my eyes glaze over. So, I ran across a site called choosealicense.com and it's pretty darn cool. It talks about MIT and Apache and GPL, but it also has a cool list of a whole bunch of different licenses and has some color-coded bullets for what you are getting with those and what you're giving up and what rights you keep and all that. I like it. It's good.

00:00 KENNEDY: Very nice. We even have the unlicensed covered there, which is pretty cool.

00:00 OKKEN: Then also, a comment about ‘You don't have to.’ You don't actually have to pick a license if you don't want to. There's nobody forcing you to.

00:00 KENNEDY: Yeah, in which case you pretty much just retain the copyright. There’s somewhat of a problem with that on GitHub, I believe. There's a number of what are meant to be open source projects on GitHub, that just whover created the repo, didn't do the little drop down and say, ‘Yes, pick a license and choose one.’ So, there's the stuff that looks like public open source because it's publicly accessible and it's on GitHub, and you can clone it and do stuff but there is technically no license, so it's not really open source, which is kind of interesting.

00:00 OKKEN: I guess one of the reasons why I picked up on this is because I'm trying to teach people to use simple setup files so that you can make a package pip install-able, even locally. In one of the requirements is you have to fill something in for the license, so you may as well think about it a little bit ahead of time so you can throw it in there.

00:00 KENNEDY: Absolutely, it's a good idea.

00:00 Alright, let's round it out with something free for people. A free book. So, there's a book called Python for Scientists and Engineers, and I think this was not free before, but now just became free. So, this is a book if you are getting into using a python for science or machine learning or natural language processing, all these are things, there's a bunch of examples of using it there. Just to give you a sense, there's some introductory stuff and then they've got Image and Video Processing in Python, Data Analysis with Pandas, Audio and Digital Signal Processing (DSP). Of course, you’ve got to Control your Raspberry Pi with Python, because who wouldn't want that. A couple of things on Machine Learning, like building an Amazon-like Recommendation Engine and then a bunch of stuff on Natural Language Processing and Analysis and looking for spam; you know, basically text processing type things.

00:00 So, if learning about those things and dabbling in those things sounds interesting, here's a book with a bunch of applied chapters.

00:00 OKKEN: Nice. There’s lots of cool stuff in there.

00:00 KENNEDY: There’s all these cool things that I would love to know and would love to learn, and have no no applicable use for in my world. You know, like I would love to build a machine learning, sort of something, but I have nothing to turn machine learning loose on right now.

00:00 OKKEN: Yeah, one of the things that I noticed in here is the Audio and Digital Signal Processing section. I think that's pretty cool because it's been pretty hard to get into DSP stuff before Python and some of the engineering tools that came about with Python made it a lot easier, so that's pretty neat.

00:00 KENNEDY: So, that's our news for this week. I don't know about your podcast, but mine is definitely going to be abuzz with lots of stuff that we learned at PyCon, so I want to loop it back to the very first thing that you covered. Be sure to go check out those videos. I don't know how many there are, but it's like a hundred presentations, it's crazy, and there's so many good ones.

00:00 OKKEN: Actually, I'm not watching them while driving, but I'm listening to them while driving and then just knowing to get back to the slides later if I want to see that.

00:00 KENNEDY: Yeah, and a lot of those talks, I think you can get like 80% just in audio and it's probably good enough because you might not watch it all, but you're stuck in traffic so why not.

00:00 OKKEN: Definitely.

00:00 KENNEDY: Right on. So, how's the book? I saw a great giant like, floor to head height banner of the book, but what's that mean for the rest of us?

00:00 OKKEN: It was a nice timing. It was hard to get it out, but we got the beta out, available. It's not available in hardback yet, but Python Testing with Pytest is available within a beta. So, the first 5 chapters are ready and the first 5 chapters cover just about everything you need to know. The only thing that's left to wrap up in the last couple of chapters is the configuration files like the INI and stuff like that. And then the last chapter is going to be using pytest with other tools like with Selenium and with continuous integration. These are definitely meaty, nice things, but they are not things that are necessary to get learning. And I have already had one of the comments from Twitter. Somebody bought it and said, ‘Wow, this is like the best thing to learn pytest.’ So, that was good.

00:00 KENNEDY: That’s got to make you feel good after like months and months and months of working in isolation.

00:00 OKKEN: Yeah, definitely. Also, just it has been an incredible experience working with an editor too. It's been good.

00:00 KENNEDY: Yeah, I'm sure it has. Awesome. Alright, well, we will have a link at the bottom of the show notes, so if people want to check it out, they can totally do that.

00:00 Well, that's it for this week. Brian, as always, thank you. It was great to hang out with you at PyCon and once again, thanks everyone who stopped by. We met so many people, it was really amazing.

00:00 OKKEN: Incredible, thanks.

00:00 KENNEDY: Thank you for listening to Python Bytes. Follow the show on Twitter via @pythonbytes and get the full show notes at pythonbytes.fm. If you have a news item you want featured, just visit pythonbyes.fm and send it our way. We’re always on the lookout for sharing something cool. On behalf of myself and Brian Okken, this is Michael Kennedy. Thank you for listening and sharing this podcast with your friends and colleagues.

Back to show page