Skip to content

Commit a600435

Browse files
committed
Improve documentation and comments in SushiChef getting started example
1 parent 20408ae commit a600435

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

examples/gettingstarted/sushichef.py

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
#!/usr/bin/env python
2+
"""
3+
Getting Started Example: SushiChef
4+
5+
This example demonstrates a minimal SushiChef implementation for creating
6+
a simple Kolibri channel with one topic and one document.
7+
8+
Note:
9+
- This example is intended for demonstration purposes only.
10+
- Some external URLs used here may become unavailable over time.
11+
- The example may involve concepts that are not ideal for absolute beginners.
12+
"""
13+
214
from ricecooker.chefs import SushiChef
315
from ricecooker.classes.files import DocumentFile
416
from ricecooker.classes.licenses import get_license
@@ -12,14 +24,19 @@ class SimpleChef(SushiChef):
1224
"CHANNEL_SOURCE_DOMAIN": "<yourdomain.org>", # where content comes from
1325
"CHANNEL_SOURCE_ID": "<unique id for the channel>", # CHANGE ME!!!
1426
"CHANNEL_LANGUAGE": "en", # le_utils language code
15-
"CHANNEL_THUMBNAIL": "https://upload.wikimedia.org/wikipedia/commons/b/b7/A_Grande_Batata.jpg", # (optional)
27+
"CHANNEL_THUMBNAIL": "https://upload.wikimedia.org/wikipedia/commons/b/b7/A_Grande_Batata.jpg", # Example external image URL (may change or become unavailable)
1628
"CHANNEL_DESCRIPTION": "What is this channel about?", # (optional)
1729
}
1830

1931
def construct_channel(self, **kwargs):
32+
# Create the main channel object
2033
channel = self.get_channel(**kwargs)
34+
35+
# Add a topic node for potatoes
2136
potato_topic = TopicNode(title="Potatoes!", source_id="<potatoes_id>")
2237
channel.add_child(potato_topic)
38+
39+
# Add a document node under the potato topic
2340
document_node = DocumentNode(
2441
title="Growing potatoes",
2542
description="An article about growing potatoes on your rooftop.",
@@ -28,19 +45,22 @@ def construct_channel(self, **kwargs):
2845
language="en",
2946
files=[
3047
DocumentFile(
31-
path="https://www.gov.mb.ca/inr/pdf/pubs/mafri-potatoe.pdf",
48+
path="https://www.gov.mb.ca/inr/pdf/pubs/mafri-potatoe.pdf", # Example external PDF URL
3249
language="en",
3350
)
3451
],
3552
)
3653
potato_topic.add_child(document_node)
54+
3755
return channel
3856

3957

4058
if __name__ == "__main__":
4159
"""
42-
Run this script on the command line using:
43-
python sushichef.py --token=YOURTOKENHERE9139139f3a23232
60+
Run this script from the command line using:
61+
python sushichef.py --token=YOUR_TOKEN_HERE
62+
63+
Replace YOUR_TOKEN_HERE with a valid Kolibri Studio token.
4464
"""
4565
simple_chef = SimpleChef()
4666
simple_chef.main()

0 commit comments

Comments
 (0)