1010
1111from .component_utils import extract_base_component_name , extract_engine_info
1212from .components import COMPONENTS
13+ from .services import SERVICES
1314
1415
1516class TemplateGenerator :
@@ -20,6 +21,7 @@ def __init__(
2021 project_name : str ,
2122 selected_components : list [str ],
2223 scheduler_backend : str = "memory" ,
24+ selected_services : list [str ] | None = None ,
2325 ):
2426 """
2527 Initialize template generator.
@@ -28,10 +30,12 @@ def __init__(
2830 project_name: Name of the project being generated
2931 selected_components: List of component names to include
3032 scheduler_backend: Scheduler backend: "memory", "sqlite", "postgres"
33+ selected_services: List of service names to include
3134 """
3235 self .project_name = project_name
3336 self .project_slug = project_name .lower ().replace (" " , "-" ).replace ("_" , "-" )
3437 self .scheduler_backend = scheduler_backend
38+ self .selected_services = selected_services or []
3539
3640 # Always include core components
3741 all_components = ["backend" , "frontend" ] + selected_components
@@ -98,6 +102,8 @@ def get_template_context(self) -> dict[str, Any]:
98102 name in self .components for name in ["worker" , "scheduler" ]
99103 ),
100104 "needs_redis" : "redis" in self .components ,
105+ # Service flags for template conditionals
106+ "include_auth" : "yes" if "auth" in self .selected_services else "no" ,
101107 # Dependency lists for templates
102108 "selected_components" : selected_only , # Original selection for context
103109 "docker_services" : self ._get_docker_services (),
@@ -127,11 +133,20 @@ def _get_pyproject_deps(self) -> list[str]:
127133 Sorted list of Python package dependencies
128134 """
129135 deps = []
136+ # Collect component dependencies
130137 for component_name in self .components :
131138 if component_name in self .component_specs :
132139 spec = self .component_specs [component_name ]
133140 if spec .pyproject_deps :
134141 deps .extend (spec .pyproject_deps )
142+
143+ # Collect service dependencies
144+ for service_name in self .selected_services :
145+ if service_name in SERVICES :
146+ service_spec = SERVICES [service_name ]
147+ if service_spec .pyproject_deps :
148+ deps .extend (service_spec .pyproject_deps )
149+
135150 return sorted (set (deps )) # Sort and deduplicate
136151
137152 def get_template_files (self ) -> list [str ]:
@@ -142,12 +157,21 @@ def get_template_files(self) -> list[str]:
142157 List of template file paths
143158 """
144159 files = []
160+ # Collect component template files
145161 for component_name in self .components :
146162 base_name = extract_base_component_name (component_name )
147163 if base_name in self .component_specs :
148164 spec = self .component_specs [base_name ]
149165 if spec .template_files :
150166 files .extend (spec .template_files )
167+
168+ # Collect service template files
169+ for service_name in self .selected_services :
170+ if service_name in SERVICES :
171+ service_spec = SERVICES [service_name ]
172+ if service_spec .template_files :
173+ files .extend (service_spec .template_files )
174+
151175 return list (dict .fromkeys (files )) # Preserve order, remove duplicates
152176
153177 def get_entrypoints (self ) -> list [str ]:
0 commit comments