Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds.
This is episode 118, recorded February 19th, 2019.
I'm Michael Kennedy.
And I'm Brian Okken.
And this episode is brought to you by DigitalOcean.
Check them out at pythonbytes.fm/DigitalOcean.
More on that later.
Right now, Brian, it's...
Man, it is cold outside.
It's not bad.
I would say it's frozen.
Okay.
Oh, yeah.
The whole transition thing.
You're so good at that.
The first topic is frozen Flask.
This was sent in by somebody who I probably should have written their name down.
But it was recommended by a listener.
And it's actually pretty darn cool.
So I've been playing with static site generators a little bit.
And here's the idea is if you already have Flask application up, and it's mostly static-y content anyway,
or it's got some...
Yeah, activity is more JavaScript-y or something.
You can just freeze that into a statically servable web thing with frozen Flask.
And it's pretty painless.
Frozen Flask looks so cool.
Yeah, it really does.
And then I also stumbled across a tutorial that's called Dead Easy Yet Powerful Static Website Generator with Flask.
And it talks about frozen Flask.
And it also talks about an extension to Flask called Flask Flat Pages, which allows you to have a bunch of pages generated from Markdown.
Oh, that's pretty cool.
Yeah, I haven't heard of that.
That's nice.
And it's pretty fun.
I'm going to warn you, I tried to go through this tutorial.
It's still got a lot of great information.
It's well written.
It's just a little...
Since it was from 2012, it's a little out of date.
Some of the imports don't quite work.
So you'll have to do some Googling.
The frozen Flask that we also link to has some really cool...
It's some pretty easy tutorials on there too.
So it looks fun.
Yeah, that looks really cool.
There's always this tension between having a data-driven website where maybe I've got a bunch of podcast episodes or something.
And they all have notes.
But I want to have a whole bunch of stuff around them and have that generated.
And of course, that would be like a regular Flask data-driven app, right?
But if I'm going to do that with a static thing, how do I do that?
Do I create a bunch of static Markdown?
How do I mix it all together?
It can be painful, right?
So Frozen Flask is like, well, you create the dynamic thing, but then you host it.
You don't have to deal with the infrastructure hosting.
You just put HTML and CSS somewhere and it runs great, right?
Yeah.
Like, for instance, I was thinking it would be a neat way to do this.
I was always potentially looking for ways I can use something also.
Like if I've got something internal for our test team, for instance, and we want to look at all of our test data and analytics and all that stuff,
having a more dynamic site would be really neat.
But then also a periodic generation of like a version report or something as a static site.
Yeah.
This would be useful for something like that.
Yeah.
And so place that I just want to throw out is like an extra for this part that I have no experience with,
but seems super cool.
And I think you also are familiar with this is Netlify.
Yeah.
So Netlify is a place specifically for hosting static sites.
So it says build, deploy, and manage modern web projects.
And it gives you a global CDN, continuous integration, and automatic free HTTPS,
I think even your own domain name, 100% for free.
There are ways to pay for it, but so much of it is for free that this seems like a really good option.
Yeah.
And they're not sponsoring this episode.
It's just cool.
That's not, that's, that's just something that's cool.
That's right.
Digital Ocean.
They are sponsoring this episode.
So last week, I think it was, we spoke about the new PEP that is for Dunder PyPackages.
Yeah.
And you said that's awesome, except.
Yeah.
It's awesome, but.
And one of the challenges you said was, well, if you just want to have packages and put them in there
and run your app, that's totally good.
It'll pick it up and run.
But the big, the thing that was missing was to run the command line binary apps like pytest or Tox or P-Serve or, you know, like MicroWSGI,
all those things that would then get stuffed into that place that is really nearly impossible to put into your path, right?
Yeah.
Well, not impossible, but.
Not impossible, but it's a, it's a super pain.
Like every time you create a virtual environment to add it.
Yeah.
To the path, right?
So, so Chad Smith, who had worked on that before, well, we mentioned who was part of the, this Python loc for like local Python project to let you do like a preview interaction with that.
Sent us a message and said, Hey, actually you should know about my other project called PIPX, I guess for a pip executable or something like that.
And the idea is it will execute binary Python packages in isolated environments.
And the closest analogy analogy to this is probably PIPC, which we have spoken about before.
Oh yeah.
Okay.
So, so the idea is, yeah, you can create these, you can basically, instead of pip install a thing, you can PIPX install a thing and it'll automatically create a virtual environment for you.
Install it and its dependencies.
And even it, it's even nice.
It makes sure your pip is up to date, which is almost never the case when you create a new virtual environment and it just installs it there.
And then it puts it in the path.
It puts it in a location on your system that when you install PIPX is in the path, but is not in the restricted part of your operating system.
So you can pip install anything you need to run.
So you can run it from the command line in your path without doing sudo.
Okay.
So the entry points are going to all go from a bunch of different virtual environments are all going to go to the same place, I guess.
Yes.
It does a bunch of like linking back.
Okay.
Some place that's in the path back to the various virtual environments it manages.
Okay.
This is a very cool.
Now I'm excited.
Yeah.
Now I'm even more excited.
Yeah.
This is, this is super cool.
So you can safely install these packages into virtual environments, which is where they belong, but globally, but without messing up other things or, or, you know, put them all into one virtual environment.
That's in your path.
Yeah.
You can do things like list the stuff that's installed.
So you can see which of the, which it's kind of like brew.
You can say, what have I installed here through PIPX, which is pretty cool.
I'd also run binaries out of the pie package directory as well.
So it's kind of a companion tool to Python Locke as well.
Okay.
Nice.
Being a Gen Xer, I'm, I'm a sucker for anything with X at the end.
I know.
It's amazing.
It's, it's the best.
So basically you just pip install PIPX.
And then from then on, you can say pip install like PT Python, which is an awesome thing.
You could pip install pytest.
You could pip install all sorts of things, glances.
And there's a couple of ways in which it's sort of like Pipsy, but also better.
So one of the things that I really like, you know, I made the analogy to homebrew before
is you can go and say PIPX upgrade all.
And so everything that you've installed throughout the last six months or whatever with PIPX,
it'll go and find those and see if there's any updates for any of your little Python utilities
you've installed.
Oh, cool.
That's cool, right?
Yeah.
And then there's also a comparison, little matrix thing by matrix.
I mean, one dimensional single line.
Anyway, there's a comparison to PIPC and it talks about how PIPX is under active development.
PIPC isn't in a bunch of other stuff.
You know, it's based on Python three, six and so on.
It uses V and V not virtual environment.
And there's just a bunch of little niceties.
And, you know, one that made me smile is it prints out emojis when it's doing stuff.
It prints out little happy face, like little indicator emojis on the terminal, which, you
know, makes me happy.
Yeah.
What's the other thing that does that?
PIPenv does that, right?
Yeah.
And yeah, Kubernetes, some of the Kubernetes tools do as well.
It's a trend I'm seeing coming along here, but there's a lot of smiley, happy little things
on the terminal, which is, you know, it doesn't hurt.
Yeah.
What's the next thing you got for us?
This is an article from Vicky Boykus that's called Data Science is Different Now.
It's a fairly lengthy article, but it's some pretty good information.
So here's the situation we've got.
We've been talking about data science.
Everybody's been talking about, say, data science.
There's just a lot of buzz around it.
So there's a lot of people with just a little bit of training in it going through book camps
or MOOCs or, is that how you pronounce MOOCs?
MOOCs?
I think so, yeah.
Okay.
M-O-O-C, the Massive Online Courses, yeah.
Yeah.
Okay.
Or they're self-taught or they get a remote degree or some other training and they want to
get a data science job.
So there's a whole bunch of people trying to get into data science and this partly can become
a problem.
So the market, she notes that the market can be very, very discouraging for this flood
of beginners because since there's a lot of beginners, there's a lot of people.
The jobs are also becoming more advanced.
They have more specific requirements.
And also just the job description is sort of vague.
So what is it you're actually going to be doing?
And when people are actually doing it in the workplace, it seems a lot more like engineering
than this shiny new thing that we've been talking about.
That's right.
It's just a kind of a good view of reality check for data science, people interested in getting
into it.
But there's a, she also ends with some advice, not just a complaining about it.
But her advice is for people that wanted to get into it.
Her first bullet point is don't get into data science, which I just laughed.
I actually laughed out loud.
I'm like, that's awesome advice.
But no, basically, she said, just don't, don't follow the crowd because following what everybody
else is doing is not going to differentiate you.
And she recommends a backdoor approach is of like starting as a junior developer or in DevOps
or project management or something like that and learn a lot of data science stuff on the
job and then build that up into a position that you can work at the company as a data scientist.
You know, that sounds like a pretty good bit of advice because I feel like data scientists
are a little more on their own than software developers.
Yeah.
Like at a company, there'll be five or 10 software developers working on one web app or one other
automation project.
But how often do you have five to 10 data scientists all working on the same problem?
Right.
I feel like they're all kind of doing their own thing a lot of times, which as a beginner
can make it more difficult.
Right.
So maybe get some of these engineering skills through the approach that you're just talking
about and then branch out into that more solo side of things.
Yeah.
And then she also has like some skill, a whole list of specific skills for like, let's say
you did get a junior developer job or you got some other job, which skills should you beef
up on?
So she's got a bunch of listed, a bunch of skills to try to beef up on that.
So yeah.
What are they?
Creating Python packages, putting R into production, which I don't like that one.
You should use Python.
But anyway, what do I know?
We'll talk more about that later.
Optimizing Spark jobs so they run more efficiently.
I don't even know what that means.
Version controlling data.
Ooh, that sounds neat.
Making models and data reproducible.
Version controlling SQL.
Building and maintaining.
That sounds hard.
Clean data in data lakes.
I love data lakes and data swamps.
It's just funny.
Tooling for time series.
Forecasting at scale.
Scaling, sharing.
Sharing of Jupyter Notebooks.
Thinking about systems for clean data.
And lots of JSON.
Yeah, that's cool.
All right.
That sounds good.
Like a good advice.
Yeah.
That's a good pick.
Speaking of good stuff and sponsored episodes, this one is brought to you by DigitalOcean.
And they, you know, it's February 19th as we're recording this, Brian.
And not long ago, five days ago, was Valentine's Day, right?
Yeah.
So DigitalOcean, they actually had a Valentine's Day present for the world.
And their present was database as a service.
So until now, you would go over to DigitalOcean, you create a server, and then you would have to put your own database on there.
Or use some other external service, like Object Rocket or something like that.
So now you can get managed Postgres databases on DigitalOcean, which is pretty sweet if you're going to work with Postgres.
So you just check the box, and they handle all the operational bits for you.
It's pretty cool, right?
Yeah, that is cool.
Yeah.
Yeah, definitely.
So check them out at pythonbytes.fm/DigitalOcean.
New users get $100 credit to play around with Postgres or whatever else you want to play with.
And, yeah, they're a very good service.
Definitely can recommend them.
So this next one is pretty interesting.
It's not super actionable yet, Brian, but it starts to approach something that I'm really passionate about.
So the thing I want to tell you about is Rust Python.
So we have the language Rust, we have the language Python, and somehow they come together.
So the Rust doesn't replace the Python, it replaces the C in CPython.
The idea is, like, here's a new interpreter, a new runtime built on Rust instead of on C.
Wow.
Yeah.
So that feels like a more modern type of language to use than just C, right?
To build a foundation.
And that might be a little bit nicer if they could get that working really well.
Yeah.
And it's Python 3 only.
So 3, 5, and above.
And basically, the interpreter is written in Rust.
And this comes to us from Frederick Averpil.
So thanks, Frederick, for sending that over.
But, yeah, this looks pretty interesting.
And I would say it's definitely under active development.
When I was getting ready for this recording, I looked at the site.
And the GitHub said, last commit an hour ago.
So it feels like people are working on it.
You always, you know, wonder, is this thing real?
Are people doing anything?
Now, I say that because they're not really ready to, like, do much.
Like, you can create a REPL and you can run some basic Python and stuff.
But, like, there's not a great standard library written with Rust foundations and things like that.
So there's a lot of work to be done.
But the goals are to have a full Python 3 environment entirely in Rust with no CPython bindings or no C bindings, really.
And a clean implementation without compatibility hacks.
Okay.
Yeah, so if you want to practice some Rust and play around, there's a lot of things that you could do here that might be fun.
I think people who played with this would probably understand regular CPython better as well, right?
Obviously, if you reimplement it in another language, that would be good.
But they have a bunch of tasks on the issue trackers and they're labeled very nicely, like, good first issue and stuff.
So if people want to get started, they can do that.
Yeah, also kind of be a fun getting in in the early stages sort of a thing to jump in and help out.
Exactly.
Like in five years, if people keep working on this, this will be really hard to contribute to.
But right now, it'd be really easy.
Yeah.
Relatively speaking.
So why do I think this is super cool?
Well, Rust comes from Mozilla and Rust has good support for compiling to WebAssembly, right?
Oh, okay.
And WebAssembly is the much better, faster, stronger way of running something in the browser.
So if this thing got off the ground and it actually worked in a meaningful way and it could be compiled to WebAssembly, well, then, all of a sudden, we have a super awesome Python implementation in the browser on the client side.
Yeah.
So we could have Python really full stack on both ends, the server and the client.
Yeah.
So it would be super cool.
And this is one possible path down that.
I don't know.
I don't know that that's the goal.
But they do talk about WebAssembly being an option in sort of a toy sense because it's not really quite ready yet.
But there's some stuff there.
So anyway, that was what really got my interest.
I'm like, okay, another implementation address.
It's kind of interesting.
Like, oh, wait, WebAssembly support?
That would be a big deal if that came on.
Maybe in a few years we'll see something like a book called Python Script, just the good parts.
Exactly.
Very cool.
All right.
Well, what's the next one?
The next one is this is an article.
Actually, it's kind of a team up between Mike Driscoll and RealPython.
So Mike Driscoll wrote an article on RealPython called Jupyter Notebook, an Introduction.
And, of course, we've talked about Jupyter Notebooks before and a lot of stuff around data and around that.
However, this is actually a tutorial that I think was kind of missing.
And it's not all the cool things you can do with it, but it's, I know I want to use it.
No, really, how do I start?
And it really starts from installing it, of course, up to and then just kind of walks through some of the real basics,
like creating a new, once you get it up and loaded, you've got a blank notebook or a blank interface,
and you can create a new notebook in there.
And then even something simple, like I didn't know that it was so easy to change the name just by clicking on the name of the untitled notebook that you get right away.
And you can click and rename it something else.
It talks about how to run cells.
I think I played with Notebooks for quite a while before I learned the shortcut of Shift-Enter.
Yep.
And then it goes through just some of the menu options and some of the neat features that you might not be obvious if you didn't think of exploring them before.
Like File has a save and checkpoint.
As you're working on a notebook, you can, it's kind of like a version control thing built into it.
You can just save it, save at different checkpoints and move on.
That's cool.
The edit menu has, I wouldn't have thought to look there for things like splitting and merging cells or moving cells around, but it's in there.
And then the cell menu has a whole bunch of cool ways to run.
I knew you could run a cell or run everything, but there's also things like run a subset or run everything above this cell or below this cell or something.
Yeah.
Excellent.
At first, when I was reading this, there's a couple of questions that I have right away when I start with the notebooks that I, that wasn't covered.
So I'm going to go ahead and push promote these practices right away is when you're installing Jupyter, if you're installing it with pip, do it in a virtual environment.
And then all the installs within your notebooks will go in that environment and you can keep those separate from the rest of your work of everything else.
Once you have a notebook up, you can pip install within there now with the percent pip install that works now.
Thanks to, I think at least Jake Vanderplass publicized it.
I'm not sure if he did the work or not, but so that's kind of really what I wanted to talk to about.
This is a really good, I think a good article to send to people.
If you're working with notebooks and you want to share something with somebody else and they've never experienced them before, just send them to this also.
Yeah.
It's a good resource and, you know, very comprehensive.
So definitely a good one that Mike Driscoll put up there.
Now I want to round out the show talking about the Python developer survey results from 2018.
This is the end of 2018.
So this is pretty fresh from the PSF and JetBrains.
We talked about their stuff a year ago when they did it for 2017 and in 2017.
So this is the next year.
All right.
Have you seen this yet, Brian?
I've only briefly looked through it.
Yeah.
So there's a couple of interesting things that I pulled out.
And one of them is that Python usage as a main language.
So one of the questions I say is, so you're here because you use Python.
Is that because you use it as a secondary thing?
Like maybe you're a C++ developer, but you use it for DevOps or something like that.
Or do you use it as your main language?
The answer of Python is my main language is up 5% from last year.
That's awesome.
Yeah.
So now it's 84% of the people and it was 79 last year.
So when the PSF conducted the survey, the other big thing to talk about maybe is what do you use Python for?
And the number one thing is data analysis and then web development and then machine learning.
Okay.
That sounds like a lot of data science and probably a lot of Jupyter stuff happening.
Yeah.
Between those top three, right?
And also, so one of the things that's cool about this survey is now they've been doing it a few years is they have a comparison,
like a sort of a trend predictor.
Is the derivative positive or negative on this trend here?
And so I put those numbers down for 2018 and 2017.
So for data analysis, it's 59% of the people now use that for data analysis, use Python for data analysis.
That's up 8%.
Oh, wow.
And, you know, it's above web development.
So you might think it's a zero-sum game, like more people are not doing web and now they're doing data science.
But no, like web development's up 2%.
Machine learning is up 7%.
Your R comment and all that, right?
So pretty interesting.
And the other thing they let you do is they let you ask for people who answer this question,
let's partition their answers by whether Python is their main language or it's just kind of a secondary thing they do.
So the main takeaway of this section is that web development is the only category with a large gap separating main users of Python versus secondary ones,
like 56% versus 36%, 20% difference depending on how you use Python.
All the other ones are pretty similar.
Okay.
Cross this too.
Yeah, I want to point out a couple other things.
Okay.
From the survey, 93% say that they're involved with software testing or writing automated tests.
That's pretty cool, right?
That's awesome.
Or at least maybe that's professional versus hobby.
I don't know.
Yeah, anyway.
Yeah, but it's quite high.
And they said they ask you which test frameworks you're using.
For test framework, pytest is number one.
Of course.
That's pretty cool.
Another one that's interesting is kind of like last year they said sort of scientific computing, data-oriented, like data analysis, machine learning, whatnot.
How does that compare to web development?
And it's now 27% web development, 28% scientific development, they call it.
It's like data science plus machine learning.
Also, Python versus legacy Python, super good news here.
Of the surveyed folks, 84% are using Python 3 versus 16% for legacy Python.
Yeah, that's awesome.
So that's really good.
And it also is growing very rapidly.
So like 9% more people are using modern Python, which is great.
Web frameworks, Flask is now the most popular web framework on the survey.
Django was last year.
Yeah, that's interesting.
Yeah, but they're still really close.
They're neck and neck for sure.
Then it goes Tornado and then Pyramid and then Databases, Postgres, MySQL, SQLite.
Those are the top three relational.
And then MongoDB is tailing along in the NoSQL bit.
And then ORMs, SQLAlchemy, and Django ORM are tied for that.
Anyway, a bunch of like, that's just skimming the service.
There's a ton of cool little interactive bits you can go explore the survey with.
Yeah.
Wow.
Neat.
Yeah.
So good stuff.
And yeah, people should go check it out.
Of course, the links in the show notes.
All right, Brian, you got anything else you want to share?
That's not one of our main topics.
Yeah, Nina mentioned to us, you can pronounce her name, but I have trouble with this.
Zacharena?
Yeah.
Zacharenko?
She hit us up and said, if we could plug this, it'd be great.
Mentored sprints for diverse beginners are something that's at PyCon.
I don't know if they've always been a thing, but that's something that's available this year.
It's a newcomer's introduction to contributing to an open source project.
And we have a link in the show notes.
Yeah, cool.
You do have to both, there's a call for applications, both for projects and for participants.
That's open until March 14th.
And a highlight, if you're wondering if this event is for you, it definitely is.
And we'd love to have you take part of it.
So that's a neat thing.
Yeah, and they'll take place on Saturday, May 4th from 2.30 to 6.30 at the main PyCon.
So that's cool.
Yeah, neat.
Yeah, that's a great thing.
I'm glad we get a chance to highlight it.
All right.
Do you got a joke for us?
I don't have a joke.
All right, I grabbed one.
This one plays a little better in cartoon form, but I'm going to try it in audio.
Okay.
So if you have some pseudocode in like a sample.txt file or something like that, what's the easiest
way to convert that to Python?
I don't know.
How?
You change the extension to .py.
For some reason, the pseudocode is very similarly written to Python.
And of course, it speaks to Python's readability, right?
So maybe you got to throw a colon in there somewhere, but yeah, pretty much.
And I have an extra.
I actually have two extras for you.
Okay.
The first one is this Python song.
And it takes a bunch of like modern songs and it converts them into like learning chapters.
So you learn things like you learn about Python basics, like looping and variables.
You learn about classes.
You learn about web design.
So there's like a little different song for each one.
It's these folks somewhere like Sweden or Norway or somewhere like that.
I can't remember.
Maybe Denmark.
And they put together this really funny like six and a half minute set of little songs all
put together into chapters.
And it's all about Python.
I'm totally going to subject my daughter to this.
Yeah.
It's pretty funny.
And then I'll throw one more in there really quick for you.
I did my speaking of daughters.
My daughter literally sent this in like about an hour ago.
And speaking of all the data analysis and data science folks, I think this one might
resonate.
I'll let you.
I'll let you be the judge.
So an infinite number of mathematicians walk into a bar.
The first one tells the bartender he wants a beer.
The second one tells the bartender he wants half a beer.
The third one says she wants a fourth of a beer.
The bartender interrupts and puts two beers on the table and says, people, you really need
to learn your limits.
Okay.
That's funny.
It's pretty good, right?
Yeah, definitely.
Pretty good.
All right.
Super.
Okay.
Well, Brian, these joke segments always make me smile.
Yeah, definitely.
Yeah.
Thanks for doing the episode as always.
All right.
Thank you.
Yep.
And I guess we will see everyone at Pi Cascades, right?
Oh, yeah.
That will be the next thing.
That's this week.
Yeah.
We head out in like three days or something like that for the conference.
So if you're going to be there, hopefully we'll get a chance to meet you.
Otherwise, see you some other place.
All right.
Bye.
Thank you for listening to Python Bytes.
Follow the show on Twitter via at Python Bytes.
That's Python Bytes as in B-Y-T-E-S.
And get the full show notes at pythonbytes.fm.
If you have a news item you want featured, just visit pythonbytes.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.