You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to save/load values for dictionary variables in a config file.
However, cookiecutter silently ignores the given value.
I expected the given value to not be ignored.
What I've run:
$ ~/anaconda3/envs/python37env/bin/cookiecutter https://github.com/dHannasch/cookiecutter-pypackage --checkout try-to-make-a-complex-multiple-choice --default-config
full_name [Audrey Roy Greenfeld]:
email [audreyr@example.com]:
github_username [audreyr]:
project_name [Python Boilerplate]:
project_slug [python_boilerplate]:
project_short_description [Python Boilerplate contains all the boilerplate you need to create a Python package.]:
pypi_username [audreyr]:
Select link_to_website:
1 - {'link_immediately': 'y', 'disable_forever': 'n'}
2 - {'link_immediately': 'n', 'disable_forever': 'n'}
3 - {'link_immediately': 'n', 'disable_forever': 'y'}
Choose from 1, 2, 3 (1, 2, 3) [1]: 2
version [0.1.0]:
use_pytest [n]:
use_pypi_deployment_with_travis [y]:
add_pyup_badge [n]:
Select command_line_interface:
1 - Click
2 - No command-line interface
Choose from 1, 2 (1, 2) [1]:
create_author_file [y]:
Select open_source_license:
1 - MIT license
2 - BSD license
3 - ISC license
4 - Apache Software License 2.0
5 - GNU General Public License v3
6 - Not open source
Choose from 1, 2, 3, 4, 5, 6 (1, 2, 3, 4, 5, 6) [1]:
Encoded in a config file, these choices are:
default_context:
_template: 'cookiecutter-pypackage/'
add_pyup_badge: 'n'
command_line_interface: 'Click'
create_author_file: 'y'
email: 'audreyr@example.com'
full_name: 'Audrey Roy Greenfeld'
github_username: 'audreyr'
link_to_website: {'link_immediately': 'n', 'disable_forever': 'n'}
open_source_license: 'MIT license'
project_name: 'Python Boilerplate'
project_short_description: 'Python Boilerplate contains all the boilerplate you need to create a Python package.'
project_slug: 'python_boilerplate'
pypi_username: 'audreyr'
use_pypi_deployment_with_travis: 'y'
use_pytest: 'n'
version: '0.1.0'
So far so good.
$ cd python_boilerplate/
python_boilerplate$ git init
Initialized empty Git repository in /tmp/python_boilerplate/.git/
python_boilerplate$ git add --all
python_boilerplate$ git commit -a -m "Create initial git commit so that we can see the git diff later."
python_boilerplate$ cd ..
$ ~/anaconda3/envs/python37env/bin/cookiecutter https://github.com/dHannasch/cookiecutter-pypackage --checkout try-to-make-a-complex-multiple-choice --config-file python_boilerplate/cookiecutterrc --overwrite-if-exists
You've downloaded /ascldap/users/dahanna/.cookiecutters/cookiecutter-pypackage before. Is it okay to delete and re-download it? [yes]:
full_name [Audrey Roy Greenfeld]:
email [audreyr@example.com]:
github_username [audreyr]:
project_name [Python Boilerplate]:
project_slug [python_boilerplate]:
project_short_description [Python Boilerplate contains all the boilerplate you need to create a Python package.]:
pypi_username [audreyr]:
Select link_to_website:
1 - {'link_immediately': 'y', 'disable_forever': 'n'}
2 - {'link_immediately': 'n', 'disable_forever': 'n'}
3 - {'link_immediately': 'n', 'disable_forever': 'y'}
Choose from 1, 2, 3 (1, 2, 3) [1]:
Huh! The choice in the config-file is silently ignored. And indeed if we check the output, it uses the original default choice, not the choice in the config file.
I also tried
link_to_website: 2
which is also silently ignored.
Breaking the dictionary up into YAML also doesn't work:
(That part isn't new information --- @lbrack tried nesting in YAML and that didn't work. #1149
It looks like @lbrack wrote a fix (?) but I don't see a pull request at the moment. lbrack@c9eb982)
I don't think it matters much whether the config-file is valid YAML, just as long as there's some way to store choices. As @lbrack noted, we totally can enter dictionaries on the command line, and it works great:
operating_systems [default]: {"windows": "n"}
It's strange that the config-files can't do the same thing, even without the proper nested YAML @lbrack wants. I haven't been able to puzzle out what's happening under the hood.
The text was updated successfully, but these errors were encountered:
Description:
I am trying to save/load values for dictionary variables in a config file.
However, cookiecutter silently ignores the given value.
I expected the given value to not be ignored.
What I've run:
Encoded in a config file, these choices are:
So far so good.
Huh! The choice in the config-file is silently ignored. And indeed if we check the output, it uses the original default choice, not the choice in the config file.
I also tried
which is also silently ignored.
Breaking the dictionary up into YAML also doesn't work:
(That part isn't new information --- @lbrack tried nesting in YAML and that didn't work. #1149
It looks like @lbrack wrote a fix (?) but I don't see a pull request at the moment. lbrack@c9eb982)
I don't think it matters much whether the config-file is valid YAML, just as long as there's some way to store choices. As @lbrack noted, we totally can enter dictionaries on the command line, and it works great:
It's strange that the config-files can't do the same thing, even without the proper nested YAML @lbrack wants. I haven't been able to puzzle out what's happening under the hood.
The text was updated successfully, but these errors were encountered: