@@ -67,7 +67,6 @@ def __init__(
67
67
else :
68
68
loader = package_loader
69
69
self .env : Environment = Environment (loader = loader , trim_blocks = True , lstrip_blocks = True )
70
- self .env .globals .update (utils = utils )
71
70
72
71
self .project_name : str = config .project_name_override or f"{ utils .kebab_case (openapi .title ).lower ()} -client"
73
72
self .project_dir : Path = Path .cwd ()
@@ -82,6 +81,13 @@ def __init__(
82
81
self .version : str = config .package_version_override or openapi .version
83
82
84
83
self .env .filters .update (TEMPLATE_FILTERS )
84
+ self .env .globals .update (
85
+ utils = utils ,
86
+ package_name = self .package_name ,
87
+ package_dir = self .package_dir ,
88
+ package_description = self .package_description ,
89
+ package_version = self .version ,
90
+ )
85
91
86
92
def build (self ) -> Sequence [GeneratorError ]:
87
93
"""Create the project from templates"""
@@ -247,7 +253,6 @@ def _build_api(self) -> None:
247
253
api_init_template = self .env .get_template ("api_init.py.jinja" )
248
254
api_init_path .write_text (
249
255
api_init_template .render (
250
- package_name = self .package_name ,
251
256
endpoint_collections_by_tag = endpoint_collections_by_tag ,
252
257
),
253
258
encoding = self .file_encoding ,
@@ -261,7 +266,7 @@ def _build_api(self) -> None:
261
266
endpoint_init_path = tag_dir / "__init__.py"
262
267
endpoint_init_template = self .env .get_template ("endpoint_init.py.jinja" )
263
268
endpoint_init_path .write_text (
264
- endpoint_init_template .render (package_name = self . package_name , endpoint_collection = collection ),
269
+ endpoint_init_template .render (endpoint_collection = collection ),
265
270
encoding = self .file_encoding ,
266
271
)
267
272
(tag_dir / "__init__.py" ).touch ()
0 commit comments