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