The story I’m about to tell celebrates an epic adventure in making stuff work.
The most famous SBC is, of course, the Raspberry Pi, but there are many alternatives, each with their own different strengths and areas of focus. Warren explained that his aim was, “to build a $99 less complete SBC/computer, that can run YouTube, basic office software and be used to tinker”.
The problem is Mu relies on other projects and some of this software doesn’t work on all platforms. For example, Mu uses the PyQt5 library to draw and control its user interface. However, the folks who make PyQt only release versions built for Windows, Mac and a limited number of Linux versions running on an even more limited selection of hardware. It soon became clear that Warren’s SBC wasn’t a supported platform.
Here’s where Warren demonstrated epic technical problem-solving skills.
Over the course of a few days he patiently, diligently and indomitably worked through a series of over obscure problems and trials to achieve success which he celebrated with a tweet and photographic proof.
As you’ll see below, this took a huge amount of work.
So why the mention of crossing rivers in the blog title?
The Chinese leader, Deng XiaoPing described his economic reforms as, “摸着石头，过河” (crossing the river by feeling the stones). This is a wonderful characterisation of what it feels like when trying to achieve a difficult task for the first time without any help or guidance. The important thing is to be determined, pragmatic and careful to ensure you take the right steps to reach your goal. These attributes, along with an obvious technical talent, allowed Warren to cross the river to a working version of Mu.
I mentioned to Warren that other people trying to make PyQt5 work on different platforms would probably appreciated a description of the steps he took to achieve a successful build. I offered to blog these steps if he shared them, and being a generous soul, Warren emailed me the steps yesterday.
So, without further ado… here are Warren’s notes for future reference. Thank you for all the hard work Warren..!
These notes should work on any Debian/Ubuntu platform. If you have any questions please email Warren (who gave me permission to add his email details to this blog post).
sudo make installwhen
make installis required.
Setup basic tools and libraries
sudo apt-get install build-essential qt5-default git python3-distutils python3-pip python3-dev libxmlsec1-dev libxml2 libxml2-dev libsdl1.2-dev python3-setuptools python3-numpy python3-opengl libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsmpeg-dev libsdl1.2-dev libportmidi-dev libswscale-dev libavformat-dev libavcodec-dev libtiff5-dev libx11-6 libx11-dev fluid-soundfont-gm timgm6mb-soundfont xfonts-base xfonts-100dpi xfonts-75dpi xfonts-cyrillic fontconfig fonts-freefont-ttf libfreetype6-dev libqt5charts5 libqt5charts5-dev libffi-dev python3-gpiozero virtualenv libqt5serialport5-devlibqt5serialport5 libqt5svg5 libqt5svg5-dev libqt5serialport5-dev
DO NOT INSTALL
python3-pyqt5 python3-pyqt5.qsci python3-pyqt5.qtserialport python3-pyqt5.qtsvg.
Required Python Packages
wget https://pypi.python.org/packages/48/69/d87c60746b393309ca30761f8e2b49473d43450b150cb08f3c6df5c11be5/appdirs-1.4.3.tar.gz gunzip appdirs-1.4.3.tar.gz tar -xvf appdirs-1.4.3.tar cd appdirs-1.4.3 sudo python setup.py install cd .. pip3 install pycodestyle pip3 install pyflakes pip3 install serial pip3 install pyserial git clone https://github.com/k-bx/python-semver cd python-semver sudo python3 setup.py install cd ..
Setup SIP (needed by PyQt5)
wget https://www.riverbankcomputing.com/static/Downloads/sip/4.19.15/sip-4.19.15.tar.gz gunzip sip-4.19.15.tar.gz tar -xvf sip-4.19.15.tar cd sip-4.19.15 python3 configure.py make sudo make install python3 configure.py --sip-module PyQt5.sip --no-dist-info --no-tools cd ..
wget https://www.riverbankcomputing.com/static/Downloads/PyQt5/5.12.1/PyQt5_gpl-5.12.1.tar.gz tar -xzvf PyQt5_gpl-5.12.1.tar.gz cd PyQt5_gpl-5.12.1 python3 configure.py make -j 4 # (the -j x, is number of cores on the processer, speeds up compiling) sudo make install cd ..
wget https://www.riverbankcomputing.com/static/Downloads/QScintilla/2.11.1/QScintilla_gpl-2.11.1.tar.gz tar -xzvf QScintilla_gpl-2.11.1.tar.gz cd QScintilla_gpl-2.11.1//Qt4Qt5 qmake make -j 4 (the -j x, is number of cores on the processer, speeds up compiling) sudo make install cd Python python3 configure.py --pyqt=PyQt5 make sudo make install cd ../..
wget https://www.riverbankcomputing.com/static/Downloads/PyQtChart/5.12/PyQtChart_gpl-5.12.tar.gz tar -xzvf PyQtChart_gpl-5.12.tar.gz cd PyQtChart_gpl-5.12 python3 configure.py cd ..
wget https://files.pythonhosted.org/packages/71/4f/b3a521bb4db6ef696bcffca58b833aa2e84f7e7c142951d506d840ced57a/pygame-1.9.5.tar.gz tar -xzvf pygame-1.9.5.tar.gz cd pygame-1.9.5 sudo python3 setup.py cd ..
Setup Cryptography Library
sudo pip3 install cryptography --no-binary cryptography
Install and Configure Mu
virtualenv -p /usr/bin/python3 --system-site-packages ~/mu-venv source ~/mu-venv/bin/activate git clone https://github.com/mu-editor/mu.git ~/mu-source cd ~/mu-source pip3 install -r requirements.txt
setup.pyfile so the
install_requiressection looks like this:
install_requires = ['pycodestyle==2.4.0', 'pyflakes==2.0.0', 'pyserial==3.4', 'pyqt5==5.12.1', 'qscintilla==2.11.1', 'qtconsole==4.3.1', 'matplotlib==2.2.2', 'pgzero==1.2', 'PyQtChart==5.12', 'appdirs>=1.4.3', 'gpiozero>=1.4.1', 'guizero>=0.5.2', 'pigpio>=1.40.post1', 'Pillow>=5.2.0', 'requests>=2.19.1', 'semver>=2.8.0', 'nudatus>=0.0.3', "black>=18.9b0; python_version > '3.5'"]
sudo python3 setup.py installto install Mu!
Finally, there needs to be some post-install configuration:
mu.editor.desktopfile found in the
[Desktop Entry] Name=mu-editor Comment=Simple Python editor Exec=mu-editor Icon=/usr/share/pixmaps/mu.png Terminal=false Type=Application MimeType=text/plain Categories=GTK;Development;TextEditor; Keywords=Python;text;editor; InitialPreference=6
Download the icon.
cd /usr/share/pixmaps sudo wget https://codewith.mu/img/brand.png sudo mv brand.png mu.png
We have just released the first “alpha” of the upcoming 1.1 version of Mu. To try it, follow the links on Mu’s download page. Mu is a team effort, so many thanks to all the volunteers who have contributed in innumerable ways to make this happen.
This is the first of several “alpha” releases for the next version of Mu. Over the coming weeks we intend to release newer versions based upon feedback from you, our users. Please don’t hesitate to get in touch if you have comments, suggestions or have found a problem (bug). The more feedback we get, the better. While we carefully read all feedback, we can’t always respond to nor address such feedback (remember, we’re all volunteers). If you’re interested in what we’re up to, all our development work happens in the open on GitHub and you can even chat directly with us (we’re friendly, so come say, “Hi”).
What exactly do we mean by “alpha”..?
Essentially, “alpha” means we’re adding new features, and there may be bugs. When we’re happy with the new features we’ll switch to “beta” releases, where we only polish and fix problems with the features created so far. When we feel the “beta” release is stable enough, well tested and checked by a large number of different sorts of user, then we’ll release the “final” 1.1 version which will replace the current version we recommend you download from the website. The current 1.0 version of Mu will no longer be supported and our advice will be for you to upgrade.
So, what’s new in this first “alpha” release?
The first new feature is the ability to install third party Python packages. There are almost 200,000 community created packages on the Python Package Index (PyPI ~ pronounced Pie-Pee-eye).
The example above shows us installing a silly Python module called Arrr which converts English into Pirate speak. First we open the admin dialogue, select the “Third Party Packages” tab and simply type into the text area the name of the package we want to install. Then Mu shows us its progress downloading and installing the new package (and any of its dependencies). Afterwards we can use the
arrrmodule in both our code and from the REPL. Finally, if we open the “Third Party Packages” tab in the admin dialogue again, we can see Arrr listed as an installed package. To uninstall it, simply remove its entry in the text area and Mu does the rest. Once uninstalled
arrris no longer available to us. Importantly, the packages installed by Mu are only available to Python run from Mu. We do this because the universal feedback from school system administrators is that they want Mu to be completely isolated from anything else that may be installed on the computer.
Next, we have a really useful feature for beginner programmers who want help writing tidy looking code. There is an amazing tool, called Black, which analyses code and reformats it into readable code (it’s called “Black” because you can have any type of reformatting, so long as it’s Black’s). The creator of Black is a talented developer called Łukasz Langa who has a son learning to code with, you guessed it, Mu. I recently had the great pleasure of catching up with Łukasz when he was in London and he suggested Black might be helpful for beginners. In the time it took me to catch my train home, Łukasz had created the code needed to make this work. Some testing with teachers and beginners confirmed how useful this feature would be.
In the example above we see some “messy” looking Python code. There’s no gap between the
importstatement and the rest of the code, items in a list are single-quoted strings (which makes it hard to use apostrophes) and a second list is too wide for the editor. Once the new “Tidy” button is clicked, Black immediately reformats the code to correct these visual niggles. It’s important to note that the code itself remains unchanged, it has merely been reformatted. Furthermore, if your code contains invalid Python then Black will signal this to Mu and the “Check” function will run to highlight the problems which should be fixed before running the “Tidy” function again.
The final new feature is a completely new mode created by Danish computer scientist and teacher Martin Dybdal. The new mode targets the small, network enabled boards made by Espressif: ESP8266 and ESP32. These boards are special because they connect to the Internet via WiFi, are very cheap, easily obtained and make great development boards for simple Internet of Things projects. Happily MicroPython runs on these boards making them ideal for educational use.
With the help of Murilo Polese we were able to test the new mode and refine the capabilities to the following features:
- A “Run” button which will use a serial connection to push the code in the current tab onto the board to be run immediately.
- A files button which works in exactly the same way as the micro:bit mode:
drag Python files to or from the board. If one of the files is called
main.pythen it will run automatically when the board starts.
- A REPL to connect to MicroPython running on the attached board.
- A Plotter, which turns tuples of numeric data read from the board via the serial connection into pretty plots. This works in exactly the same way as in the other modes which use the plotter.
This release also includes quite a number of bug fixes and behind-the-scenes tidy ups. You can find out the full details in the project CHANGELOG.
What’s still to come..? The following is in the pipeline:
- A new mode for simple web development with Python, HTML and CSS. Beginners will be able to very quickly create and view simple dynamic websites (such as a personal blog).
- A REPL for PyGameZero mode, so you can interactively poke around with the code of your game!
- Some new admin settings which will allow you to configure how Mu looks and behaves (especially important for dyslexic users for whom the most effective colour scheme for reading code is a personal discovery).
- A new mode for the Calliope board (subject to extensive testing). The Calliope is Germany’s answer to the micro:bit, and it runs MicroPython!
As always, constructive critique, ideas and bug reports are most welcome.
Watch this space!
Sean is one of the co-hosts (along with his colleague Kelly Schuster-Pared) of the excellent Teaching Python podcast. I’ve been working through the available episodes and constantly find myself grinning like the Cheshire Cat as I’m reminded of my own experiences as a teacher (of music), and learn how this talented duo of pedagogical pros practice the art of teaching technology, and especially Python. I heartily recommend you take a listen.
Onto the intriguing student project…
Dilnaam’s project is a sort of interactive face mask, made with an Adafruit Circuit Playground Express, CircuitPython and Mu. The mask allows folks to become aware of and manage their stress levels (very useful for teachers!). Dilnaam explains:
This mask was made to demonstrate how a CircuitPlayground Express could be used to measure body temperature and indicate stress levels. My theory is that body temperature is an indicator of stressful feelings and that people can better control their stress when they have a visual indication of their own stress state.
In the picture below, we can see see Sean bravely acting as a test subject as (presumably) Dilnaam looks on while making adjustments to the code in Mu. A teacher acting as a test subject for their students shows a wonderful sense of trust. This is great to see! :-)
This scene reminds me of Wallace and Gromit, where the silent, loyal and infinitely patient Gromit aids the cheese obsessed Wallace in testing intriguing inventions made from advanced technology and household items cleverly put together in unexpected ways (usually with unfortunate repercussions for poor old Gromit). However, I notice the Circuit Playground Express board attached to the side of Sean’s head is glowing green, demonstrating the test was a success (well done Sean for being such a chilled out test subject).
Dilnaam’s code is beautifully simple and I love the helpful comments. I’m especially pleased Mu’s plotter feature is used to monitor the test subject’s temperature.
Finally, here’s Dilnaam’s hardware, in all its glory.
Dilnaam, those of us who make Mu would like to congratulate you on such a wonderfully simple yet intriguing project. Keep up the great work! We look forward to hearing about the amazing things you and your classmates invent in the future.
This post celebrates the extraordinarily talented and inventive friend of Mu, Mr. Les Pounder.
I first met Les at PyCon UK back in 2013. I was coordinating the education track where we had around 40 teachers and 100 kids turn up over two days. This was an impossible endeavour for a single person to take on. Happily, the founding principle of the education track was to bring together, without prejudice, a collaborative and open community of people involved or interested in Python in education. Les was one of several folks who selflessly contributed for the benefit of the whole community: be it moving furniture to turn meeting rooms into classrooms, setting up and configuring equipment, helping out as a teaching assistant or participating in conversations and debates around Python in education, Les was making positive contributions. He was a role model who showed he was open, welcoming and helpful to anyone who turned up.
Since 2013, Les has built a career on these invaluable, rare and unique attributes. He writes for various “open source” related magazines, runs and contributes to educational events, speaks at and continues to contribute to community events, and creates fun and affordable projects which often feature the inventive use of components and parts purchased from Poundland (a UK based shop where all items cost £1).
The following project, a CircuitPython twist on the “steady hand” game, is a case in point:
What I love about this project is how Les has created “hardware” that anyone could build themselves and the code needed to run the project is only 32 lines of very simple CircuitPython running on an Adafruit Circuit Playground Express:
import time import board from digitalio import DigitalInOut, Direction, Pull import audioio spkrenable = DigitalInOut(board.SPEAKER_ENABLE) spkrenable.direction = Direction.OUTPUT spkrenable.value = True led = DigitalInOut(board.D13) led.direction = Direction.OUTPUT wand = DigitalInOut(board.A1) wand.direction = Direction.INPUT wand.pull = Pull.DOWN def play_file(filename): print("Playing file: " + filename) wave_file = open(filename, "rb") with audioio.WaveFile(wave_file) as wave: with audioio.AudioOut(board.A0) as audio: audio.play(wave) while audio.playing: pass print("Finished") while True: if wand.value: # button is pushed led.value = True print(True) play_file("buzzer.wav") time.sleep(0.5)
You can find a treasure trove of these sorts of projects at Les’s personal website, and the sheer number of such projects is testament to Les’s extraordinary contribution to the wider community of programmers, educators and learners. Thank you Les for your amazing work.
But I was recently struck by Les’s most recent blog post, in which he describes a series of tragic and unwelcome events in his life. What made the biggest impression on me was Les’s indomitable spirit and unflinching sense of service to others. As he says, when he concludes his post:
If you have the means to help someone, even something as trivial as picking up something they drop, then do so. If you do not have the means then the opportunity will present itself in the future, at a time when you may have the means.
I heartily recommend you read the whole article.
We are lucky to have such a talented and big hearted member of our community. We can all learn from his example. We could all strive to be “more Les”.
Why not serenade your Valentine with Mu, a distance sensor, speaker, Raspberry Pi and some nifty Python code which uses GPIOZero to turn the hardware into a romantic Theramin..?
It’s only four lines of code, thus showing how easy it is to make cool hardware hacks with Mu, Python and GPIOZero:
from gpiozero import TonalBuzzer, DistanceSensor buzzer = TonalBuzzer(20) ds = DistanceSensor(14, 26) buzzer.source = ds
The end result is full of love (for GPIO related shenanigans):
This is a bug fix release with numerous contributions from our growing community of volunteer developers. Collectively, we’ve managed to fix and improve many of the things users have been telling us about. Please see the release notes (linked to above) for details of the fixes made.
As always, if you spot any bugs, please don’t hesitate to let us know.
Thanks especially to GitHub user @Linguini2004, Craig Steele, John Guan, Tiago Montes, Tim Golden, Carlos Pereira Atencio, GitHub user @wu6692776, Eberhard Fahle, Limor Fried, Tim McCurrach and Brent Rubell for their valuable contributions.
Onwards and upwards! Next stop 1.1.
Our friends, Mu allies and all-round superheroes at Adafruit have asked, “What do you want from CircuitPython in 2019”? This is my personal response. :-)
For those of you who don’t know, CircuitPython is Adafruit’s “flavour” of the amazing feat of engineering that is MicroPython. MicroPython is a complete reimplementation of Python 3 for microcontrollers and embedded devices. MicroPython has all the features of regular Python (sans standard library) and can run in as little as 8k of RAM. CircuitPython builds on MicroPython’s rock-solid foundation with education/beginner friendly libraries and APIs. They provide a consistent way to interact with Adafruit’s amazing line of boards for learning about and hacking around with electronics. The following video (featuring Adafruit’s founder, Limor “ladyada” Fried, and friends) sums up their aims pretty well.
Mu has an Adafruit mode which makes it very easy to program Adafruit devices running CircuitPython. This is how Mu and CircuitPython are related in a technical sense, above and beyond the complementary educational aims of both projects.
There are two items on my list for CircuitPython in 2019. The first is easy, the second is hard:
- It would be really helpful if there were a friendly CircuitPython landing page to which we can point folks and from which visitors can easily find the chat, tutorials, list of supported boards, source code, technical docs and other good stuff.
- Continue to inspire a community of learners (no matter how long we’ve been programming, we’re all still learners, right?).
The second point needs more explanation.
The CircuitPython folks at Adafruit take great care and attention over how they facilitate the community growing around the project. The result of their efforts is a welcoming, diverse and supportive group of people championing CircuitPython through their projects, code and interactions with the wider “tech” community.
CircuitPython is one of the best examples of this sort of community organising that I know of.
Why is this important?
At a time when technology is finding its way into every aspect of our lives it is important that everyone has access to the tools and knowledge needed to learn how to take control of their digital world. Rather than being tech “consumers” I hope folks become tech “makers” armed with the skills needed to make the digital world reflect their own desires and needs.
Sadly, the tech world has a history of being open only to certain types of people (mainly people like me: white straight dudes with the privilege of money to buy equipment and time to attend to their education). It means technology usually only reflects the desires and needs of just these sorts of people.
We can do better than this skewed state of affairs.
In a very practical sense Adafruit’s CircuitPython is an antidote to the exclusion of folks in tech. They are fostering an open and inclusive community around an easy-to-learn and affordable project that helps folks learn about technology.
Such community building is incredibly hard to pull off and sustain. So my wish is that Scott, Kattni, Dan, Phil, Limor and all the others working so hard in this respect with CircuitPython find the energy, support and compassion needed to continue to inspire the community growing around their amazing project.
Best wishes from your friends working on Mu!
The next version of Mu will be 1.1. This post describes how we’re going to get there and what to expect on the way.
The first thing you should know is that 1.1 will have new features including new modes, new capabilities and new ways to configure Mu. Some of the new modes have been kindly written by new contributors. The new capabilities and ways to configure Mu are based upon valuable feedback from folks in the community. Thank you to everyone who has contributed so far.
The second thing you should know is that 1.1 will have many bug fixes. Since Mu 1.0 was released a huge number of people have started to use it and, inevitably, found and reported bugs. Thank you for all the valuable feedback, please keep it coming! We hope to address as many of the problems as possible.
The final thing you should know about is the release schedule for Mu 1.1. Very soon, a version 1.1.0.alpha.1 will be released: this will contain some of the new features and updates and will definitely contain bugs. It will be followed with a number of further alpha releases as new features are created and/or contributed to this version of Mu. When we’re happy we have all the features we want, we’ll release a version 1.1.0.beta.1. The focus of the various beta releases will be to test and fix any bugs we may encounter. However, the beta releases will be “feature complete” and represent a good preview of what version 1.1 will look like. Once there are no more known bugs, or those bugs that remain are “edge cases” that can be documented, we’ll release the final 1.1.0 version which will be available for official download. The old 1.0.* version of Mu will still be on the website, but no longer officially supported.
Such work will touch all aspects of the Mu project: the editor, the associated projects for generating resources for the editor, the documentation and the website too. It will also mean the translations will need to be checked and updated to deal with any UI changes.
Some of you may be contributors waiting for us to merge your work or respond to your suggestions. We promise we will always be respectful and supportive of your efforts. However, we may not accept all contributions. This reminds me of my work as a musician: when auditioning players for a band or orchestra you meet a huge number of talented musicians, but there may only be the need for one flute player. Any number of the musicians who auditioned could have easily played the flute part, but the person who was offered the job was the one who it was felt fitted in with the rest of the orchestra. Likewise, if we don’t merge your contribution, it’s likely that it’s because it either doesn’t quite fit with our vision for Mu, or the capabilities it provides are met in some other preferred way. We will, of course, explain our decisions via discussion on the relevant pull requests. Nevertheless, please don’t be disheartened if we decline your contribution – it’s certainly not a criticism of your efforts (which we value hugely).
This is a LOT of work, and we ask you to be patient as we volunteer our time to make the next version of Mu. However, we’re a free software project developed in the open and so we would love to hear your input as work progresses. Wouldn’t it be cool to be able to say, “you see that feature? I suggested that”.
Together, we can collaborate to make Mu a better editor for beginner programmers and those who support them.
Mu is not a solo effort. Many folks have contributed to Mu, and I will be eternally grateful for their work. With the spirit of recognising the voluntary contributions of others in mind, I’m going to write about some of our most prodigious programmers. First up is Zander Brown.
Zander, like Top Gear’s the Stig, is a bit of a mystery.
Until recently, nobody had ever met him in real life, and all interactions with Zander were via copious GitHub comments, pull requests and bug fixes.
Some said he was an alien being from another dimension, others claimed him to be a rogue artificial intellegince running rampant in random Git repositories, yet more people whispered in hushed tones that he was merely a pseudonym for Bill Gates, coming out of retirement to contribute to free software projects.
All I can say is that I’m thankful for his considerable contributions to Mu’s code base, eagle-eyed code reviews and seemingly limitless Pythonic knowledge.
Actually, when I met Zander for the first time in July, it turned out he’s a 17 year-old studying for his A-levels (the exams teenagers sit in the UK to help them to get into university). He’s doing A-levels in Maths, Physics and Computer Science. He’s third from the left in the picture below:
I want to bring your attention to how wonderful this is ~ we have several related things going on:
- We have a courteous, knowledgable and extraordinarily competent contributor to Mu.
- Zander’s participation is evidence that the Mu project is welcoming, safe and supportive enough to encourage the participation of teenage coders.
- Zander, a student who uses Mu, is helping to develop Mu. I would very much like to foster this sense of ownership in Mu’s users, be they students, teachers or professional software developers.
I recently asked Zander how he got into Mu. His reply was interesting in that he typed “micro:bit Python” into a search engine after his school had some of the early versions of the device delivered to teachers.
The head of department got the blue one, the other CS teacher had the green, leaving the yellow spare and the rest, as they say, is history…
He started coding with MSWLogo but has, more recently discovered Python and started making contributions to various open source projects:
It’s nice to work on things that help others be that the developer (fix this, add that) or the users (CS teachers!)
Recently I’ve been contributing the GNOME which has the ‘coolness’ that you are in country A working with person in country B to make something that’ll be used in A, B, C & D but also being a tad ‘meta’ when you’re fixing a bug older than you.
Right now, I feel very very old. :-)
How does he find working on Mu?
Great fun, first & only time i’ve met in person with others working on a project and the T-shirt isn’t bad either :-)
Been nice to play on a range of things within the same project from fighting QSS to walking the python syntax tree whilst knowing people are using it in the real world (TAA just switched form GCSE Java to Python so Mu is now used with the lower years)
(When we released Mu 1.0 I made sure all of the major contributors and friends of Mu got t-shirts to celebrate. Thanks to my hugely talented friend Steve Hawkes, Zander got a t-shirt with the “Stig” avatar shown at the top of this post.)
Zander, thank you for your continued contributions and best of luck with your studies (he wants to go on to study Computer Science at university). I have no doubt that wherever you end up studying will soon learn how fortunate they are to have such a talented student as you.
I recently had the great pleasure of visiting Wollaston School to see Steve Foster use Mu in his classroom. Here he is in action, in perhaps the most “teacher-ish” photograph you’ll see for a long time:
This wasn’t my first visit to see Steve. He very kindly allowed me to observe his lessons back in 2017 when I was researching how learners and teachers engage with software development tools. His was the first of several schools and code clubs I visited for this purpose and, in addition to observing lessons, I interviewed him and some of his colleagues. In fact, it was as a direct result of chatting with the network administrators at Steve’s school that so much effort was put into making Mu easy to install. I was very pleased to hear that the very same network administrators had easily managed to install Mu on the computers in Steve’s classroom.
Achievement unlocked! :-)
On this visit I observed two lessons: a year 10 GCSE class (students turn 15 during year 10, and GCSE is the examination all students take at age 16), and a year 9 computing lesson (students turn 14 in year 9 and decide their “options” [which GCSE courses to take] during this academic year).
Both classes were exceptionally well behaved and engaged and the students were friendly and enthusiastic to learn. They’re a credit to themselves, Steve and their school.
I was simply introduced to the students as “Nicholas - a software developer” and played the role of a teaching assistant. This prompted a sense of nostalgia for me. Having students say, “Sir, I’m stuck on this problem” made me remember my time as a secondary head of music all those years ago and it was fun to collaborate with and support young people in their learning. There are some aspects of teaching which are extraordinarily rewarding and a privilege to experience – this was one such an occasion.
The students in year 10 knew what they were up to and were already familiar with Mu. It was good to see them use the editor with such fluency ~ to the extent that they were concentrating on their coding problem rather than getting side-tracked by their development environment. The first time I visited the school, I seem to remember students using some sort of online Python tool and I spent much of my time trying to help them fix the odd state into which they had got themselves. I also had a great sense of satisfaction when I saw how many of them were using the “Check” button to report potential problems with their code. They told me they found this especially useful when they ran their code and ended up with a syntax error. The “Check” button visually points out the problematic line and describes the problem. Far better than wading through terse computer-ese.
The year 9 class was especially enjoyable since I was watching their first encounter with Mu. In the previous academic year (before Mu 1.0 was released) they had been using IDLE as a development environment. Being able to observe their first contact with Mu was an amazing opportunity.
I wasn’t disappointed.
Steve started the lesson by introducing Mu as a new Python editor and then gave the class a few minutes to poke around with it before asking them to report back on what they’d discovered.
Within seconds, one of them had found the “Theme” button and toggled through to “night” mode. This was followed by a hilarious few seconds of excited whispering as the students all tried to turn their Mu editor into “night” mode. Within about a minute, everyone had “night” mode enabled and the class were feeling suitably “Hollywood hacker-ish”.
Some kids found the “Check” button while others enjoyed zooming in and out to extreme magnifications of their code. Most importantly, the feedback seemed positive and the students enjoyed playing with Mu (yes, “playing” is perhaps the right word).
Steve then asked them to “code along” a Magic 8 Ball script. Steve would explain some code and demonstrate it working, then ask the kids to type it in and check their version was working. After that, he’d repeatedly add more features, while giving the students an opportunity to ask questions, until the program was finished. This is exactly what Steve is doing in the photograph at the top of this blog post.
This activity was particularly fun since the students could define their own mysterious sounding Yes/No answers for the “magic 8 ball”. In a very teenager-y turn of events, one student cast their answers totally in the context of resolving relationship problems. Again, Mu didn’t cause any issues and the students could simply concentrate on customising their script.
At the end of both lessons I was given 10 minutes to tell the students a little bit about what I do as a software developer and enjoyed answering their questions. When Steve revealed I was the creator and maintainer of Mu, the year 9 class gave me a round of applause (after one girl started clapping loudly on her own, and then shouted to the rest of the class something along the lines of, “Give this guy some respect won’t ya..?”).
After the lessons Steve and I spent some time together in an interview / de-brief session. He provided more context about how Mu was used in his lessons and all the feedback I have received, be it from teacher or students, will find its way into improvements in the next version of Mu.
If you are a teacher using Mu in your classroom, please don’t hesitate to get in touch. We’d love to hear how you’re getting on and learn about the ways we can improve your own and your students’ experience of learning to program in Python.
Thanks to Steve and his students for giving me the rewarding experience of seeing Mu used in “real world” learning situations. Keep up the great work! :-)
Last week was PyWeek, where entrants have a week to make a game on a given theme using Python. Myself and my buddy Andrew Smith decided to form a team called Code to Joy and write something using Mu and PyGameZero. At the start of the week the theme was revealed as “flow”. We ended up creating “Traffic Flowmageddon” with gameplay like 80’s classic Frogger, a look similar to the 90’s classic Grand Theft Auto and with a dash of Shaun of the Dead thrown in for some timely Halloween spice. The opening screen pretty much sums up the character of the game:
It was fun to work in a team. I mainly concentrated on the code and Andrew spent time on the sound effects and music. The graphical assets were either bodged together by us or were free-to-use downloads from the internet. What was particularly pleasing was how quickly we were able to put together the scaffolding of the game in a very short period of time and just under 100 lines of Python:
Yes, that’s quite an abstract looking game (none of the graphical assets had been created), but the labelled boxes and fact that stuff is moving around demonstrated the core of the game worked well. Having said that, simply adding some proper graphics and an animation on the hero sprite that the player controls makes a huge difference! It actually looks like a game:
At this point in the development of the game, one of us had the idea of adding zombies and, since I’d been tweeting about our progress, we were getting suggestions for other features from friends (such as potholes in the road which would slow you down, or drivers with no lane discipline).
The zombies make a big difference since they force you off the pavement and into the flow of traffic.
In the meantime, Andrew had been putting together music and sound effects as well as the code to load and play them at the appropriate moments in the game. This was especially rewarding to hear since sound and music add so much to the atmosphere. Andrew found some appropriately spooky sounding music, a “happy tune” to play when the game completed and a whole host of sounds for the zombies and traffic (for example, if you get too close to one of the London taxi cabs, the driver will shout at you).
As the video shows, the finished game works quite well for something cobbled together in just a week. Most importantly, it’s all done with Mu and PyGameZero in around 400 lines of Python.
I’d heartily recommend anyone participate in future PyWeeks. The organiser, Dan Pope (who also created PyGameZero) has done a fantastic job of creating such a fun competition with a community of coders creating such joyously goofy games.
Long may it last!
Thanks to the efforts of volunteer teachers, young Chinese students are using Mu to learn Python.
My Chinese friend explains,
“I am a programmer in Hefei China, my colleagues and I give Python classes to more than 20 children every Tuesday afternoon. (A total of 14 weeks.)
This is a course of interest for the students who is interesting with programming, it’s free and we are volunteers. We have a plan to teach Python, from the base to the high, not that high.”
He goes on to explain how learning to code is making a big impression of some of his students and their families.
“The little boy in the [following] photo inspired me, he is very clever and he can answer almost every problem in class.
This boy father is so seriously to this class, he find a app which can coding in iphone, and he learn it himself to teach his son after school.
My first baby is coming soon, I think may be I should learn from him, you know he has no experience in programming and in his daily job there is no computer in front of him. Father’s love is great and will drive us to do many things. One father is more than a hundred schoolmasters.”
I have to admit that I was deeply moved by this explanation. I was also amazed to see that the teachers and students use a sort of chat app for sharing and marking homework.
It makes me extraordinarily happy to know that our collective efforts in translating Mu for learners who don’t have English as a first language are paying off. I’d like to applaud the efforts of the volunteer teachers in China who are helping to nurture the next generation of Python programmers. Finally, I would like to wish their students (and parents!) the very best of luck when learning to use Python. You are learning a skill that will help you flourish in our modern technological world. Please keep up your efforts and, if you have time, keep sharing what you have been doing. Perhaps, in the future, you will speak at PyCon China.
I’m struck by how similar programming is to another passion of mine: music. Both are cross cultural and international endeavours. By sharing our code, learning from each other and telling stories of programming we bring our world closer together.
My Chinese friend ends by saying,
“Thank you for your work, Mu is so cool, Mu is best for us.”
I’m so pleased you think so! Thank you!
This second guest post, from Thierry Chantier, describes how the French Python community is helping young programmers with Mu. I’m especially pleased that he’s submitted his blog in French. We love to celebrate the efforts of Mu users all over the world!
It’s a common cliché: french are not good english speakers. But hey, micro:bit, Monthy Python … and Mu comes from the UK, we have to deal with it. (Oh, I forgot the Sex Pistols) The rest of this article will be in french, but that won’t be a problem, you are all french fluent, aren’t you? ;) If Nicholas need some training, I know how to organize something in may 2019 in Lyon :)
Tout d’abord, je me présente : Thierry, aka titimoby sur Internet depuis déjà quelques années. Même si je suis également passionné de musique en fréquences basses, je suis pour ma part tombé dans la marmite informatique dès le plus jeune âge.
D’ailleurs, mon premier rêve de geek fut l’achat d’un ZX Spectrum+, cette merveille elle aussi issue des terres anglaises. Toujours est il qu’après un parcours dont cet article n’est pas le sujet, je me suis un jour retrouvé après une keynote de la conférence MixIT à me lancer dans une association pour les enfants.
MixTeen est née de cette passion pour tout cet univers numérique (en français, digital concerne l’usage des doigts ;)) Nous sommes donc une petite équipe qui essayons d’organiser des ateliers de découverte. Les premiers pas se sont fait en utilisant Scratch, puis au fur et à mesure, tout ce que nous nous sentions d’utiliser. Rapidement, l’envie de lier cette découverte du code au monde physique s’est faite sentir.
Comme j’ai pris goût au monde des makers, comme quelques petits bricolages par ici ou par là c’est avec joie que j’ai vu apparaître la carte micro:bit Très vite, cette carte ou de celles de chez Adafruit sont devenues des invitées permanentes de nos ateliers. En parallèle, certains enfants que nous rencontrons reviennent, grandissent et souhaitent aller plus loin avec Python. Le souci est alors d’avoir des outils suffisamment simples à installer et à utiliser, si possible sans connexion à Internet.
L’apparition de Mu semble répondre à tous ces critères et on lui fait une place dorénavant. La gestion des cartes micro:bit est très sympa et la découverte de python me semble plus claire avec Mu.
Les pythonistas de la PyconFR ont d’ailleurs bien aimé Mu. Cette fois là, en plus des enfants, nous nous sommes retrouver à initier des parents et c’était un très bon moment.
Il ne manque plus qu’une fonction de selfie dans Mu pour avoir des photos de bonne qualité, je suis généralement trop occupé pour pouvoir faire une photo qui ne soit pas floue ;)
En attendant, nous continuerons d’aider à traduire Mu (ou les ressources de la fondation Raspberry, on est très ouverts)
Et comme le disent les Girls Can Code! :
“ALLEZ MU !”
It’s a quick summary of all that’s been happening in the world of embedded Python. Fun facts revealed in the show include such nuggets as the number of pages of projects, tutorials and how-tos about CircuitPython on the Adafruit website as well as the number of drivers for different devices compatible with CircuitPython. The numbers quoted show the growing momentum behind Python on embedded devices. This is good news!
It was also great to see two Mu contributors (Radomir and Josh) have their work featured. Radomir’s inventive hardware hacking is a thing of wonder, while Josh’s work on the EduBlocks project is, quite simply, inspiring stuff (especially when you consider he’s only 14 years old!).
Finally, Limor, Phil and the wider CircuitPython team at Adafruit deserve kudos and all sorts of accolades for their amazing work building such a welcoming, dynamic and creative community around CircuitPython. As the project tag-line says, “Code + Community = CircuitPython”. Thank you for all the work you do!
Fellow MU-tant (geddit?) Les Pounder, has a stonking project for Halloween trick-or-treating, made with an Adafruit Circuit Playground Express board, CircuitPython and Mu. It’s too cool not to re-blog! The video below shows you all you need to know.
Regular readers will know that Les’s projects are fun, playful, cheap to build and easy to assemble. Furthermore, not only has Les a gift for thinking up such stonking project ideas, but he’s a virtuoso mentor when it comes to explaining how to recreate such projects for yourself. Where am I going with this?
If you are a teacher, Les’s blog is a GOLDMINE of ideas, resources and projects for use in your own classroom.
In this case, the parts are all from PoundLand (no relation), and the digital assets are an audio file and the following short Python script:
import audioio import board from digitalio import DigitalInOut, Direction, Pull # enable the speaker spkrenable = DigitalInOut(board.SPEAKER_ENABLE) spkrenable.direction = Direction.OUTPUT spkrenable.value = True # make the input trigger trigger = DigitalInOut(board.A1) trigger.direction = Direction.INPUT trigger.pull = Pull.DOWN #Create a function to play audio files. def play_file(filename): print("Playing file: " + filename) wave_file = open(filename, "rb") with audioio.WaveFile(wave_file) as wave: with audioio.AudioOut(board.A0) as audio: audio.play(wave) while audio.playing: pass print("Finished") #Main Loop, press a button...make noise! while True: if trigger.value: play_file("sound.wav")
What are you waiting for?
Check out Girls can Code!, programming workshops for girls based in France. Guess what? They use Mu!
I was contacted by Antoine Pietri, one of the organisers of the event, who tells me,
We decided to use Micro:bits with MicroPython for this edition, in the Paris and Lyon camps, so I naturally thought of using the Mu editor and its Micro:bit mode for that. I followed the development of Mu in the last couple of years and saw it slowly grow into a fully-fledged general purpose editor, so I suggested that we use it for the whole camp.
We were thrilled at how easy and useful it was as a learning tool for all our activities, ranging from Hello World to writing games with PyGame. We will definitely use it in the future, probably even when teaching to more experimented students.
This is great to hear. Back in 2017 I was invited to give a keynote address at PyParis. It proved to be a fruitful trip: not only was the conference a wonderful experience and I made lots of new friends, but I was able to meet French computing educators like Antoine.
This proved to be a key moment in the development of Mu as I was able to gather feedback from users for whom English is an additional language. Our discussions led to the following conclusion about non-English speaking learners: the biggest barrier to learning Python isn’t that its keywords are in English, but that the tools and resources for programming in Python are.
Put simply, “je voudrais Mu en français”.
Upon my return to the UK, I immediately investigated Python’s robust capabilities in internationalisation (also known as “i18n”) and this has led to Mu being available in ten human languages (including French) with more on the way.
I hope you’ll be hearing more about Mu’s use in a French speaking context very soon. I also welcome non-English contributions to this blog too. Mu is definitely cosmopolitan in outlook and we want to encourage and help beginner programmers no matter their native tongue. If you have a story to tell about how you use Mu in your own region and language, please don’t hesitate to get in touch.
The source code and documentation for the library Limor demonstrates can be found on GitHub. Under the hood, it’s an I2C based API which has beed abstracted into something Pythonic. The code example included in the README (reproduced below) demonstrates how easy it is to use the LIDAR sensor with CircuitPython. In only a few lines of code it outputs data which Mu can use with its built-in plotter:
import time import board import busio import adafruit_lidarlite # Create library object using our Bus I2C port i2c = busio.I2C(board.SCL, board.SDA) # Default configuration, with only i2c wires sensor = adafruit_lidarlite.LIDARLite(i2c) while True: try: # We print tuples so you can plot with Mu Plotter print((sensor.distance,)) except RuntimeError as e: # If we get a reading error, just print it and keep truckin' print(e) time.sleep(0.01) # you can remove this for ultra-fast measurements!
It’s at this point in geeky blog posts that it’s traditional to bring up sharks, lasers and Dr.Evil. Happily, I ironically understand apophasis. ;-)
(In this guest post, 14 year old Mu user and wunderkind Josh Lowe explains how to get Mu working on locked-down school computers running Windows. School network admins are going to go nuts over this!)
I’ve been using Mu since it was just an editor for MicroPython on the BBC micro:bit. I find myself using it nearly every day because it removes all the features I don’t need and keeps the ones I do need, in a simple layout. So when I started my GCSE Computer Science course, with the first topic being Python Programming, I instantly wanted to use Mu in class.
Unfortunately it’s not: if you’ve ever worked in a school, you’ll know about the hassle of getting stuff installed on school computers, it’s not easy at all. Even if it’s an educational program like Mu (that’s going to benefit students) there are tons of hurdles to jump over to get in touch with the people who do that sort of thing. This looked like the end of the line for me using Mu in class.
I needed to come up with a solution.
So, with a bit of thinking about how I could tackle the issue, the solution came to me. Why not install Mu on a pendrive?
Unfortunately the computers at school are locked down so there is no command prompt, you can’t use
exefiles or use installers that require admin privileges. School rules banned me from downloading Mu onto a pendrive. So I had to find another way to install Mu on my pendrive.
Easy, I did it at home! ;-)
I’d like to introduce PortaMu, my solution to running Mu anywhere. I’ve also put Mu into a zip file so that you only need download and extract it without having to go through all the steps I explain below.
How did I get Mu to install and run on the pendrive?
Firstly, I had to install Mu on the pendrive. This is a very simple thing to do: when you run the Mu installer, select the installation path as your pendrive.
Once installed I faced an issue when I got to school to test it out: when Windows detects a drive it assigns a letter (e.g.
F:) and this can change when you plug the pendrive into another computer. I had to keep changing the shortcut properties each time, and it became a pain. So instead of launching Mu from a shortcut, I created a simple BATCH file that ran everything needed to launch Mu and this works perfectly.
Really? Does Mu actually work? Is that it?
Yes! You get the full Mu experience. I’ve been using it in class for about a week and it’s working really well. It’s grabbed lots of people’s attention who have been using IDLE in class and they’re now starting to use Mu instead!
How can I get my hands on PortaMu?
I’ve uploaded the zip files for people to use, and they’re available in the PortaMu section of Mu’s download page.
It’s just a case of downloading the zip and extracting it onto the pendrive. Once you’ve done that, double click the Launch Mu file and a window will pop up and you’ll see Mu load, it may take some time depending on how quick your computer is.
I hope you find PortaMu useful, just like I have. It’s not only handy for schools but PortaMu can go anywhere with you, whether that be a friend’s house or a library computer.
Why not download it and share the power of Mu with even more people who maybe can’t install things on their computer!
I wrote my first game as an entry for the last PyWeek, and came a respectable 8th out of 23. I was able to use Mu’s PyGameZero mode to quickly create something goofy yet fun. My starting point was the easy to follow PyGameZero tutorial. I like to think it amateur, rather than amateurish:
It was a huge amount of fun, the community involved is friendly and supportive and I’d like to encourage as many people to enter for the upcoming competition.
The PyWeek challenge:
- Invites entrants to write a game in one week from scratch either as an individual or in a team,
- Is intended to be challenging and fun,
- Will hopefully increase the public body of game tools, code and expertise,
- Will let a lot of people actually finish a game, and
- May inspire new projects (with ready made teams!)
Entries must be developed in Python during the challenge, and must incorporate some theme decided at the start of the challenge.
The latest version of Mu is here! Version 1.0.1 is a bug-fix release and all but one of the thirty or more contributions, changes and fixes were made by members of our community. I’m especially proud that this update means Mu supports the following translations: German, Spanish, French, Japanese, Polish, Portuguese (including Brasil), Swedish, Vietnamese and Chinese. Apparently there are Greek and Turkish translations on the way.
We expect the next version of Mu with new features (Python 3.7, some new modes, improvements to configuration, more bug fixes and better translations) to arrive some-time towards the end of this year.
If you spot any bugs, please don’t hesitate to let us know.
Once again, many thanks to all the people in our community who have made such important and helpful contributions: René Raab, Limor Fried, GitHub user @doanminhdang, Martin Dybdal, René Dudfield, Marco A L Barbosa, Justin Riley, Filip Korling, Nick Morrott, John Guan, Filip Kłębczyk, Tim McCurrach, Damien George, Zander Brown, Carlos Pereira Atencio and Tim Golden.
Sign up for free for the second ever Mu-moot! Thursday October 18th at 6pm in the offices of Kano at 3 Finsbury Ave, London, EC2M 2PA. It’s a friendly and supportive meeting for learners, teachers and software developers interested in computing, mentoring, technology, pedagogy, programming and education. While Mu provides a focus for our meetings we are not limited to Mu related activities, discussions or presentations. Rather, Mu-moot is a place to encounter new ideas, share knowledge and meet a diverse group of like-minded people.
What will we be doing?
- We’ll start with a welcome of pizza and refreshments from our wonderful hosts at Kano.
- Things will kick of properly at 6:30pm with a presentation on the short, medium and long term future plans for Mu. This will be followed by a short question and answer session.
- Next comes 15 minutes for lightning talks. If you’ll be there and have something to share, this is where and when you tell us!
- We end with a practical workshop called, “Debugging With Mu - What is debugging? Why do I need it? How do I do it?”.
At the end, around 8pm-ish, we’ll find a local pub and continue our discussions in a more relaxed atmosphere.
Future Mu-moots look to be even more interesting. Dan Pope, one of the originators of Mu, will be presenting and running a workshop about PyGameZero at the November moot. Tim Golden, one of Mu’s most prolific contributors, will hopefully present and run a workshop about NetworkZero at the December-moot.
If you have an idea for contributing to a future Mu-moot, please get in touch.
The source code is nice and simple, although it relies an two patches which have not yet made it into a release of PyGameZero (so mark this as coming soon). One patch adds joystick support (i.e. what you do with the gamepad) and the other makes it easy to flip sprites.
Coming soon to a PyGameZero/Mu release near you!
Friend of Mu and community supporter extraordinaire Les Pounder writes a blog containing lots of quick, fun and beginner-friendly projects. He calls this sort of thing “tinkology” – a term I really like. Playful tinkering is such a wonderful way to learn and relax. Can you guess what editor he uses? Nope, it’s not EMACS or VI. ;-)
What I love about Les’s blogging is its consistency: there’s always something new and it’s always really imaginative and fun. Les is a great source of ideas for lessons, projects or learning activities for beginner programmers. For instance, on most Tuesdays he writes a “Tooling Tuesday” entry to his blog and many of these have a Python slant to them. Other related series of posts include “Micro:bit Monday” and “Friday Fun”.
Mu related highlights include:
- Friday Fun: Python Pollen Projects
- Tooling Tuesday - Python3 GeoPy
- Tooling Tuesday - Google Image Search With Python
- Tooling Tuesday - easygui
Any of these could form the basis of a cool project, set of lessons or after school code-club activity. So, here’s to Les, his blog and fantastically imaginative projects.
Thank you Les!
What does software development look like? Here’s a short video / visualisation of the creation of Mu as told via the interactions, interventions and changes by developers to Mu’s own source code hosted on GitHub.
What exactly are you looking at?
- The faces represent the developers.
- The multi-coloured blobs are the source code files that make up Mu.
- The lines between the source code blobs show how the files are organised together into directories.
- As time passes, developers can be seen to change, add and delete files as the project matures.
I used the
gourcetool turn the commit history of Mu’s development on GitHub into a video. I added some Creative Commons licensed music and the results look and sound quite effective. What I really like is how the video reflects the wide variety of people and types of contributions made to the source code for Mu. Together, we’re continuing to build the best editor we possibly can for beginner programmers and those who support them.
Ever wanted a pathalogically conflicted artifical intelligence for your own home? Why, of course you do! Adafruit’s CRICKIT board has you covered (along with instructions for how to program it via Mu).
The Crickit (Creative Robotics and Interactive Construction Kit) is a an add-on for the Circuit Playground Express board. Cricket aims to make it easy to make friendly robots and thus make friends with robots (now there’s a sentiment we can all get behind). Essentially, Crickit complements and amplifies the CPX board by making it extraordinarily easy to interact with robotic “bits and bobs”.
What I love about this project is how simple it is to make and program. Once complete, just press the glowing red button to hear audio clips of HAL. The source code is less than 50 lines of Python and, perhaps most importantly, you have a chance to replace the recordings so your HAL is no longer an uncooperative controller of on-board systems, but perhaps a friendly computer in the spirit of Cricket. What’s more, this project is relatively easy to modify to other concepts such as responsive cuddly toys or the world’s most friendly door bell (remember those doors from The Hitchhiker’s Guide to the Galaxy?).
EuroPython (one of the world’s largest, most friendly and culturally diverse Python programming conferences) happened last week in Scotland. Sadly, for personal reasons, I was unable to attend. However, it was great to hear via social media that Mu was used in the opening conference keynote by Pythonista-extraordinaire David Beazley. Not only is it wonderful to see Mu used by someone so well respected in the Python community at such an auspicious occasion, but David’s use of Mu is a wonderful example of Mu’s use as a pedagogical tool. Remember, Mu is not only for learners, but is also for those who support them (i.e. teachers).
What do I mean by pedagogical tool?
The stereotypical example is a blackboard upon which the teacher chalks explanations, examples and exercises for their students. Teaching involves a lot of performative explanation – showing, telling and describing things as you go along; traditionally with the aid of a blackboard. This is a very effective pedagogical technique since students can interrupt and ask questions as the lesson unfolds.
David used Mu as a sort of interactive coding blackboard in his keynote introducing the Thredo project. He even encouraged listeners in the auditorium to interrupt as he live-coded his Python examples.
David and I have never met in real life, although our paths have crossed online via Python (and, incidentally, via our shared love of buzzing down long brass tubes). So I emailed him to find out how he found using Mu. Here are some extracts from his reply (used with permission):
There are some who seem to think that one should start off using a fancy IDE such as PyCharm, VSCode, Jupyter Lab or something along those lines and start piling on a whole bunch of complex tooling. I frankly disagree with a lot of that. A simple editor is exactly what’s useful in teaching because it cuts out a lot of unnecessary distractions.
From a more practical point of view, I choose to use Mu for my talk precisely because it was extremely simple. I do a lot of live-coding in talks and for that, I usually try to keep the environment minimal. […] Part of the appeal of Mu is that I could code and use the REPL without cluttering the screen with any other unnecessary cruft. For example, I could use it without having to switch between terminal windows and I could show code and its output at the same time in a fairly easy way.
This sort of feedback makes me incredibly happy. David obviously “gets it” and I hope his example points the way for others to exploit the potential of Mu as a pedagogical tool. David also gave some helpful suggestions which I hope we’ll address in the next release.
David’s keynote is a fascinating exposition of what you may want from a Pythonic threading library – it also has a wonderful twist at the end which made me smile. I’d like to encourage you to watch the whole presentation either via EuroPython’s live video stream of the event or David’s own screen cast of the keynote, embedded below:
Finally, the exposure of Mu via EuroPython had a fun knock on effect: someone submitted the Mu website to Hacker News (one of the world’s most popular news aggregation websites for programmers). By mid-afternoon Mu was voted the top story and I had lots of fun answering people’s questions and reading their comments relating to Mu.
My favourite comment, which I’ll paraphrase below, will become Mu’s tag-line:
“Python is a language that helps make code readable, Mu is an editor that helps make code writeable.”
We’re pleased to announce the release of Mu 1.0.0, a Python code editor for beginner programmers! There have been only minor changes since the release candidate, full details of which can be found in the changelog. As always, feedback and bug reports are most welcome. We’ve also completed and updated the tutorials on the website.
Many people have been involved in getting Mu to 1.0, and, if you use Mu, it would be a wonderful gesture if you could thank them via social media. Details of who to thank can be found here.
Some interesting facts and figures about Mu:
- 34 people have contributed code.
- There are currently only 3907 lines of Python code in Mu.
- We have 100% unit test coverage.
- Our code quality rating on LGTM is A+.
- There have been 1115 commits since the project was started on 7th December 2015.
- We’ve closed 341 issues.
- We have extensive developer documentation.
- Our online chat is growing.
Finally, earlier this week, we had our first ever Mu-moot in the MUseum Tavern in London. Not everyone could make it, but the photo below is of most of the core contributors:
(Al Broomhead [front-left], Martin O’Hanlon, Zander Brown, Dan Pope, Steve Stagg, Carlos Pereira Atencio, Tim Golden and Nicholas Tollervey [front-right].)
Everyone went away with an exclusive Mu t-shirt, the custom designs for which I’ll post on social media.
But before doing anything else, I’m going on holiday for a week. :-)
The release candidate for Mu 1.0.0 is out! This is the last step before the final release of Mu 1.0. Apart from a few minor bug fixes, the biggest change from beta 17 is the inclusion of various translations for the user interface. Full details can be found in the changelog.
Many thanks to the following people for their magnificent work on the following translations:
- Chinese (incomplete), by Pydo.
- Japanese, by Minoru Inachi.
- French, by Gerald Quintana.
- Spanish, by Carlos Pereira Atencio.
- Portuguese, by Tiago Montes.
I would love to include more translations in the final release, especially if they’re in one of the following languages:
(This list reflects both reach and accessibility of languages so Mu is usable by as many beginner programmers as possible.)
Other highlights include a fix to allow users of Adafruit devices to save a file called
code.py. This was getting erroneously caught by the new “shadow module” feature which, in this specific case, doesn’t apply. Zander Brown continues to make extraordinary progress in making the user interface both great to look at and consistent across all platforms. We had quite a bit of feedback from teachers who value such UI consistency: it allows them to create resources that apply to all platforms, thus avoiding all the complications of, “if you’re on
<platform>, then this will look different” interruptions in the flow of such resources. Finally, Tim Golden and Jonny Austin have done sterling work testing the various fixes for problematic edge-cases in the new BBC micro:bit flash functionality.
I had a stonking time yesterday afternoon with Harvey Sharman, who runs workshops for young coders in a library close to where I live. This particular afternoon was spent in the company of a group of eager eleven-year-olds. Harvey’s learning activity? Use Mu to program “transmitter” and “detector” micro:bits so the kids could organise a treasure hunt in the library. Let joyful coding chaos ensue!
I first became aware of Harvey’s work via the following tweet:
One of my pupils inspired in Python Mu hard coding the International Space Station project to collect live data of latitude and longitude coordinates to locate the actual position of the space station using an A3 print of the global map with coordinates. @ntoll 🛰️ @rebeccafdp pic.twitter.com/Ke2JKzDiju— Harvey Sharman (@BitawsBrackley) June 28, 2018
It was a stroke of luck that I live in the next village from Harvey and I just had to investigate. As a result I was invited to observe Harvey and his students in action.
The group of eleven-year-olds sped through the task of writing the code, checking it and flashing it onto the micro:bit. Then the group split in two: half were unleashed into the wider library to hide their “transmitter” micro:bits and upon their return the other half were let loose, waving around poles with their “detector” micro:bits stuck on the end. If the “detector” got close to a “transmitter” it would start to bleep and the “X” on the micro:bit’s display changed to a number to indicate the relative proximity of the devices.
Imagine, if you will, a sleepy afternoon at Brackley library: the knitting circle quietly click-clacking in one corner, a pensioner’s jigsaw club (armed with tea and biscuits) in yet another, and a hoard of enthusiastic eleven-year-olds waving around blinking and bleeping poles at anything and everything (including the afore mentioned knitting circle and jigsaw club) in an attempt to find “treasure”.
To say the kids had a huge amount of fun is an understatement (to their credit, the other library users were very patient and I was especially pleased to see maniacal grins on the faces of the librarians as the kids explored all the various sections of the library). Public libraries are such an asset to our communities since they’re the only place the pensioner’s jigsaw club could rub shoulders with eleven-year-olds from a code club. Two different parts of the same community got to see what each other were doing.
Afterwards, when the kids had left, we recorded the following video to explain how things work:
The source code is very simple and takes only minutes to type in. The detector works by checking the strength of radio signals. The stronger the signal of a received message the closer you are (and the higher the number displayed and the bleeps from the speaker). The transmitter micro:bits constantly send out signals at the lowest possible power so the signal is only detected when you’re stood close by (I’d say around 3 to 4 meters). This is beautifully simple and ingenious and could form the basis for all sorts of interesting classroom activities and learning opportunities. How might you improve the code?
Harvey tells me that Mu makes Python programming easy for his young coders and my own observations during the workshop confirm this. It took moments for the kids to figure out what to do. It was also cool to see them help each other and make suggestions for using Mu. For instance, once one kid figured out how to use the autocomplete functionality to avoid typing long words, they were all at it after the inevitable, “hey, look at this!”.
I look forward to more projects, games and “hacks” from Harvey and his young charges (and I’ll keep you posted!).
We’re pleased to announce the availability of Mu 1.0.0-beta.17, a Python code editor for beginner programmers! This is the final beta version before a release candidate later this week and the final 1.0 release sometime next week. This version is feature complete for 1.0. Any further changes will be bug fixes or cosmetic changes rather than new features.
The full list of changes can be read in the developer documentation. However, highlights include:
- A major re-write of how MicroPython code is flashed onto the BBC micro:bit. If there’s one thing we’d love to be tested by users, it’s this! All feedback most welcome (submit a new issue if you find a problem or discuss things via online chat).
- The latest and greatest version of MicroPython for the BBC micro:bit.
- Updates to the Python visual debugger (which is working really well).
- Protection from “shadow modules”. When many new programmers first save, for
turtlebased code they call their file
turtle.py. This breaks Python in a subtle yet opaque manner for beginners. Of course, their new
turtle.pyfile takes precedence in the import path, so where their code says
import turtleit is, in fact, trying to import itself..! Not a good situation for anyone, let alone a beginner programmer. As a result, Mu will complain if you try to give a file the same name as an existing module on your Python path. We know from extensive feedback this feature will save hours of confused head-scratching for beginners and teachers.
- We’ve also added a very simple yet remarkably useful “find and replace”
dialog which you can access with the
Ctrl-Fhot key combination.
- Talking of hot key combinations, if you highlight some text and press
Ctrl-Kit’ll be toggled between commented and uncommented. If no text is highlighted, the current line is toggled between these two states.
- Mu has been updated to use the latest version of Qt as its GUI framework.
- Plenty of minor fixes, tidy-ups and bugs squashed.
The next release will be a bug-fix “release candidate”. This will be a dress rehearsal for the final release which will follow soon after. Happily, most of Mu’s test, build and package infrastructure is automated. However, since this is still a process with several different components that need to be synchronised and checked (such as blog posts announcing the release and documentation updates) and some manual interventions (such as digitally signing the installers for OSX and Windows) we want to make sure we get this process right first time!
As always, feedback, bug reports and ideas would be most welcome!
Caitlinsdad has created colourful Rainbow Pride Traffic Lights with Mu and CircuitPython. This is great timing since Pride month just finished and today tens of thousands of people are taking part in the Pride in London Parade. Thanks to Adafruit for the heads-up!
So I have an Adafruit Circuit Playground Express board to play with. This project seems like a good way to learn Circuit Python programming and to get more familiar with the Mu Editor and REPL function.
Thanks to some epic cardboard crafting, Neopixels, a healthy dollop of paint and experimentation with timings in the CircuitPython code, the results are a customizable rainbow light-show:
By day Keith is a healthcare informatics professional. By night, like many of us, he builds robots and other Maker-type projects. This particular project blinks different messages in Morse code. You can configure the LED colour as well as toggle the buzzer (so the board “bloops” Morse code too).
He says, “I love the idea that I could use Python to program a microcontroller” and explains the origin of the project as follows:
I was at the San Mateo Maker Faire this year (I was at the first one, and have been there or NYC Maker Faire every year since). I had brought the CPE with me to play with in case I had any free time (I hadn’t had time to really mess with it - big project at work). My flight Sunday night was cancelled, so I thought I might go to the Bring-a-Hack event. I didn’t want to show up empty handed, but all I could think up was a lame demo of the CPE. I quickly re-reviewed some tutorials, and wrote a quick program in my hotel room. Didn’t work at all. Tried different things, cut-and-paste sample code (which all worked), finally gave up. At that point I was tired, and had to get up early for a flight, so I canned it. When I got back to St. Louis and read through the code again, I realized I had thought that time.sleep was in milliseconds (like Arduino Delay), rather than in seconds. The original code I had written was actually fine - just a thousand times slower than I was expecting. Once I fixed that, it was fine. I’ve since cleaned it up a little.
Thus proving the old adage that, “good things come to those who wait”. ;-)
Keith has helpfully provided a video of his code in action:
The project’s source code contains a complete implementation of a Morse code transmitter that could form the basis for many future beginner-friendly projects. If you’re interested in changing the transmitted messages you should modify lines 92 and 95. The Morse code definition is in a Python dictionary on line 22 and the loop, starting on line 98, is a great example of how to convert characters into Morse code. Check it out!
I wonder, how hard might it be to implement simple signal processing using the Circuit Playground Express’s microphone or light sensor to detect the message transmitted from a second device and emit the result to the CircuitPython REPL? (That’s a trick question… it’s very easy, but I leave it as an exercise for the reader to solve.)
As for Mu, Keith says it is, “certainly convenient for programming the CPE (and BBC micro:bit). The biggest thing I miss is a keyboard shortcut to comment/uncomment bits of code. That would make troubleshooting so much faster.” Check out progress for this feature request on our issue tracker.
Thank you Keith for such an easy-to-follow Morse code project!
Everyone else, if you extend or re-use this code, let us know! We love to shine a light on the hard work of Mu users (no pun intended). :-)
Leila and Emma got in touch to tell us they’ve made themselves a stylish homemade clock! Using an Adafruit M0 Trinket, a quad 7-segment display and various other components they hacked all the CircuitPython code together in Mu! Read on to learn more…
I first met Leila and Emma in 2015, when Trans*Code was first welcomed to PyCon UK. On subsequent meetings it has always been a great pleasure to hear of their homemade electronics projects and how they’ve thought up ever more creative and interesting ways to use MicroPython or CircuitPython in their work. They have been great supporters of Mu since the very earliest releases, so “thank you” both for your encouragement, feedback and support.
When the call went out for user-contributed projects for this blog, it didn’t take long for them to submit the first contribution, and what a fun project it is!
Their own digital alarm clock broke, and none of the replacements fitted their requirements, so rather than buy a new one they used it as an opportunity to learn and make their own.
What I love about this project is that it took several attempts to get it right. In the end they came up with a device that worked with a much simpler design than their original solution (that didn’t work at all!). This is a common occurrence: it takes time to work out how to solve a problem and you’re likely to encounter unforeseen problems along the way. Only after “playing around” and experimenting for a bit will a simple, elegant and (most importantly) working solution emerge.
Another aspect of the project that I really like is its Wabi-Sabi-ness. I’m a big fan of Wabi Sabi (while the linked-to Wikipedia article is interesting, I recommend this wonderful little book for those who want to learn more). Wabi-Sabi is the beauty found in impermanent, incomplete and unconventional objects. The development of, and solution for this project is a wonderful example of such beauty.
Finally, the code they created in Mu has a really cool feature to handle button presses to change modes (their clock not only tells the time, but will display the date and year!). This is another important aspect of the project: Leila and Emma are in control of their digital device and, if they feel so inclined, are free to change how it works or fix any bugs. They can hack it!
You can read Leila’s full write-up of the project, including source code and circuit designs at her blog.
Great work Leila and Emma! :-)
Adafruit, the brainchild of Limor ‘Ladyada’ Fried, was founded to create the best possible resources, boards and designs for learning about electronics and programming. Over the last decade she and her colleagues have surpassed their initial goal and become the touchstone for inspiring a community to engage with making electronic devices for serious, playful and educational use. Perhaps most importantly, Limor and her colleagues have become worthy role models to many for whom electronics or programming may, at first, appear “not for them”. They have been celebrated by the WhiteHouse, written about in high profile magazine articles (such as for WIRED and MAKE magazines) and been the recipients of several awards.
They are fearless in their support for and promotion of under-represented groups in technology. As they say on their website,
… we’ll do our best to shine a light on the untold stories of women in STEM and underrepresented champions from all over the world.
Happily, Adafruit support their own flavour of MicroPython (think of it like an Adafruit “distro” of MicroPython) called CircuitPython. CircuitPython provides a uniform and consistent API for all the many and growing number of Adafruit boards that it supports. This makes it very easy to transfer your skills and knowledge between different types of device, be it a minute Gemma board or the spectacularly colourful and feature-ful Circuit Playground Express.
Mu has a CircuitPython mode which understands how the boards work (for example, you store your source code on the connected device’s USB storage). It also provides a couple of short-cut functions to help you interact with your CircuitPython device. For example, reading from and interacting with the connected device’s serial connection is but a button press away:
Perhaps my favourite feature is the plotter, which allows you to visualise data coming from the connected device. The plotter was originally contributed by Limor herself. The following video shows Limor explaining how to visualise the data coming from the light sensor of a Circuit Playground Express with the plotter built into Mu (originally blogged here):
What’s really great about this example is how short the Python code is:
There are plenty of projects and videos for using CircuitPython and Mu on Adafruit’s website.
Check it out..! If you create something awesome, please tell us about it! :-)
Have you ever wanted to write a game? It turns out that Mu and PyGame Zero make this really easy for beginner programmers. Read on to learn how the author used both to create a goofy game for the wonderful PyWeek event.
PyWeek is a fun, community-organised game-making event / competition that doesn’t take itself too seriously. As the website says, the PyWeek challenge:
- Invites entrants to write a game in one week from scratch either as an individual or in a team,
- Is intended to be challenging and fun,
- Will hopefully increase the public body of game tools, code and expertise,
- Will let a lot of people actually finish a game, and
- May inspire new projects (with ready made teams!)
As the name suggests, all entries should be written in Python and incorporate a theme announced at the start of the challenge.
PyWeek happens a couple of times a year and in April it was organised by my buddy Dan Pope (aka lordmauve). Dan has many claims to Pythonic-fame, but the one I’m going to focus on today is that he’s the creator and maintainer of a wonderful library called PyGame Zero. As the name suggests, PyGame Zero is based upon another wonderful library called PyGame (maintained by another equally talented buddy, René Dudfield). PyGame makes it very easy to create graphical games in Python. PyGame is highly portable which means that games made with PyGame will run on plenty of platforms. PyGame Zero is a beginner-friendly wrapper around PyGame.
Dan created PyGame Zero after working with a group of teachers at PyCon UK’s education track. Since he’s a gifted and experienced game developer he was able to create a simple graphical game in about an hour. As he did so, he explained to the watching teachers exactly what it was he was doing. However, the feedback from the teachers was clear (paraphrased), “While PyGame might be easy for you (Dan), the kids we teach would find it hard to put together 10 lines of Python, let alone the 500 line you just created; we need a way that makes it easy to create something cool with very little code”.
And so, the seeds for PyGame Zero were sown. Dan has created a simple and easy-to-understand wrapper that enables learners to make something graphical in only a handful of lines of code. If you’re interested in learning more about PyGame Zero (including a really great tutorial) go check out the beautifully written project documentation.
Since Mu has a PyGame Zero mode, I thought I’d enter the most recent PyWeek and try to create my first ever game using just Mu and PyGame Zero. The theme was “two worlds” and after an ideas generation session (with input from my three kids) the concept for a game, called Paperchase, was born.
The blurb for the game says…
The intergalactic war between the red and blue factions of the biro universe has reached its climax. Each world has sent a stick-figure champion to race in the “Paper chase” for ultimate victory and to decide which colour biro pen teachers should use when marking work. (Get 200 steps ahead to win, collect up to 3 Python power-ups to import antigravity and avoid all other obstacles.)
The PyGame Zero tutorial shows you how to make an animated alien float across the screen. I took this as my starting point and, after several hours of drawing and discarding a huge number of naff-looking stick figures and and taking about 5 minutes on only a few lines of Python code I had this:
(Interesting aside: I estimate I spent about 80% of my time in PyWeek drawing, testing and revising game assets like the animations and objects in the game. Of the remaining 20% of my time, most of it was spent reading PyGame Zero’s excellent documentation to guide me in how to make something or other work. Time spent actually writing Python code was probably only 5% of the total.)
During PyWeek, participants are encouraged to submit diary entries to plot their progress and so others can see how they’re getting on. This was a wonderful experience because participants leave supportive comments on each other’s diary entries and even give user-created “awards” (for instance, I gave one game “Ent of the Year” since the game involved becoming the spirit of a tree). You can read my diary entries here and all the participant’s diary entries are here.
At the end of the week of coding, participants judge each others’ entries and a winner is declared for both individual and team entries. I’m pleased to say I placed a respectable 8th out of 23.
Most importantly for Mu, I was able to try out writing an actual real-life game with it. The experience was remarkably smooth and it was fun to type some code and click the “play” button to immediately see the change take effect. Such a quick turnaround in a write-play-check-change cycle makes coding games lots of fun. I also quickly appreciated the ability to just copy and paste the different sorts of game asset into the right locations thanks to Mu’s shortcuts to the file system.
I’d highly recommend everyone take part in a PyWeek – it’s a fun and supportive community who are friendly to newbies (such as myself). If you do take part, please consider using Mu and PyGame Zero!
How did the game turn out? Here’s a video of me and my thirteen year-old son play-testing the game. The source code can be found here.
Welcome to “Made With Mu”, a blog to celebrate the projects and achievements of users of the Mu Python code editor. Mu is a Python editor for beginner programmers based on extensive feedback given by teachers and learners. The project’s main website can be found at codewith.mu.
If you have a project you’d like celebrated here, use the form on the submit page (also linked from the site’s header) to tell us about it..!
We welcome submissions from anybody, no matter your skill level, project type or background. If you’re thinking, “they probably don’t mean me” then we definitely mean you.
We’re friendly and, if needed, will help make sure your project is presented in the best possible way.
What are you waiting for? Go submit something!
Subscribe via RSS