Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

poyo -> pyyaml (Issue #1513) #1515

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 4 additions & 9 deletions cookiecutter/config.py
Expand Up @@ -4,7 +4,7 @@
import logging
import os

import poyo
import yaml

from cookiecutter.exceptions import ConfigDoesNotExistException, InvalidConfiguration

Expand Down Expand Up @@ -44,7 +44,7 @@ def merge_configs(default, overwrite):
for k, v in overwrite.items():
# Make sure to preserve existing items in
# nested dicts, for example `abbreviations`
if isinstance(v, dict):
if isinstance(v, dict) and k in default:
acturner marked this conversation as resolved.
Show resolved Hide resolved
new_config[k] = merge_configs(default[k], v)
else:
new_config[k] = v
Expand All @@ -60,13 +60,8 @@ def get_config(config_path):
)

logger.debug('config_path is %s', config_path)
with open(config_path, encoding='utf-8') as file_handle:
try:
yaml_dict = poyo.parse_string(file_handle.read())
except poyo.exceptions.PoyoException as e:
raise InvalidConfiguration(
'Unable to parse YAML file {}. Error: {}'.format(config_path, e)
)
with open(config_path, 'r') as yaml_file:
acturner marked this conversation as resolved.
Show resolved Hide resolved
yaml_dict = yaml.load(yaml_file, Loader=yaml.FullLoader)
acturner marked this conversation as resolved.
Show resolved Hide resolved

config_dict = merge_configs(DEFAULT_CONFIG, yaml_dict)

Expand Down
1 change: 1 addition & 0 deletions setup.py
Expand Up @@ -11,6 +11,7 @@
'binaryornot>=0.4.4',
'Jinja2<3.0.0',
'click>=7.0',
'pyyaml>=5.4',
'poyo>=0.5.0',
acturner marked this conversation as resolved.
Show resolved Hide resolved
'jinja2-time>=0.2.0',
'python-slugify>=4.0.0',
Expand Down