Session Ready
Exercise

Create project

In this project template exercise, we will first list the keys in a local cookiecutter.json file.

The paths to the template directory and its cookiecutter.json are assigned to template_root and json_path variables, respectively.

While template_root is a string, json_path is a pathlib.Path object.

We will use the json module to obtain cookiecutter.json file contents as a Python dictionary and unpack this dictionary into a list to see its keys.

We need to see the keys in the cookiecutter.json file to know how override the default project name in the template, because the key in the extra_context argument passed to the cookiecutter() function must match the corresponding key in cookiecutter.json.

Instructions
100 XP
  • Use the json and pathlib modules to list keys in the local template's cookiecutter.json file.
  • Call the cookiecutter() function without prompting for input via the interactive wizard.