Using and Mastering Cookiecutter Transcripts
Chapter: Creating Cookiecutter templates
Lecture: Why create your own template
Login or purchase this course to watch this video and the rest of the course contents.
0:01 Now we've come to the really critical part of this course. Creating templates. While it's great to use and understand Cookiecutter as a consumer,
0:11 the real power is taking the concept of Cookiecutter templates and applying them to your projects, your teams, your companies and so on.
0:19 So, let's go through some of the reasons why we might want to create a template.
0:22 Well, first of all, they often can decrease frictions on projects that you use, so imagine you have some project and it requires some setup,
0:31 certain number of files in certain place, folder structure and so on, and if this does not have some kind of scaffolding tool already,
0:38 then a Cookiecutter template would be awesome for you to add, so even if you don't own that project, maybe creating a Cookiecutter
0:45 that will generate it just the way you lie it is a good idea, and who knows, you could submit that as a pull request back to the original team
0:52 and maybe they will take that and that could become the official way to create your favorite project, so that is a really cool thing,
0:59 and we all use different projects so why not, right, this applies to everyone. You can empower your team and make it easier to onboard new developers,
1:06 so what do I mean by that? Well, suppose again, there is a certain way as a team you have agreed upon any project of your language should look,
1:16 it should always have this folder structure, it should always have these files,
1:19 it should always have this README, and some sort of startup script and so on, so you can make it easier for all new projects to come out that way
1:26 and if you have a Cookiecutter that always does that when somebody new comes on the team just go this for no matter what project you are working on,
1:33 this is how it's going to look, this is why it works that way. In the similar way you can start farther down the road
1:39 for what I am calling integrated projects, now for this imagine you're working at a big company, and big could be 5, 10, 20, developers,
1:46 it doesn't have to be huge, but a team of developers where you are all building on projects and you are all integrating
1:52 with the same subsystems over and over and over; here is how we send outbound email, from any app that we use,
1:58 here is how we set up continuous integration, here is how we integrate with runtime error monitoring,
2:03 things like Rollbar or New Rellic, things like that, so if you've got a bunch of these things,
2:09 and every time you create a new project you need to install Rollbar and setup the keys and the config files, you need to create the right thing
2:15 in the requirements and you need to set up this mail system and you need to install say like some package that handles the mail for you,
2:21 and so on and so on, like the more of these things that you commonly use within your company,
2:26 the more excellent it would be to start with the template that already integrates
2:30 all those things, you push a button and zzzip, it all comes our pre integrated,
2:35 so like by the time you start opening your project, the first file in an editor,
2:39 it's already got the email integrated, the way it works within your data center,
2:43 it's already got error monitoring, integrated with your keys, it just is ready to go. So this is a super valuable way if you work inside a company,
2:51 you want to make that company more consistent, make sure things that would be like well do we really need to add error monitoring
2:58 and like do we need to put that effort in and if that's just like a button press,
3:01 that's just part of project creation then of course you put error monitoring, why not.
3:05 If you work on the other side of the story here, on an open source, not within a company that is like very structured,
3:12 but you've got some open source project that has some setup basically in my mind, if your open source project has more than two lines,
3:20 on how to get started it could use a Cookiecutter template; here is how I think it should go.
3:34 okay, maybe the other order, depending on how you want to do it, right, maybe the Cookicutter could be on GitHub and it could generate
3:40 the some kind of requirement listing and then you install it there, either way there should basically be two steps,
3:46 if you have a whole bunch of steps in an open source project, there is a lot of people that will come along, they will try to get started
3:51 and go oh this is too complicated, I am out of here, right, so you can bundle up the best practices for getting started with your open source project,
3:56 as a Cookicuter template. That's excellent. And, this can regardless of whether you're inside of a company,
4:02 or you're in an open source project, this can lower the support overhead, all that startup stuff, all that initial integration that can just go away
4:09 because the template does it, you start beyond that place when you create that project and start from there, rather than saying okay,
4:15 here we go, create this directory, put these files here and so on, and so on, right, so it can lower the support overhead across the board.