WEBVTT

00:00:00.001 --> 00:00:04.880
Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds.

00:00:04.880 --> 00:00:09.720
This is episode 66, recorded February 22, 2018.

00:00:09.720 --> 00:00:10.560
I'm Michael Kennedy.

00:00:10.560 --> 00:00:11.380
And I'm Brian Okken.

00:00:11.380 --> 00:00:12.720
And we have a ton of stuff.

00:00:12.720 --> 00:00:14.340
As usual, we've scoured the web.

00:00:14.340 --> 00:00:18.940
And actually, I don't know about you, Brian, but I had a really hard time actually picking the topics.

00:00:18.940 --> 00:00:20.780
Every one I found was better than the last one.

00:00:20.780 --> 00:00:22.740
It's exciting to see a lot of content out there.

00:00:22.740 --> 00:00:23.360
Yeah, for sure.

00:00:23.360 --> 00:00:25.680
So I want to say real quick, thanks to Rollbar.

00:00:25.680 --> 00:00:28.620
Check out what they're doing at pythonbytes.fm/rollbar.

00:00:28.840 --> 00:00:33.540
Add error reporting and real-time monitoring to your web apps and other things.

00:00:33.540 --> 00:00:34.860
We'll talk more about them later.

00:00:34.860 --> 00:00:38.040
Right now, let's focus on modern Python a little bit.

00:00:38.040 --> 00:00:45.840
I wanted to bring up, there's a lot of tutorials on how to do object-oriented programming and also object-oriented programming in Python.

00:00:45.840 --> 00:00:54.920
But real Python put out an object-oriented programming in Python 3, which I think is just a nice update.

00:00:54.920 --> 00:00:58.240
Just making sure that everybody understands currently how to do things.

00:00:58.400 --> 00:01:00.800
If you want to do classes and objects and inheritance.

00:01:00.800 --> 00:01:05.480
And to be clear, all of Python is object-oriented.

00:01:05.480 --> 00:01:07.960
It's just everything's an object.

00:01:07.960 --> 00:01:09.060
I hope that's true.

00:01:09.060 --> 00:01:09.860
Pretty sure that's true, yeah.

00:01:09.860 --> 00:01:12.100
Even functions and numbers and all that stuff.

00:01:12.100 --> 00:01:17.900
What this is meaning is if you're going to define your own classes, how to go about doing that.

00:01:18.040 --> 00:01:21.100
And this is a pretty nice tutorial.

00:01:21.100 --> 00:01:28.200
One of the reasons why I wanted to call it out is there's a reason I'll get to later, but he kind of didn't.

00:01:28.200 --> 00:01:30.500
He brushed by construction.

00:01:30.500 --> 00:01:37.200
So if you came from C++, one of the things that C++ does is it calls your base class constructors automatically.

00:01:37.980 --> 00:01:40.000
And I wanted to just call that out.

00:01:40.000 --> 00:01:40.260
Right.

00:01:40.260 --> 00:01:42.100
Especially if they're parameterless, right?

00:01:42.100 --> 00:01:44.740
Like, it'll just happen straight on the stack, right?

00:01:44.740 --> 00:01:45.320
Yeah.

00:01:45.320 --> 00:01:46.240
You don't have to be explicit.

00:01:46.240 --> 00:01:46.560
Yeah.

00:01:46.560 --> 00:01:48.660
But in Python, you do have to be explicit.

00:01:48.660 --> 00:01:53.840
If you override init, the base class init will not get called unless you call it yourself.

00:01:54.040 --> 00:02:03.480
And there's been many incantations of it, and I think the recommendation right now is to just call super.init to call the base class constructor.

00:02:03.480 --> 00:02:03.940
Yeah, yeah.

00:02:03.940 --> 00:02:04.260
Definitely.

00:02:04.260 --> 00:02:05.780
Very, very cool.

00:02:05.780 --> 00:02:07.020
Worth checking out.

00:02:07.020 --> 00:02:13.040
It really digs into the object model and inheritance and all that kind of stuff.

00:02:13.040 --> 00:02:16.260
So if that's a little bit shaky to you, definitely check it out.

00:02:16.260 --> 00:02:18.600
Even has some little exercises and examples in there, right?

00:02:18.600 --> 00:02:24.260
I guess also if you're not a bad thing to brush up on if you're just about to go into an interview, probably.

00:02:24.260 --> 00:02:25.860
It's a nice article.

00:02:25.860 --> 00:02:27.820
Also, pay attention.

00:02:27.820 --> 00:02:30.620
I've been playing with attrs a lot if I need objects.

00:02:30.620 --> 00:02:36.060
So make sure that it's a really easy thing to pick up if you want to check that out as well.

00:02:36.060 --> 00:02:36.720
Yeah, that's cool.

00:02:36.720 --> 00:02:38.120
Adders is pretty sweet.

00:02:38.120 --> 00:02:42.340
Definitely a lot of really solid people make it a great recommendation.

00:02:42.340 --> 00:02:48.120
So it appears frequently at the end as the featured PyPI package on Talk Python, for example.

00:02:48.120 --> 00:02:48.760
Yeah.

00:02:48.760 --> 00:02:51.360
So you want to stay on a GUI trip for a while?

00:02:51.360 --> 00:02:52.120
How about we keep going?

00:02:52.120 --> 00:02:53.820
We really opened a bag, man.

00:02:53.820 --> 00:03:00.300
When I started that, it really kicked off a, oh, but Michael, did you hear about this?

00:03:00.300 --> 00:03:00.980
Did you hear about that?

00:03:00.980 --> 00:03:02.400
And I'm happy I did.

00:03:02.400 --> 00:03:05.440
And I love all the things people are sending us.

00:03:05.440 --> 00:03:10.360
Learned about WXPython Phoenix, which I only knew about the older version, which is really awesome.

00:03:10.360 --> 00:03:15.280
I learned about GUI, G-O-O-E-Y, and WUI, and all these other interesting things.

00:03:15.620 --> 00:03:20.760
So I come to you, Brian, this week with yet another thing called scripted forms.

00:03:20.760 --> 00:03:22.220
So tell me, how's your Markdown?

00:03:22.220 --> 00:03:23.060
I love Markdown.

00:03:23.060 --> 00:03:24.040
I use it all the time.

00:03:24.040 --> 00:03:24.980
Yeah, Markdown's not hard.

00:03:24.980 --> 00:03:25.900
Yeah, it's not bad, right?

00:03:25.900 --> 00:03:34.680
So here is a project in Python that lets you basically sketch out a UI in Markdown.

00:03:35.480 --> 00:03:40.100
Then it becomes an interactive GUI with input fields and everything.

00:03:40.100 --> 00:03:40.660
Okay.

00:03:40.660 --> 00:03:41.760
Neat.

00:03:41.760 --> 00:03:43.080
I got to check that out.

00:03:43.080 --> 00:03:44.280
Yeah.

00:03:44.280 --> 00:03:51.700
So for example, like you want the title, like a big title at the top of your form or your window, hash space type out the title.

00:03:53.600 --> 00:03:54.520
Isn't that cool?

00:03:54.520 --> 00:03:54.900
Yeah.

00:03:54.900 --> 00:03:55.240
Yeah.

00:03:55.240 --> 00:03:58.360
So you can do all sorts of interesting things in there.

00:03:58.360 --> 00:04:01.300
It's not like a lot of these are not totally general purpose.

00:04:01.300 --> 00:04:07.020
But if you want a simple UI, check out this thing called scripted forms.

00:04:07.020 --> 00:04:08.440
Of course, we're linking to it in there.

00:04:08.440 --> 00:04:10.120
And you just basically sketch it out.

00:04:10.120 --> 00:04:11.960
And it runs actually on Jupyter.

00:04:12.460 --> 00:04:19.180
But the way it gets packaged up is you just see like a desktop window pop up and then it's interactive.

00:04:19.180 --> 00:04:20.320
So it's pretty cool.

00:04:20.320 --> 00:04:22.320
They got some examples and all kinds of stuff.

00:04:22.320 --> 00:04:24.900
You can have like sliders and live graphs.

00:04:24.900 --> 00:04:31.760
And so this looks particularly interesting to data science-y folks who have that kind of display stuff going on.

00:04:31.760 --> 00:04:32.180
That's cool.

00:04:32.180 --> 00:04:32.840
Yeah, it's cool, right?

00:04:32.840 --> 00:04:40.700
So scripted forms, there's yet one more way in which you can create niche Python GUI apps and then bundle it up with something like PyInstaller.

00:04:40.700 --> 00:04:42.300
I definitely want to try that.

00:04:42.400 --> 00:04:43.120
Yeah, yeah, I do as well.

00:04:43.120 --> 00:04:45.100
So do you know that I'm a fan of MongoDB?

00:04:45.100 --> 00:04:48.200
Yeah, you're like the Uber fan.

00:04:48.200 --> 00:04:49.400
I am the Uber fan.

00:04:49.400 --> 00:04:50.520
I love it.

00:04:50.520 --> 00:04:52.140
I talk about it, do stuff with it all the time.

00:04:52.140 --> 00:04:56.980
Like, for example, Python Bytes, the web app, is driven by MongoDB, for example.

00:04:56.980 --> 00:05:01.760
But you actually, you are the one to bring the big news, not me, on MongoDB these days, right?

00:05:01.760 --> 00:05:02.720
I guess so.

00:05:02.720 --> 00:05:05.400
I was surprised, but I grabbed it.

00:05:05.400 --> 00:05:11.400
The news that came out on the 15th was that MongoDB will, and it doesn't do it right now,

00:05:11.480 --> 00:05:21.220
but in the 4.0 release, it will do multi-document transactions and have ACID data guarantee integrity guarantees.

00:05:21.480 --> 00:05:22.700
That's kind of blown my mind.

00:05:22.700 --> 00:05:31.180
One of the big things that Mongo has done is really focused on going to treat the document level record as the thing.

00:05:31.180 --> 00:05:45.520
That way we can do sharding and auto scale out and all kinds of stuff and not worry about communicating across machines and clusters and all the other pitfalls you can run into by trying to do really complex transactions.

00:05:45.780 --> 00:05:46.520
So this, you're right.

00:05:46.520 --> 00:05:48.480
I didn't see this coming either.

00:05:48.480 --> 00:05:50.500
So this is due out in the summer.

00:05:50.500 --> 00:05:54.480
So the 4.0 is supposed to do transactions.

00:05:54.480 --> 00:06:02.360
And the 4.2, which is the, I'm not sure when that's coming out, that will even deal with transactions across sharded deployments.

00:06:02.360 --> 00:06:02.820
Wow.

00:06:02.820 --> 00:06:03.560
That's really cool.

00:06:03.560 --> 00:06:06.000
And it has snapshot isolation.

00:06:06.500 --> 00:06:09.400
So even the sort of repeatable read type stuff.

00:06:09.400 --> 00:06:10.580
Very cool.

00:06:10.580 --> 00:06:12.740
So yeah, they said sometime this summer, right?

00:06:12.740 --> 00:06:17.680
The ability to do transactions and hopefully you will get things like rollback and things like that.

00:06:18.060 --> 00:06:21.920
These are a lot of the reasons why people don't choose a document database.

00:06:21.920 --> 00:06:25.240
And so that changes the table of pros and cons.

00:06:25.240 --> 00:06:27.500
It definitely changes the tradeoffs that you're considering.

00:06:27.500 --> 00:06:31.900
I just find working with these document databases so much easier.

00:06:31.900 --> 00:06:40.360
Like the last time I ran a migration or worried about upgrading my database schema to match a new deployment was never.

00:06:40.360 --> 00:06:50.800
Like I literally have not had to run any form of update script for the last two years on training.python.fm, on Python bytes, or any of these things, right?

00:06:50.800 --> 00:06:52.180
Like they just adapt.

00:06:52.180 --> 00:06:55.020
And it just makes the sort of living with it so much easier.

00:06:55.020 --> 00:07:01.240
So I'm really happy to see it get one more check in the sort of comparison table in that column.

00:07:01.240 --> 00:07:02.060
Yeah, definitely.

00:07:02.060 --> 00:07:02.820
Yeah, very cool.

00:07:02.820 --> 00:07:07.120
So if I did mess up my schema and something went wrong, though, my web app would crash.

00:07:07.120 --> 00:07:08.300
That would be bad.

00:07:08.300 --> 00:07:16.060
And actually, working with Mongo Engine, you can like basically take the site down because it will like not read records if it thinks it's inconsistent with them.

00:07:16.060 --> 00:07:17.280
So that's a different type of problem.

00:07:17.280 --> 00:07:18.680
Same thing happens with SQLAlchemy.

00:07:18.680 --> 00:07:24.320
But if I did that and I had Rollbar installed like I do, we would know about it right away.

00:07:24.320 --> 00:07:30.880
We'd get little notifications in Slack and email and pop-ups and stuff saying, hey, the site is down.

00:07:30.880 --> 00:07:33.160
Something has gone terribly wrong.

00:07:33.160 --> 00:07:38.620
Like just the other day, I was sitting around and I started getting all these notifications of something going wrong with the site.

00:07:38.620 --> 00:07:39.760
I'm like, oh, what is this?

00:07:39.760 --> 00:07:42.600
Why are these, you know, like on Python bytes and Talk Python and whatnot?

00:07:42.600 --> 00:07:46.700
And I pull up Rollbar and it says cannot find MongoDB server.

00:07:46.700 --> 00:07:47.160
How about that?

00:07:47.160 --> 00:07:57.000
And the reason is the digital version of the host was actually patching the underlying Linux servers for the Spectre and Meltdown vulnerabilities.

00:07:57.000 --> 00:07:58.640
So they had to take the machines down.

00:07:58.640 --> 00:08:03.960
And they didn't do it in like a controlled way because they're just like, we're telling you at some time we're taking the machines down.

00:08:03.960 --> 00:08:04.880
We've got to fix this.

00:08:05.520 --> 00:08:15.040
So even when it's not your fault, you'll know about it if you have this installed and you can at least switch, you know, switch up a dialogue or a page saying, oh, sites are super maintenance right now.

00:08:15.040 --> 00:08:15.300
Sorry.

00:08:15.300 --> 00:08:15.700
Yeah.

00:08:15.700 --> 00:08:16.540
That's cool.

00:08:16.660 --> 00:08:16.820
Yeah.

00:08:16.820 --> 00:08:18.400
So super easy to install it.

00:08:18.400 --> 00:08:19.620
Not much work at all.

00:08:19.620 --> 00:08:20.760
Plugs into all the web frameworks.

00:08:20.760 --> 00:08:24.240
Check it out at pythonbytes.fm/rollbar.

00:08:24.240 --> 00:08:29.680
So another kick that you've been on for a while, Brian, is Python packaging.

00:08:29.680 --> 00:08:30.220
Yes.

00:08:30.220 --> 00:08:34.740
We talked a lot about what the right structure that is and all those various things.

00:08:34.740 --> 00:08:39.320
So this week I want to feature this thing called Python packaging pitfalls.

00:08:40.280 --> 00:08:47.060
It's not super new, but I thought it might be fun to cover anyway because we've talked a lot about it and we haven't covered this.

00:08:47.060 --> 00:08:53.480
So a couple of items that I don't know how many there are, probably 10, 12 little things.

00:08:53.480 --> 00:08:54.540
Don't forget to do this.

00:08:54.540 --> 00:08:55.320
Don't forget to do that.

00:08:55.320 --> 00:09:01.400
Like don't forget, you know, so if you're doing packaging, you might forget to clean the build directory before you do it.

00:09:01.400 --> 00:09:09.180
Or you forget to specify package data or using package underscore data or fine grained package data.

00:09:09.180 --> 00:09:11.720
All sorts of mistakes that are listed there.

00:09:11.720 --> 00:09:13.580
And it says why it's really nice.

00:09:13.580 --> 00:09:15.300
The article says, why is this a problem?

00:09:15.300 --> 00:09:16.780
How do you fix it?

00:09:16.780 --> 00:09:24.860
Like hard coding your packages in the setup py versus like discovering the packages with Python code in your setup py.

00:09:24.860 --> 00:09:25.260
Yeah.

00:09:25.260 --> 00:09:26.640
These are all great tips.

00:09:26.640 --> 00:09:28.140
I haven't read this for a while.

00:09:28.140 --> 00:09:35.020
I remember reading it a couple of years ago to try to make sure that most of these look like they're still valid.

00:09:35.020 --> 00:09:35.700
Yeah, I think so.

00:09:35.700 --> 00:09:41.040
One of them that might be nice and close for you is your test the installed code.

00:09:41.040 --> 00:09:49.540
They test what's actually in your working directory rather than running the setup and testing the thing that actually was the result of that.

00:09:49.540 --> 00:09:51.120
Is that one of the things to avoid?

00:09:51.120 --> 00:09:53.020
That's one of the last things to say.

00:09:53.020 --> 00:09:58.980
Be careful of make sure you test the actual install result, not just your code on development.

00:09:58.980 --> 00:09:59.360
Yeah.

00:09:59.360 --> 00:10:05.540
And that's one of the reasons why I really like Tox is because Tox creates like these clean environments.

00:10:05.540 --> 00:10:08.760
But you still have to be careful of that even with Tox.

00:10:08.760 --> 00:10:11.300
That's why we talked about using a source directory.

00:10:11.300 --> 00:10:11.800
Absolutely.

00:10:12.580 --> 00:10:18.460
So a while ago, I had a bunch of authors, including you on Talk Python, about writing.

00:10:18.460 --> 00:10:22.680
And some people were asking, like, how do you become a better writer?

00:10:22.680 --> 00:10:25.180
And you said, by writing.

00:10:25.180 --> 00:10:27.180
Right?

00:10:27.180 --> 00:10:29.600
Just get out there, blog, write, do things like that.

00:10:29.600 --> 00:10:32.440
So you came across something like that again this week, right?

00:10:32.580 --> 00:10:32.820
Yeah.

00:10:32.820 --> 00:10:40.020
I came across an article called Blogging Principles I Use by Julia Evans, which I think it's cool.

00:10:40.020 --> 00:10:42.500
She goes by Bork on Twitter with a zero.

00:10:42.500 --> 00:10:47.260
But I'm just going to read through her tips and then we can talk about them.

00:10:47.260 --> 00:10:48.720
Be honest about what you know.

00:10:48.720 --> 00:10:51.200
Try not to write anything too long.

00:10:51.200 --> 00:10:52.200
Be positive.

00:10:52.200 --> 00:10:54.020
Write for the past you.

00:10:54.020 --> 00:10:56.080
Stick with your own experience.

00:10:56.080 --> 00:10:58.740
And it's okay if not everyone likes it.

00:10:59.240 --> 00:11:02.380
And a lot of these really hit home with me.

00:11:02.380 --> 00:11:05.320
One of the things, try not to write anything too long.

00:11:05.320 --> 00:11:14.160
I tend to try to, like, completely get my head around something and not want to write about it until I completely understand it.

00:11:14.160 --> 00:11:16.340
And then sometimes I don't have time to do that.

00:11:16.340 --> 00:11:18.720
And I think that's too bad.

00:11:18.720 --> 00:11:23.380
And I think I love it when people just have little couple screens full of information of just,

00:11:23.380 --> 00:11:25.260
Hey, I learned this neat new thing.

00:11:25.260 --> 00:11:26.480
Here's how to do it.

00:11:26.700 --> 00:11:30.160
And just go and teach it so other people can learn from you.

00:11:30.160 --> 00:11:31.520
It doesn't have to be huge.

00:11:31.520 --> 00:11:33.100
So be okay with short things.

00:11:33.100 --> 00:11:40.000
If you do short things frequently, that's probably better than saving up that one long post that actually never gets written, right?

00:11:40.000 --> 00:11:40.320
Yeah.

00:11:40.320 --> 00:11:43.540
Also, one of the things you can do is with metrics as well.

00:11:43.540 --> 00:11:51.440
If you, instead of writing a long blog post that has, like, five subtopics, write five different posts.

00:11:51.440 --> 00:11:56.100
And then you can find out which piece of this resonating or easier metrics, we'll just point it out.

00:11:56.100 --> 00:11:57.060
Yeah, that's a really good point.

00:11:57.060 --> 00:12:00.120
The last one is, it's okay if not everyone likes it.

00:12:00.120 --> 00:12:08.680
And her example actually is, she's got a, I forget which article it was, but one of her articles is more popular than others.

00:12:09.200 --> 00:12:13.780
And she needs to remind herself to not try to try to keep up with that.

00:12:13.780 --> 00:12:16.420
It would be a mistake to try to hit that every time.

00:12:16.420 --> 00:12:20.480
That's actually something that hits with me is I haven't been blogging a lot lately.

00:12:20.480 --> 00:12:21.580
I do want to pick it up.

00:12:21.580 --> 00:12:25.540
I think I need to, it will help me to try to write shorter stuff.

00:12:25.760 --> 00:12:30.260
And also, I've got a few tutorials out there that are, that are really popular.

00:12:30.260 --> 00:12:32.100
And I don't know how to beat that.

00:12:32.100 --> 00:12:33.740
So, don't try.

00:12:33.740 --> 00:12:35.620
Just write little things.

00:12:35.620 --> 00:12:39.240
Like, I learned a few new things during the webinar today.

00:12:39.240 --> 00:12:41.200
I learned some new things about PyCharm.

00:12:41.200 --> 00:12:46.960
And I could just, like, write a couple, a short blog post about cool things I learned about PyCharm today.

00:12:46.960 --> 00:12:47.680
Yeah, that's awesome.

00:12:47.680 --> 00:12:48.120
Why not?

00:12:48.120 --> 00:12:48.720
Yeah, why not?

00:12:48.720 --> 00:12:53.160
And definitely, I feel like these little series ones are real nice.

00:12:53.160 --> 00:12:58.260
Like, I've done several, like, here's, I'm going to write, I'm going to blog 10 blog posts in this kind of theme.

00:12:58.260 --> 00:13:00.520
And those turn out to be really easy to write.

00:13:00.520 --> 00:13:05.800
But I also find that I periodically get distracted and just life gets in the way and I don't finish them.

00:13:05.800 --> 00:13:07.280
I'm like, here's the top 10.

00:13:07.280 --> 00:13:08.980
And, like, they have seven filled out, you know?

00:13:08.980 --> 00:13:09.280
Yeah.

00:13:09.280 --> 00:13:11.680
So, I mean, I think that's a really great way to do it.

00:13:11.680 --> 00:13:16.320
But maybe actually write the 10 and then do the, hey, I'm doing a series on it.

00:13:16.320 --> 00:13:17.000
You know what I mean?

00:13:17.020 --> 00:13:20.880
Like, kind of do it in reverse a little bit to bring it together, what you've done.

00:13:20.880 --> 00:13:28.920
I think that one of the takeaways I would add is, like, it is so hard to predict what is going to be popular and what is not going to be popular.

00:13:28.920 --> 00:13:33.880
It's just, you know, you look at things and you think, oh, this is going to be so popular.

00:13:33.880 --> 00:13:35.100
And it gets, like, 100 views.

00:13:35.100 --> 00:13:36.920
Like, you're like, I guess I'll throw this out.

00:13:36.920 --> 00:13:38.040
Why not?

00:13:38.040 --> 00:13:40.100
I got a half hour and it's kind of on my mind.

00:13:40.100 --> 00:13:41.560
And maybe it won't matter.

00:13:41.560 --> 00:13:44.280
Like, it's thousands or hundreds of thousands of views.

00:13:44.280 --> 00:13:46.820
It's just like, okay, why is that like this?

00:13:46.820 --> 00:13:47.040
Right.

00:13:47.040 --> 00:13:49.840
So, just put stuff out there and it will happen.

00:13:49.840 --> 00:14:02.500
I think the write for the past you, I fall into this trap of trying to write for, either write for experts and try to impress the people that know more than I do, which that's a bad place to try to be.

00:14:03.060 --> 00:14:05.160
And trying to write for absolute beginners.

00:14:05.160 --> 00:14:08.080
But I haven't been an absolute beginner for a long time.

00:14:08.080 --> 00:14:10.200
So, I don't really know how to do that.

00:14:10.200 --> 00:14:13.580
So, I think writing for, like, me a month ago.

00:14:13.580 --> 00:14:17.500
If I would have read this article a month ago, it would have saved me time.

00:14:17.500 --> 00:14:19.000
So, just write it down.

00:14:19.000 --> 00:14:19.540
Yeah, yeah.

00:14:19.540 --> 00:14:19.880
Absolutely.

00:14:19.880 --> 00:14:21.060
Very cool.

00:14:21.260 --> 00:14:25.920
So, we spoke about pipenv, P-I-P-E-N-V, a while ago.

00:14:25.920 --> 00:14:31.140
But I want to bring up something that I just, I don't know why I found this.

00:14:31.140 --> 00:14:32.780
I just randomly ran across this.

00:14:32.780 --> 00:14:35.240
So, I was looking at pipenv again for something.

00:14:35.240 --> 00:14:46.240
And so, pipenv is a way to kind of package up virtual environment, dependencies, requirements.txt, pip, activating the virtual environments, all that kind of stuff into, like, one little workflow.

00:14:46.240 --> 00:14:46.960
Okay.

00:14:46.960 --> 00:14:50.300
Now, Kenneth writes is behind this in a significant way.

00:14:50.300 --> 00:14:53.300
But I somehow was looking across it.

00:14:53.300 --> 00:15:00.060
And I saw that it's on github.com/pypa, the Python Packaging Authority, slash pipenv.

00:15:00.060 --> 00:15:01.020
Hmm, interesting.

00:15:01.460 --> 00:15:07.900
And then I scroll down and it says pipenv, the officially recommended Python packaging tool from python.org.

00:15:07.900 --> 00:15:08.880
Free as in freedom.

00:15:08.880 --> 00:15:13.880
Did you know this is the official way, like, pip and requirements.txt is apparently out?

00:15:13.880 --> 00:15:14.280
No.

00:15:14.280 --> 00:15:15.020
I didn't either.

00:15:15.020 --> 00:15:15.780
That was my reaction.

00:15:15.780 --> 00:15:16.480
Like, wait, what?

00:15:16.480 --> 00:15:20.200
I mean, I know there's pipfile and pipfile.lock and all that kind of stuff.

00:15:20.200 --> 00:15:27.780
But it seems to me, reading this at least, that, because this comes from PyPA, that pipenv is the way we should be doing things.

00:15:27.780 --> 00:15:32.380
So I don't know about you, but I need to study this and kind of get in touch with it.

00:15:32.380 --> 00:15:35.400
Because I feel a little bit lost when I use pipenv.

00:15:35.400 --> 00:15:40.320
And I'm really confident with pip and requirements.txt and all the stuff I do there.

00:15:40.320 --> 00:15:42.780
I guess I'm comfortable with pip and setup files.

00:15:42.780 --> 00:15:45.180
So I will have to read up on this, too.

00:15:45.340 --> 00:15:52.800
So do you know if you can just get away with doing this and then pushing a package up to IPI?

00:15:52.800 --> 00:16:04.000
I don't know, but one of the things you can do is you can tell it to generate a requirements.txt from its behaviors and its lock files and stuff.

00:16:04.000 --> 00:16:04.360
Okay.

00:16:04.360 --> 00:16:05.900
So let me give you the quick workflow.

00:16:05.900 --> 00:16:10.140
If you go there, there's a docs.pipinf.org, which you can go to.

00:16:10.140 --> 00:16:12.540
And it has a nice little screencast from Kenneth Reitz.

00:16:12.540 --> 00:16:13.420
It's like four minutes.

00:16:13.420 --> 00:16:15.600
It says, let me show you this new tool.

00:16:15.600 --> 00:16:18.940
I've been working on it with a bunch of people, and it seems really nice.

00:16:18.940 --> 00:16:20.320
Here's how it goes.

00:16:20.700 --> 00:16:23.860
And so you just go into a directory, no virtual environment, nothing set up.

00:16:23.860 --> 00:16:26.340
And you say pipenv install a thing.

00:16:26.340 --> 00:16:30.040
And if it's never run, it will create right there.

00:16:30.040 --> 00:16:31.060
What is it?

00:16:31.060 --> 00:16:31.760
A pip lock file.

00:16:31.760 --> 00:16:34.180
A pip file and a pip.pipfile.lock.

00:16:34.180 --> 00:16:42.020
And it will somewhere in like your temp working area create, not in that folder, somewhere else, create a virtual environment and install it into that.

00:16:42.020 --> 00:16:49.040
If you type pip install, a pipenv install another thing, it'll put it into that same environment because it now is like tied to the pip file.

00:16:49.040 --> 00:16:53.560
And it'll actually automatically add the requirement to your pip file and to your pip lock.

00:16:53.560 --> 00:16:56.440
And the pip file is like requirements.txt.

00:16:56.440 --> 00:17:00.640
The pip file.lock is like that plus the dependencies.

00:17:00.640 --> 00:17:04.800
So it's like pip freeze everything, not just what you pip installed.

00:17:04.800 --> 00:17:06.720
So it's pretty cool.

00:17:06.720 --> 00:17:09.460
And then you could just pip shell, pip inf shell to kick it off.

00:17:09.460 --> 00:17:14.060
Or you can find the, there's a command for finding the virtual environment.

00:17:14.180 --> 00:17:18.100
So then you can, you know, source activate it just tradition, like traditionally.

00:17:18.100 --> 00:17:18.560
Okay.

00:17:19.000 --> 00:17:27.500
And actually the video is like the reason why I gave it a shot because just reading about it confused me, even though I read it like seven times.

00:17:27.500 --> 00:17:28.060
I know.

00:17:28.060 --> 00:17:29.300
Like, why is this bouncing off me?

00:17:29.300 --> 00:17:33.740
But then you watch him use it in like this little couple minute video and it's like, oh, okay, that's easy.

00:17:33.740 --> 00:17:34.400
Yes, exactly.

00:17:34.800 --> 00:17:39.480
Another thing I like about it is it says Windows is a first class citizen in our world.

00:17:39.480 --> 00:17:39.780
Wow.

00:17:39.780 --> 00:17:40.340
That's rare.

00:17:40.340 --> 00:17:40.780
That is.

00:17:40.780 --> 00:17:41.300
It's really nice.

00:17:41.300 --> 00:17:44.940
Like I have a Windows 10 setup, but I typically work on my Mac.

00:17:45.420 --> 00:17:51.700
But I know many, many people in the world use Windows, especially in like large enterprise environments.

00:17:51.700 --> 00:17:57.360
And having Windows be a first class citizen in the Python space is good for everyone.

00:17:57.360 --> 00:17:57.820
Yes.

00:17:57.820 --> 00:17:58.940
Well, this is neat.

00:17:58.940 --> 00:17:59.100
Yeah.

00:17:59.100 --> 00:18:09.600
So just like really the news for me is like it's a review of pip inf, but the fact that it seems to be the officially recommended way over the traditional ways we've been doing it means I need to pay more attention.

00:18:09.600 --> 00:18:09.940
Yes.

00:18:10.260 --> 00:18:10.800
Very cool.

00:18:10.800 --> 00:18:11.460
All right.

00:18:11.460 --> 00:18:15.120
So that's our set of items for the week.

00:18:15.120 --> 00:18:16.860
You just did a webcast, right?

00:18:16.860 --> 00:18:21.080
Which you will probably have live certainly by the time this goes.

00:18:21.080 --> 00:18:23.020
Well, probably by the time this goes out.

00:18:23.020 --> 00:18:24.080
Well, it was already live.

00:18:24.080 --> 00:18:24.900
It was live this morning.

00:18:24.900 --> 00:18:27.140
Well, I mean, the recording will be out and available.

00:18:27.140 --> 00:18:28.840
Recording should be out.

00:18:28.840 --> 00:18:29.200
Yeah.

00:18:29.200 --> 00:18:33.220
That was with the JetBrains PyCharm team.

00:18:33.220 --> 00:18:34.880
And that was super fun.

00:18:34.880 --> 00:18:36.840
I had a good time.

00:18:36.840 --> 00:18:39.720
We talked about using pytest within PyCharm.

00:18:40.560 --> 00:18:43.000
And we just scratched the surface.

00:18:43.000 --> 00:18:44.000
There's a lot more to cover.

00:18:44.000 --> 00:18:44.880
But it was fun.

00:18:44.880 --> 00:18:45.480
Sounds really cool.

00:18:45.480 --> 00:18:45.840
Awesome.

00:18:45.840 --> 00:18:50.460
So we'll definitely link to the video next time, I'm sure, because we'll know where it is.

00:18:50.460 --> 00:18:52.820
Also, I have two quick follow-up items.

00:18:52.820 --> 00:18:56.540
One is the Pandas.

00:18:56.540 --> 00:18:59.060
The whole Pandas project is super important in data science.

00:18:59.060 --> 00:18:59.920
Gosh, I'm sorry.

00:18:59.920 --> 00:19:01.840
I forget the guy's name who sent it to me.

00:19:02.180 --> 00:19:09.820
I got a message saying, hey, we're having this really interesting idea of the Pandas documentation sprint.

00:19:09.820 --> 00:19:13.000
And these are throughout the world.

00:19:13.000 --> 00:19:15.820
And to say how many locations, I don't know.

00:19:15.820 --> 00:19:16.460
Quick counting.

00:19:16.460 --> 00:19:17.040
Quick counting.

00:19:17.040 --> 00:19:27.820
Let's say 15 locations throughout the world, slightly biased towards Europe, but also everywhere, but apparently Australia or Antarctica.

00:19:28.300 --> 00:19:38.500
There's these physical locations like San Diego, Seattle, and so on, where people are getting together to do sprints on the documentation for Pandas.

00:19:38.500 --> 00:19:41.880
That happens on March 10th, 2018.

00:19:41.880 --> 00:19:44.400
So a couple weeks.

00:19:44.580 --> 00:19:47.820
Yeah, and it has a countdown all the way down to the seconds.

00:19:47.820 --> 00:19:49.720
Definitely has a, yeah, down to the seconds.

00:19:49.720 --> 00:19:50.580
We start now.

00:19:50.580 --> 00:19:52.140
I think this is a cool idea.

00:19:52.140 --> 00:20:00.200
If you've never contributed to open source and you want to get that check mark on your resume and you want that on a major project,

00:20:00.200 --> 00:20:08.920
here's a really cool way to become a contributor to Pandas without deeply understanding it or having majorly adding a feature.

00:20:08.920 --> 00:20:12.760
And also, you get to hang out with people who are experts in Pandas.

00:20:12.900 --> 00:20:14.520
And so those are probably good connections to make.

00:20:14.520 --> 00:20:19.560
So check that out at python-sprints.github.io slash pandas.

00:20:19.560 --> 00:20:20.400
That should be fun.

00:20:20.400 --> 00:20:24.720
Yeah, and every open source project will love you if you write documentation for it.

00:20:24.720 --> 00:20:25.480
Yes, absolutely.

00:20:25.480 --> 00:20:27.920
Okay, so really great.

00:20:27.920 --> 00:20:37.160
And then the other item I wanted to follow up with is we talked about the workflow in Unreal coming from, was that Autodesk, I think?

00:20:37.160 --> 00:20:40.080
Anyway, really, really cool stuff that they were doing there.

00:20:40.080 --> 00:20:42.640
And now someone followed up and said, that's really great.

00:20:42.640 --> 00:20:46.860
Do you know you can now embed Python in the Unreal Engine 4?

00:20:46.860 --> 00:20:47.240
Wow.

00:20:47.240 --> 00:20:53.440
There's this project called Unreal Engine Python, and it lets you just embed there.

00:20:53.520 --> 00:20:58.740
So it's like a plug-in for embedding the entire Python VM 3 or 2 in there.

00:20:58.740 --> 00:21:07.080
And then, you know, you can basically add scripting into your game and let people write Python and control your 3D environment.

00:21:07.080 --> 00:21:07.960
Pretty cool.

00:21:07.960 --> 00:21:11.540
So just a quick follow-up from when we talked about that before.

00:21:12.200 --> 00:21:13.060
Thank you for being here.

00:21:13.060 --> 00:21:15.500
It's great to chat with you, and I love your picks this week.

00:21:15.500 --> 00:21:16.040
Thank you.

00:21:16.040 --> 00:21:16.520
You too.

00:21:16.520 --> 00:21:16.840
Bye.

00:21:16.840 --> 00:21:17.160
Bye.

00:21:18.000 --> 00:21:19.740
Thank you for listening to Python Bytes.

00:21:19.740 --> 00:21:22.300
Follow the show on Twitter via at Python Bytes.

00:21:22.300 --> 00:21:25.180
That's Python Bytes as in B-Y-T-E-S.

00:21:25.180 --> 00:21:28.600
And get the full show notes at pythonbytes.fm.

00:21:28.600 --> 00:21:32.960
If you have a news item you want featured, just visit pythonbytes.fm and send it our way.

00:21:32.960 --> 00:21:35.660
We're always on the lookout for sharing something cool.

00:21:35.660 --> 00:21:39.060
On behalf of myself and Brian Okken, this is Michael Kennedy.

00:21:39.060 --> 00:21:42.660
Thank you for listening and sharing this podcast with your friends and colleagues.

