@@ -38,7 +38,7 @@ class Options:
3838 warehouse_package_name : str = ''
3939 retry : Optional [Dict [str , Any ]] = None
4040 sample_configs : Tuple [str , ...] = dataclasses .field (default = ())
41- autogen_snippets : bool = False
41+ autogen_snippets : bool = True
4242 templates : Tuple [str , ...] = dataclasses .field (default = ('DEFAULT' ,))
4343 lazy_import : bool = False
4444 old_naming : bool = False
@@ -146,6 +146,17 @@ def tweak_path(p):
146146 # Build the options instance.
147147 sample_paths = opts .pop ('samples' , [])
148148
149+ # autogen-snippets is True by default, so make sure users can disable
150+ # by passing `autogen-snippets=false`
151+ autogen_snippets = opts .pop (
152+ "autogen-snippets" , ["True" ])[0 ] in ("True" , "true" , "T" , "t" , "TRUE" )
153+
154+ # NOTE: Snippets are not currently correct for the alternative (Ads) templates
155+ # so always disable snippetgen in that case
156+ # https://github.com/googleapis/gapic-generator-python/issues/1052
157+ if opts .get ("old-naming" ):
158+ autogen_snippets = False
159+
149160 answer = Options (
150161 name = opts .pop ('name' , ['' ]).pop (),
151162 namespace = tuple (opts .pop ('namespace' , [])),
@@ -157,7 +168,7 @@ def tweak_path(p):
157168 for s in sample_paths
158169 for cfg_path in samplegen_utils .generate_all_sample_fpaths (s )
159170 ),
160- autogen_snippets = bool ( opts . pop ( "autogen-snippets" , False )) ,
171+ autogen_snippets = autogen_snippets ,
161172 templates = tuple (path .expanduser (i ) for i in templates ),
162173 lazy_import = bool (opts .pop ('lazy-import' , False )),
163174 old_naming = bool (opts .pop ('old-naming' , False )),
0 commit comments