Using and Mastering Cookiecutter Transcripts
Chapter: Case studies: Major projects using Cookiecutter
Lecture: Case study: Beeware

Login or purchase this course to watch this video and the rest of the course contents.
0:00 The first place that we're going to look at, the first project is something called Beeware. So Beeware is quite the smorgasbord of various things,
0:10 it's a bunch of great libraries or packages you can use, it's a number of startup projects for different platforms,
0:17 and a few other utilities tossed in here and there. So let's go have a look. Here we are on the Beeware website,
0:23 and there is a couple of ways you can navigate it, but probably the best way to think about this is Beeware is a set of Python native tools,
0:32 so this is a Python project, it just happen to be Python as well but it could have been Node.js or whatever; anyway it's a Python native tool set
0:40 for both mobile and desktop, and this is quite interesting, so let's look around.
0:45 If we go over here to the project, there's a couple of ways we can explore it, we can look at the projects so they've got some applications,
0:52 a little presentation thing, tooling, one that's really noteworthy is Briefcase for basically packaging your Python app into a native application
1:01 so a .exe on Linux binary, .app on MacOS, things like that, and some bridges so these are some interesting cross sort of interoperability pieces,
1:14 so here's something that compiled Python into Java bytecode for example, but where we want to focus is around the templates.
1:20 So check this out Android templates, tvOS templates, iOS templates, macOS templates, so if I want to get started
1:28 building with their tooling with their native UI framework a macOS application instead of figuring out all the stuff with like plists and .app files,
1:39 and icons and whatnot, I can just take this template and run with it. So since I am on a Mac, let's take the Mac template here,
1:47 so you can see standard Cookiecutter stuff going on, now I made a folder chapter seven case studies and let's make a directory Beeware
1:56 and we could say cookiecutter this, this is going to generate a macOS app
2:02 that has its logic implemented in Python and it's going to be all ready to go for us.
2:08 Now technically, we have to plug in the Python and a few other things, but not a big deal.
2:12 So it lets start, what is the name it is going to be "Beeware show off", dir_name macos is fine, bundle name is fine,
2:24 okay so it's created it if we look in here we'll see there's in macOS, so let's go over to the browser and notice, look here's an app,
2:32 I could double click it and run it. Now it exits immediately, so not super interesting but let's go look inside;
2:38 so we can say show back its contents, look around here's that info.plist
2:42 you see it's generated all the various bundle info that macOS needs to do its thing,
2:47 you have resources here, README, let me change the name so I can open it, so we can come over here and see this is where your code should be placed,
2:56 the native code that's starting the app is going to be looking for a __main__.py that's going to start the execution of your code.
3:06 And we can go over here in the app packages, if we again rename this so I can open it,
3:11 this is where we put our project dependencies other packages and whatnot. Ok, that's cool right, so if we want to get started with this,
3:18 and build this Beeware show off app then we can use this Cookiecutter template and they as you have seen have a number of different types
3:30 we could do this for iOS, we could do this for tvOS, we can do this for Android, I feel like I sell watch somewhere, but anyway
3:37 there's a bunch of cool stuff and you could see how central Cookiecutter is
3:40 to all of these things. Alright, so that's how Beeware is using Cookiecutter.


Talk Python's Mastodon Michael Kennedy's Mastodon