@@ -37,7 +37,7 @@ class Options:
3737 warehouse_package_name : str = ''
3838 retry : Optional [Dict [str , Any ]] = None
3939 sample_configs : Tuple [str , ...] = dataclasses .field (default = ())
40- autogen_snippets : bool = False
40+ autogen_snippets : bool = True
4141 templates : Tuple [str , ...] = dataclasses .field (default = ('DEFAULT' ,))
4242 lazy_import : bool = False
4343 old_naming : bool = False
@@ -132,6 +132,17 @@ def tweak_path(p):
132132 # Build the options instance.
133133 sample_paths = opts .pop ('samples' , [])
134134
135+ # autogen-snippets is True by default, so make sure users can disable
136+ # by passing `autogen-snippets=false`
137+ autogen_snippets = opts .pop (
138+ "autogen-snippets" , ["True" ])[0 ] in ("True" , "true" , "T" , "t" , "TRUE" )
139+
140+ # NOTE: Snippets are not currently correct for the alternative (Ads) templates
141+ # so always disable snippetgen in that case
142+ # https://github.com/googleapis/gapic-generator-python/issues/1052
143+ if opts .get ("old-naming" ):
144+ autogen_snippets = False
145+
135146 answer = Options (
136147 name = opts .pop ('name' , ['' ]).pop (),
137148 namespace = tuple (opts .pop ('namespace' , [])),
@@ -143,7 +154,7 @@ def tweak_path(p):
143154 for s in sample_paths
144155 for cfg_path in samplegen_utils .generate_all_sample_fpaths (s )
145156 ),
146- autogen_snippets = bool ( opts . pop ( "autogen-snippets" , False )) ,
157+ autogen_snippets = autogen_snippets ,
147158 templates = tuple (path .expanduser (i ) for i in templates ),
148159 lazy_import = bool (opts .pop ('lazy-import' , False )),
149160 old_naming = bool (opts .pop ('old-naming' , False )),
0 commit comments