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