Weekly blog post #2

Published: 06/14/2021

What are you working on?

This week I have been working in creating a Brython module as a runestone component. The idea is to be able to write something like this:

.. activecode::
:language: python3
:python3_interpreter: brython
from browser import document, alert, html

def hello(ev):
alert("Hello world! I'm using Brython now")

document <= html.BUTTON("My button", id="button_alert")
document["button_alert"].bind("click", hello)

And it shows you an active code block that can be rendered to do what the inner code specifies. This can be done using the html tag (see image below) and inserting the Brython script. But the idea is to achieve the same using writing only the inner python code (pointed on red in the image)

What have you struggled with?

Familiarizing myself with a new project structure and finding where to put my ideas and my code has been challenging. I have tried to follow similar PR where they implement a new directive to see what files I should change, but even though I am following all the same steps, it isn’t working yet.

What solutions have you found?

Runestone Components is a big project! But I have join their development community on Slack and I have been getting help from my mentors as well to guide me across the project.

I have talked to my mentors about this difficulty I’ve been having. They are reviewing my work, but they suggest looking for other alternatives to make it work. I have two alternatives to make this work: 1. The html tag mentioned above, and 2. Using the .. raw:html directive for the rst files and doing some DOM access with activecode.