Using and Mastering Cookiecutter Transcripts
Chapter: Adding features to Cookiecutter
Lecture: Modifying Cookiecutter
0:03 Let's add a feature, really a bugfix in some sense,
0:06 an enhancement to Cookiecutter.
0:09 There's a number of reasons why you might want to develop
0:12 and change Cookiecutter, maybe you want to take Cookiecutter as it is
0:16 and modify it to be your own custom version for some other project;
0:19 maybe you want to enhance it for everybody
0:22 or maybe you just need to have a local working copy
0:25 as part of your due diligence for your company, who knows.
0:28 But I'm going to assume in this case that we want to add
0:31 a public feature back to Cookiecutter.
0:34 So, as I have been going through this course and working on templates lately
0:37 I have been keeping a list of things that annoy me,
0:40 and when something annoys me I put it in the list somewhere and say
0:43 this is a thing I could add to this project, so we're going to do that for Cookiecutter,
0:47 and let me introduce the thing that annoys me here.
0:50 So let's come over here and go to a working folder here
0:56 ok, so we're in this test folder let's try this cookiecutter cookiecutter-template
1:05 see how it asks for my name, remember that name comes from the default YAML file
1:10 okay cool, so let's have a look at that default YAML file.
1:14 So, over here and remember I notice on line five here,
1:17 we have a blank newline, remember how annoying it was if that is not there
1:21 let me try the same thing, all I did was it's hard to see,
1:24 I deleted that blank line right there okay.
1:26 Let's run the same command again,
1:30 oh that YAML file again, unable to parse configuration
1:36 no pattern matches github_username.
1:40 So that I think is super frustrating for beginners,
1:43 how would you know that you have to have that newline there
1:47 this error is completely indecipherable,
1:50 so what I want to do is put this back just to show you if this were back here
1:55 run it again, it works; so that's cool, what I want to do is
1:59 I want to make it so it doesn't matter whether this newline is here or not
2:03 in Cookiecutter, I'm going to basically have Cookiecutter add that newline if it's missing
2:07 and because the parsing depends upon an external third party YAML parser,
2:12 and maybe we can go back and fix that as well, but for now,
2:15 let's just make Cookiecutter forgiving okay.
2:18 So, in this chapter, what we're going to do is we're going to go
2:21 through the process of getting Cookiecutter locally on my machine
2:24 being able to develop it, add this feature
2:27 and going through the git flow pull request process to get it at least submitted
2:31 back to the Cookiecutter project, and we'll see if they accept it.