1414import java .util .function .Function ;
1515import java .util .stream .Collectors ;
1616import java .util .stream .Stream ;
17-
1817import software .amazon .smithy .aws .traits .ServiceTrait ;
1918import software .amazon .smithy .codegen .core .CodegenException ;
2019import software .amazon .smithy .codegen .core .SymbolDependency ;
@@ -278,10 +277,16 @@ private static void writeDocsSkeleton(
278277 writer .addDependency (SmithyPythonDependency .SPHINX );
279278 writer .addDependency (SmithyPythonDependency .SPHINX_PYDATA_THEME );
280279 });
281- writeConf (settings , context );
280+ var service = context .model ().expectShape (settings .service ());
281+ String projectName = service .getTrait (TitleTrait .class )
282+ .map (StringTrait ::getValue )
283+ .orElseGet (() -> service .getTrait (ServiceTrait .class )
284+ .map (ServiceTrait ::getSdkId )
285+ .orElse (context .settings ().service ().getName ()));
286+ writeConf (settings , context , projectName );
287+ writeIndexes (context , projectName );
282288 writeMakeBat (context );
283289 writeMakeFile (context );
284- writeIndexes (context );
285290 }
286291
287292 /**
@@ -293,13 +298,10 @@ private static void writeDocsSkeleton(
293298 */
294299 private static void writeConf (
295300 PythonSettings settings ,
296- GenerationContext context
301+ GenerationContext context ,
302+ String projectName
297303 ) {
298- var service = context .model ().expectShape (settings .service ());
299304 String version = settings .moduleVersion ();
300- String project = service .getTrait (TitleTrait .class )
301- .map (StringTrait ::getValue )
302- .orElse (service .getTrait (ServiceTrait .class ).get ().getSdkId ());
303305 context .writerDelegator ().useFileWriter ("docs/conf.py" , "" , writer -> {
304306 writer .write ("""
305307 import os
@@ -325,12 +327,12 @@ private static void writeConf(
325327 html_theme = 'pydata_sphinx_theme'
326328 html_theme_options = {
327329 "logo": {
328- "text": "AWS SDK for Python ",
330+ "text": "$L ",
329331 }
330332 }
331333
332334 autodoc_typehints = 'both'
333- """ , project , version );
335+ """ , projectName , version , projectName );
334336 });
335337 }
336338
@@ -419,20 +421,20 @@ private static void writeMakeFile(
419421 *
420422 * @param context The generation context containing the writer delegator.
421423 */
422- private static void writeIndexes (GenerationContext context ) {
424+ private static void writeIndexes (GenerationContext context , String projectName ) {
423425 // Write the main index file for the documentation
424426 context .writerDelegator ().useFileWriter ("docs/index.rst" , "" , writer -> {
425427 writer .write ("""
426- AWS SDK For Python
427- ====================================================
428+ $L
429+ $L
428430
429431 .. toctree::
430432 :maxdepth: 2
431433 :titlesonly:
432434 :glob:
433435
434436 */index
435- """ );
437+ """ , projectName , "=" . repeat ( projectName . length ()) );
436438 });
437439
438440 // Write the index file for the client section
0 commit comments