@@ -1255,6 +1255,8 @@ Go has a unique requirement: notebooks MUST have a `func main() {}` wrapper for
12551255 - This ensures imports and `func main () {}` are in the same cell , matching gophernotes expectations
12561256 - The wrapper is injected as boilerplate , then removed from source , then re - injected
12571257 - This ensures the notebook has a clean wrapper without test framework code
1258+ - ** Client connection configuration ** : Boilerplate can include more than just wrappers —it can include client connection setup (e .g ., Redis client initialization with configuration options like `MaintNotificationsConfig `)
1259+ - This allows notebooks to have a working client connection without requiring users to add boilerplate code manually
12581260
12591261** Pattern complexity comparison ** (As Proposed ):
12601262- ** C #** : 5 patterns (class / method wrappers + closing braces )
@@ -1363,6 +1365,53 @@ When adding a new language, ask:
13631365
13641366If yes to any of these , use Strategy 2 (append to first cell ). Otherwise , use Strategy 1 (separate cell ).
13651367
1368+ ### Boilerplate Content Patterns (What Goes in Boilerplate)
1369+
1370+ ** Lesson Learned ** : Boilerplate is not limited to language wrappers and imports . It can include any code that should appear in every notebook generated from that language , including client connection setup and configuration .
1371+
1372+ ** Common boilerplate content ** :
1373+ 1 . ** Language wrappers ** (required by kernel )
1374+ - C #: NuGet package directives (`#r " nuget: ..." `)
1375+ - Go : `func main () {}` wrapper (gophernotes requirement )
1376+ - Java : (typically empty ; dependencies handled via `% maven ` magic commands )
1377+
1378+ 2 . ** Client connection setup ** (optional but recommended )
1379+ - Redis client initialization with connection options
1380+ - Configuration flags (e .g ., `MaintNotificationsConfig ` for Go )
1381+ - Default connection parameters (host , port , password )
1382+ - This ensures notebooks have a working client without manual setup
1383+
1384+ 3 . ** Import statements ** (language - dependent )
1385+ - C #: NuGet directives (not traditional imports )
1386+ - Go : Typically in STEP blocks , not boilerplate (unless needed for wrapper )
1387+ - Java : Typically in STEP blocks , not boilerplate
1388+
1389+ ** Example : Go with Client Connection ** :
1390+ ```json
1391+ {
1392+ " go" : {
1393+ " boilerplate" : [
1394+ " rdb := redis.NewClient(&redis.Options{" ,
1395+ " \t Addr: \" localhost:6379\" ," ,
1396+ " \t Password: \"\" ," ,
1397+ " \t DB: 0," ,
1398+ " \t MaintNotificationsConfig: &maintnotifications.Config{" ,
1399+ " \t\t Mode: maintnotifications.ModeDisabled," ,
1400+ " \t }," ,
1401+ " })" ,
1402+ " func main() {}"
1403+ ]
1404+ }
1405+ }
1406+ ```
1407+
1408+ ** Design considerations ** :
1409+ - ** Boilerplate should be minimal ** : Include only code that 's needed in every notebook
1410+ - ** Avoid language - specific details ** : Don 't include code that only applies to some examples
1411+ - ** Configuration over code ** : Use boilerplate for configuration (connection options ) rather than business logic
1412+ - ** Test with real examples ** : Verify boilerplate works with actual example files before committing
1413+ - ** Document assumptions ** : If boilerplate assumes certain imports or packages , document this in comments or README
1414+
13661415
13671416### Testing Checklist (Language-Specific)
13681417
0 commit comments