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


Transcript #27: The PyCon 2017 recap and functional Python

Return to episode page view on github
Recorded on Tuesday, May 23, 2017.

00:00 Hello and welcome to Python Bytes where we deliver Python news and headlines directly to your earbuds.

00:06 This is one of your hosts Michael Kennedy, and this is Brian Okken, and we're here with our first post PyCon episode. So Brian, let's just jump straight into it. How was PyCon for you?

00:19 Yeah, I wanted to bring up that right away because it was incredible. It's the first one I've been to and I gotta say it was it was even more than I expected.

00:28 Hard to put in word 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. But Michael you were pretty good about hanging out and Talking with everybody. Yeah, I went deep into the hallway track. Yeah Yeah, I mostly ended up spending time at the booth having conversation with people or at other people's booth talking to them or or something to that effect.

00:55 That's the real value of PyCon to me.

00:58 I think the talks are amazing, and I really enjoy the keynotes and things like that.

01:03 But the open spaces and these impromptu meetings, that's where it's at for me with PyCon.

01:10 Yeah, actually, the open spaces, that's something I didn't really do much.

01:13 And I think that I'll have to make sure to do that more next time.

01:18 They put up those-- 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.

01:27 And if you get it, you have it.

01:29 They start out fresh each morning.

01:31 So people just hang out and do things.

01:34 And it's not just all testing related or not testing related, Python related.

01:38 Sometimes they do things like tie knots and stuff like that.

01:43 Yeah.

01:44 One thing that I went to was how to start a business.

01:46 that I went to was how to market yourself as a developer.

01:50 And then I actually ran two.

01:52 One was like a Python podcaster meetup.

01:54 That was really cool.

01:55 Bunch of people came.

01:56 Thanks to everyone who came.

01:58 And then one on out-of-the-box ideas for improving the diversity of funding for PyPI.

02:05 So that's something that'll be coming out later.

02:07 That requires some write-up.

02:09 Oh, that's cool.

02:09 Yeah.

02:10 For my benefit as well as the people listening, I'm going to put a link to the YouTube channel with all of the talks.

02:18 Unfortunately, all these like open spaces and stuff aren't recorded.

02:22 But one of the things that also I wanted to bring up was that I was surprised how much I enjoyed the lightning talks.

02:30 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.

02:38 - Yeah, it's pretty, if you want to try your hand at public speaking and you're new, like five minutes is not too tough.

02:44 Although it's a big audience, it's only five minutes.

02:47 - Yeah, okay.

02:48 And yeah, lastly, I wanted to say it's amazing how many people know Michael.

02:54 (both laughing)

02:56 - I also find this amazing.

02:57 It's like entirely humbling and it was amazing.

03:00 - Yeah, okay.

03:02 Well, let's move on.

03:03 - Awesome, okay.

03:04 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 to do with Python Lambdas, it's just the serverless computing offering from AWS, has started supporting Python 3.6.

03:22 And so, someone else who was there at the conference was Matt McKay from Full Stack Python, and he put together this little quick tutorial on just how can you quickly set up a 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.

03:43 - Nice.

03:44 - 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 as these little AWS Lambdas.

04:04 I'm actually gonna have a guy tomorrow, a guy named Ryan, come and talk about serverless computing in general and talk Python to me.

04:12 But here's a little precursor if people want to check this out.

04:15 Oh, that's cool.

04:16 I'll be looking forward to listening to that.

04:18 I was just curious on the lambdas, do you know if the functions you put in there have to have names?

04:24 They have names, but you basically map them to endpoints that you can set up.

04:29 And there's all sorts of events like they maybe are not even public in terms of HTTP.

04:34 They might not be web service endpoints.

04:37 They could be, it's basically event driven.

04:39 So 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?

04:47 I would like this function here to execute when somebody uploads a file to this sub folder, this bucket in S3.

04:55 - Okay.

04:56 - Right, so maybe you're gonna do, like let's say you have a video delivery service for like training or something.

05:03 Well, if 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.

05:15 Like you could detect when a file is dropped there and automatically, by virtue of effectively just uploading to S3, have this code manage and juggle all that in the background and you don't ever have to do anything.

05:26 So you can set up these cool event triggered things, but it could just be as simple as like, here's a HTTP endpoint.

05:32 - Okay, I'm gonna try that out.

05:34 - Yeah, it's pretty cool, definitely.

05:36 One of the things I talked about at the conference was PyPI and the Python Package Authority and so on.

05:42 And that was around funding, but one of the reasons they have such a challenge with their infrastructure is 'cause they have so many packages, right?

05:51 - Yeah, yes, and so you should put some more out there, everybody. - Yes, everybody, let's make more, let's do more of that.

05:57 - There's 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 into your package.

06:10 The structuring is pretty good, although I'd like to see them include the source directory in their article.

06:17 But one of the things I liked was just a discussion of all the contents of the setup.py file, all the stuff that you've got to put in there, your license, your email.

06:29 I guess it's all pretty obvious, but when you just see it all in an example setup, it can be a little overwhelming.

06:36 But it's really, there's the minimal amount of stuff you put in there, it's just not that complicated to put in there.

06:42 I also liked that they, I hadn't seen a decent example recently of what you ought to put in your pypirc file.

06:52 So I guess it's like a, yeah, config file for, so that you can talk to PyPI easily.

06:58 Right, like I think you could put like your account information so you don't have to like log in every time and stuff like that Right. Yeah, and then they talked about using twine to push both to the test 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 have a package that you you're ready to actually put out there to the world yet You can use their test server and and push things up and try it out Yeah, definitely make use of the test server.

07:29 And what surprised me is actually how easy it is to put something on PyPI.

07:33 I found most of the difficulties that I ran into when I did this were actually around packaging itself, just purely packaging.

07:40 And once you kind of had that solved, it was like, it wasn't too bad.

07:44 Yeah, and I actually encourage people to just come up with something and try it out.

07:48 I have to drink my own Kool-Aid with this one.

07:51 I still haven't put anything out there.

07:53 So I got to put a couple of things up there.

07:55 Yeah, maybe after you're done writing your book, huh?

07:57 Yeah, actually, there's a lot of, quite a few pytest plugins that I'd like to write and put up there.

08:03 Oh yeah, that'd be a good set.

08:04 That'd be good.

08:05 Yeah, that'd be awesome.

08:06 Speaking of pythons, pythons live the same place where there are coconuts, right?

08:11 No, that's...

08:13 So, the next thing that we're going to talk about is called Coconut, and there is a tie-in to Python, but you've got to go back to the origins, back to Monty Python.

08:23 Oh, right, yeah, okay.

08:24 All right, you know those knights that run around and they've got like those coconuts, they click together because they don't actually have horses, but it sounds like the galloping basically.

08:33 We should have had some for the show.

08:35 We should have brought some to PyCon and just run around with them.

08:41 Next year, we know what to bring to Ohio.

08:42 Okay, so the next thing I want to talk about is a Pythonic functional programming language.

08:49 Now, functional programming, you know, some people are really into it.

08:53 Some people stay away from it.

08:56 To me, it's one of those languages where it's like a good puzzle more than building blocks.

09:03 It's more like this thing you have to sort of...

09:06 You write a little bit of code and then you think about it for a long time deeply.

09:11 Then you write two more characters and you're done or something like this.

09:17 It's very concise and it's very interesting to write basically functional programming.

09:21 There's many options that have been for a long time, Scheme, Haskell, whatever, F#, Erlang, you name it.

09:29 As Python programmers, we have all of our awesome PyPI packages just as we talked about them.

09:36 We may have some more after this session.

09:38 We have all of those.

09:39 Then we maybe have existing Python code.

09:42 Coconut is a functional programming language that is deeply functional and unique, but is a superset of Python, Python 3 specifically.

09:53 So what that means is you can take a given existing Python 3 code and go and rewrite one function or one algorithm functionally rather than imperatively.

10:06 And you can use all the PyPI packages because it's just Python.

10:08 Okay, so you can gradually add functional programming to an existing application or something.

10:15 Right, you have to start over.

10:16 to learn the functional programming concepts where they apply, but you don't have to use them all the time.

10:20 You can just use them where they make sense.

10:23 There's all kinds of unique things for Coconut.

10:26 There's pattern matching, which I'll tell you what that is in a minute because that's wild.

10:30 There's basically algebraic data types, which are immutable data types.

10:35 Think anytime you see a class, replace the word class with data and that becomes immutable, but there's some other cool stuff that happens.

10:43 interesting parallelization operations because once you have immutable data types, many of the problems that you solve with parallelize by paralyzing them, these algorithms become what's called embarrassingly parallel.

10:56 Embarrassingly parallelizable. If there's no real interaction because everything's read-only, well just let it roll. Just fork it out and just give the pieces to the little subprocesses or something. There's a lot of cool stuff but just to give you a sense, I'll tell you about the pattern and matching. Suppose I want to write a recursive function or let's just say a function that 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 one otherwise do some multiplication stuff with the current number plus you know times the factorial of n minus 1 something like that right and you would do this kind of recursion thing so you You have these if statements for different situations in your function.

11:43 In Coconut, you can define one function for the degenerative case and another function for different situations.

11:52 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." It's kind of like a method overloading in, say, C++, C#, Java, where it might match by type or type plus number of parameters.

12:10 It does that but by if statement.

12:12 It's crazy.

12:13 It's pretty mind-bending.

12:14 Anyway, people check it out.

12:16 There's a cool tutorial.

12:17 It's just pip install coconut, so easy to get started with.

12:20 It's definitely worth looking at because it'll make you think a little differently, which is always good.

12:25 Well, thanks.

12:26 I guess I'm just going to go back to packaging again.

12:29 But one of the things that I have had trouble with is understanding all the open source licenses and I guess I got into open source a little bit when everybody was afraid of the GPL especially in the corporate circles and now you know I just knew that MIT was like not as freaky I guess. MIT is like super simple and permissive if you want to use it but it's hard to decide for these more permissive licenses for me it's hard to decide like well what if I want some restrictions. Right. Right. It's like, what can I offer this useful to people but it has like the kind of protections I would like to have in this code. Right. Plus if you start reading it into it, there's a bunch of legalese that like I just glaze, my eyes glaze over. So I ran across a site called choosealicense.com and it's pretty darn cool. It talks about the MIT and Apache and GPL but it also has like a cool list of all of the whole bunch of different licenses and has some color-coded bullets for what you're getting with those and what you're giving up and what rights you keep and all that.

13:42 And I like it.

13:43 It's good.

13:44 Yeah, very nice.

13:45 Very nice.

13:46 We even have the unlicensed covered there, which is pretty cool.

13:48 And 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.

13:53 There's nobody forcing you to.

13:54 True.

13:55 Yeah, yeah.

13:56 In which case, you pretty much just retain the copyright.

13:59 There's somewhat of a problem with that on GitHub.

14:01 I believe in that there's a number of what are meant to be open source projects on GitHub that just the whoever created the repo didn't do the little drop down and say, "Yes, pick a license and choose one." And 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's technically no license so it's not really open source, which is kind of interesting.

14:24 Yeah.

14:25 And 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 installable even locally.

14:37 In one of the requirements is you have to fill something in for license.

14:42 So you may as well just kind of think about it a little bit ahead of time so you can throw it in there.

14:48 Anyway, yeah, absolutely.

14:49 It's a good idea.

14:50 All right, let's round it out with something free for people a free book.

14:54 So there's a book called Python for Scientists and Engineers.

14:58 And I think this was not free before, but now just became free.

15:03 So this is a book if you're getting into basically using Python for science or machine learning or natural language processing, all these different things.

15:12 There's a bunch of examples of using it there.

15:14 Right.

15:15 So just to give you a sense, there's like some introductory stuff.

15:18 And then they've got image and video processing in Python data analysis with pandas, audio and digital signal processing.

15:25 Of course, you got to control your Raspberry Pi with Python, because who wouldn't want that?

15:31 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 synonym analysis and looking for spam and basically text processing type things.

15:45 If learning about those things and dabbling in those things sounds interesting, here's a book with a bunch of applied chapters.

15:51 Nice.

15:52 stuff in there. 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 what I mean? Like I would love to build like a machine learning sort of something but I have nothing to turn machine learning loose on right now. Yeah and 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 um it's been on 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.

16:28 Yeah, absolutely. Yeah, yeah, very cool. So that's our news for this week. I don't know about your podcast but mine is definitely going to be a buzz 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. 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. Yeah and a lot of those talks I think you can get like the 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 right? Yeah definitely. Right on. So So how's the book?

17:11 I saw a great giant like floor to head height banner of the book.

17:18 But what's that mean for the rest of us?

17:21 It was a nice timing.

17:22 It was hard to get it out, but we got the beta out available.

17:27 So it's not available in hardback yet, but Python testing with pytest is available within a beta.

17:33 So the first five chapters are ready.

17:36 the first five chapters cover like just about everything you need to know. The only thing that's left to wrap up in the last couple chapters is the configuration files like the NE file 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've already had one of the comments from Twitter is somebody bought it and said, "Wow, this is like the best thing to learn pytest." So that was a good...

18:11 That's got to make you feel good after like months and months of months of working in isolation. Yeah, yeah, definitely. And also just like it's been an incredible experience working with an editor too. It's been good. Yeah, yeah, I'm sure it has. That's awesome. Alright, well we have a link at the bottom of the show notes so people want to check it out. They can totally do that, right? Yeah.

18:31 All right, well, that's it for this week.

18:33 Brian, as always, thank you.

18:35 It was great to hang out with you at PyCon.

18:37 And once again, thanks to everyone who stopped by.

18:39 We met so many people.

18:40 It was really amazing.

18:41 >> Right.

18:42 Incredible.

18:43 Thanks.

18:44 >> Thank you for listening to Python Bytes.

18:45 Follow the show on Twitter via @PythonBytes.

18:48 That's Python Bytes as in B-Y-T-E-S.

18:51 And get the full show notes at PythonBytes.fm.

18:55 If you have a news item you want featured, just visit PythonBytes.fm and send it our way.

18:59 the lookout for sharing something cool.

19:02 On behalf of myself and Brian Aukin, this is Michael Kennedy.

19:05 Thank you for listening and sharing this podcast with your friends and colleagues.

Back to show page