From 2ea3c9ac290b33447b718f96fc47758f8ee80fe2 Mon Sep 17 00:00:00 2001 From: Chris Kucharczyk Date: Fri, 3 Jan 2025 15:16:33 +0000 Subject: [PATCH] find the index of the checkout branch parameter in cookiecutter by using its parameter name rather than a fixed index --- ccds/__main__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ccds/__main__.py b/ccds/__main__.py index 470db11c5..668a5329b 100644 --- a/ccds/__main__.py +++ b/ccds/__main__.py @@ -33,9 +33,11 @@ def _main(*args, **kwargs): f.params[1].default = ( "https://github.com/drivendataorg/cookiecutter-data-science" ) - # The fifth parameter is the "checkout" option in the cookiecutter cli + # Find the "checkout" option in the cookiecutter cli (currently the fifth) # Per #389, set this to the currently released version by default - f.params[4].default = __version__ + param_names = [p.name for p in f.params] + checkout_index = param_names.index("checkout") + f.params[checkout_index].default = __version__ return f(*args, **kwargs) return _main