
Code with Mu: a simple Python editor for beginner programmers - miduil
https://codewith.mu/
======
miduil
The editor was used at David Beazley's talk [1] "Die Threads" at the
EuroPython 2018 by live coding how threading in Python could look like [2].

[1]: [https://youtu.be/FsvmT2Ir7B8?t=26m](https://youtu.be/FsvmT2Ir7B8?t=26m)

[2]: [https://github.com/dabeaz/thredo](https://github.com/dabeaz/thredo)

~~~
devxpy
I was wondering what editor that was and just saw this post xD.

David's talks always have these funky looking editors.

~~~
hprotagonist
normally it starts with a hacked-to-hell-and-gone iterm2 session.

~~~
8_hours_ago
Are there any talks in particular that you recommend? I love to watch live
coding to see how other programmers have their development environments set
up.

~~~
devxpy
David probably isnt the best guy for that.

But here's one of the famous ones on GIL. [https://youtu.be/Obt-
vMVdM8s](https://youtu.be/Obt-vMVdM8s)

Beware though, his talks are known to be devastating to the programmer,
resulting in serious head injuries, trauma, headaches and other fun stuff.

------
ntoll
Hi, I created Mu.

Happy to answer any questions you may have. :-)

~~~
albertzeyer
Looks very cool from a first glance!

As it was mentioned in another comment, its hard to find a link to the source
code of this, or even to get the information, whether this is open source, and
what licence. (Answer: [https://github.com/mu-
editor/mu/](https://github.com/mu-editor/mu/), licence is GPLv3). For some
people, this is some of the most important question before they would try out
a new app.

Also, one detail which was hard to find, but interesting for me: This is build
using PyQt5.

About the MacOSX package: It's about 430 MB. This is a lot for such a simple
editor. Is this just because of PyQt5 which is bundled together with it? Isn't
it possible to strip that down? I would have expected something like 5 MB or
so.

Also, another question: Is it possible to have this bundled into another
existing app? E.g. I have an app where the user could write simple Python
scripts to automate something (e.g. the smart playlist logic in a music
player), and I was wondering whether I can have a simple editor just inside
the app. However, your licence is problematic for this usage, as my apps
usually have a BSD or MIT licence or similar. Maybe consider to use LGPL?

~~~
ntoll
These are great questions... briefly:

* Licensing - if you use one of the installers (for OSX or Windows) you're presented with the GPL3 as part of the installation process.

* Mac OSX package (and to the same extent, the Windows installer) - Mu comes with everything bundled in so you don't have to mess around installing a bunch of stuff to make it work. We did it this way after asking for feedback from school network administrators who always said some variation of "make my life as simple as possible". Mu is only just less than 4k lines of Python so, you're right in thinking that the rest of the installer is Qt and a bunch of other stuff (like Tk/tkinter, needed for Python's turtle module to work, something many teachers have told us they need). We also bundle PyGame, iPython, Matplotlib, Numpy etc etc... so they're just there by default if you simply install Mu. In this sense, Mu is a sort of "instant Python for education" (just add learners). ;-)

* Bundling - I'm happy for Mu to be bundled if this were useful to another project although I guess this depends upon what use case you're thinking of. For example, Mu is already "bundled" (in a sense) in Raspbian as a recommended package. If in doubt, just reach out.

~~~
japhyr
As an educator, I appreciate the decision to bundle libraries such as PyGame,
Matplotlib, etc with the editor. Although it's important for new coders to
learn how to install libraries, it doesn't need to be one of the first things
they learn. It's really nice to be able to install an editor, show students a
few lines of code, and have it do something more than just print some text to
a terminal. (Although, for the record, printing text to a terminal is still
immensely satisfying to many new programmers. It makes them feel like they're
really programming.)

I've been teaching programming off and on for many years, and I'm teaching
another intro course this fall. I can't wait to give Mu a try with students.

Thanks for all your hard work, and the clarity of thinking that's gone into
this project.

~~~
ntoll
Thank you!

------
kovek
I really like that in the tutorials, there is a “Moving on from Mu” page. It
shows that there is a clear understanding of the goals and scope that Mu
should strive for.

~~~
ntoll
Thank you!

------
gigatexal
In a round about way Dave Beazly endorsed this editor for beginners in his Die
Threads talk from euro python 2018. That’s high praise.

~~~
gigatexal
Shit I was beaten to the punch.
[https://news.ycombinator.com/user?id=miduil](https://news.ycombinator.com/user?id=miduil)

------
allan_s
would be great if it integrates ideas from
[http://www.pythontutor.com/](http://www.pythontutor.com/)

------
ModernMech
Here is the source, which strangely enough I don't think is linked from the
website, unless I'm just missing it: [https://github.com/mu-
editor/mu](https://github.com/mu-editor/mu)

~~~
paradite
You go here:

[https://codewith.mu/en/developers](https://codewith.mu/en/developers)

Which links to here:

[https://mu.readthedocs.io/en/latest/](https://mu.readthedocs.io/en/latest/)

Which links to github (Watch button):

[https://github.com/mu-editor/mu/](https://github.com/mu-editor/mu/)

I guess they didn't want "users" to accidentally think they need GitHub or
read the "developer docs".

~~~
ntoll
Got it in one!

I spent a LOT of time working with beginner programmers and saw many examples
of learners finding their way into documentation and sources of information
that were unhelpful, intimidating or not intended for them. Chaos, confusion
and disappointment would ensue and this would take a significant amount of
time and effort to undo. [https://codewith.mu/](https://codewith.mu/) and
[https://madewith.mu/](https://madewith.mu/) are both websites for the target
users of beginner programmers or those teaching coding (Python).

Mu's developer docs are in the "usual place" for Python projects (mu.rtfd.io)
and I hope they make sense to any experienced developer.

All feedback most welcome.

------
Keyframe
This is fantastic. Never knew about it, but now I know what to give to kids
interested in learning programming!

~~~
dotancohen
My 9 and 11 years olds write Python in VIM, and have been for about two years.
Learning VIM itself can be fun, if you teach it properly. And it is a skill
for life.

~~~
Keyframe
I'm 38 and use vim since Amiga days and vi before that and would never even
consider giving vim to anyone starting out!

How do you teach kids that? I know kids learn fast, but still. Aren't they in
a phase where they ought to catch on 'normal' things first in apps, isn't
wrestling with vim averting they concentration from what they should be paying
attention to (python)?

~~~
earenndil
Hi. When I was about 9, I asked my dad to teach me to program, and he started
with vim. Yes, it was a bitch to pick up, but I don't think it really
detracted from learning and it's still what I use today so it can't have been
_that_ traumatizing.

------
fladd
It is entirely not clear to me which Python binary this editor uses by
default. It is most definitely not the one that the `python3` command on my
system is set to. Hence, it finds none of my packages.

The editor seems to use some Python 3.6.5 (where ever that comes from), while
on my system 3.7.0 is installed.

~~~
ntoll
As mentioned elsewhere, the feedback we got from educators was that they just
wanted _everything_ packaged in with Mu, including a working version of
Python.

That's why you're seeing the behaviour you report.

However, you could also use your system Python and do: pip install --user mu-
editor

~~~
fladd
I now did install it with Pip, and while the REPL now sees my correct Python
version (3.7.0), it still does not know any imported packages that are
installed in this system Python. Unfortunately, there also does not seem to be
any setting in the editor where I can change which Python it uses, nor can I
see which one has been chosen for me.

------
maltalex
Haven't seen Mu before. What's the benefit over giving a beginner a copy of VS
Code?

~~~
ntoll
VSCode is for professional developers... while this may look beautifully
simply (because it is) to experienced developers like you and me, it still
isn't particularly "friendly" for beginners.

The point of Mu is to be the _first_ editor you use... it introduces you to
the various concepts and capabilities of IDEs in a simple, approachable and
coherent way so you _quickly graduate_ to something like VSCode.

As I say in my PyCon talk (linked to in another answer), if you're still using
Mu as your main editor after becoming proficient in coding, you're doing it
wrong (and should graduate).

Hope this makes sense.

~~~
sandGorgon
vscode has a pretty awesome plugin capability.

why did you choose to focus on creating an entirely new editor vs creating a
very opinionated plugin for vscode ?

~~~
ntoll
Mu is an accident.

I was one of the volunteers who contributed to the BBC micro:bit project under
the auspices of the Python Software Foundation. I actually wrote the browser
based editor and, like a conscientious developer, tested it on teachers. The
feedback was pretty resounding: while the browser is convenient the
limitations of not being able to connect to the MicroPython REPL, having to
download a hex file, copy it to the device and wait in order to run your code
was also a stumbling block.

It was a rainy Sunday afternoon and I asked myself, "how hard can it be to
write a simple editor that was a native application so I could connect to the
REPL and automate the flashing of the device?"

Fast forward a bit and Mu appeared, teachers used it with the micro:bit and
started asking for it to be a "generic" editor for Python (not just
micro:bit). The Raspberry Pi foundation's education team also wanted a generic
Python editor based on the feedback they'd received from teachers and learners
and so they supported me to make the editor modal (i.e. there's now Python3,
PyGame, Adafruit and micro:bit modes) with a visual debugger for Python 3
mode.

So, be careful what you hack on a Sunday afternoon... I certainly wasn't
expecting this to happen. ;-)

~~~
sandGorgon
more power to you. what you built is awesome !

------
dgasmith
Is there a compare and contrast of this editor against other similar efforts
such as Jupyter?

~~~
ntoll
Actually, Jupyter is used in Mu: the Python3 REPL is an iPython notebook. ;-)

Mu is a code editor, Jupyter is more an unfolding of thought and code (i.e.
they're different).

My aim is to complement and amplify the amazing work that Jupyter are doing
and suggest people look into using Jupyter "proper", in the "Moving on from
Mu" tutorial page ([https://codewith.mu/en/tutorials/1.0/moving-
on](https://codewith.mu/en/tutorials/1.0/moving-on)).

------
mdhughes
Why would someone use this instead of IDLE, which ships with Python and does
the same things?

~~~
ntoll
IDLE has lots of problems for beginners, isn't accessible for certain users
and is a difficult code base to change.

Mu is largely based upon the feedback given to the Raspberry Pi Foundation
from teachers and students who have used IDLE.

My talk at this year's PyCon mentions some of this in passing:
[https://www.youtube.com/watch?v=T5IAf5vGGSk](https://www.youtube.com/watch?v=T5IAf5vGGSk)

------
lichenwarp
my first editor was visual basic 6, (aim/aol/progz) days. I've seen it posted
on twitter and really like the interface, I think it will be very useful, I
guess we had to learn the "hard" way.

------
ape4
Surprising that "theme" is considered essential.

~~~
ntoll
Yes, very much so... here's why:

In many schools the projector used in the front of the class is old and/or
inadequate. Depending on the conditions, some work better with "light"
applications, others better with "dark" ones, and some are so bad the only
solution is a "high contrast" look (which also aids those with visual
impairments -- education and the tools thereof should try to be accessible to
all).

Like zooming in/out, this was a bit of a favorite complaint of teachers which
was very easy to fix in order to help them overcome the widespread hardware
inadequacies. I guess the moral of the story is: "assume nothing".

Hope this makes sense. ;-)

~~~
raegis
A++++++ Thank you for understanding, as I plug my laptop into the VGA
connector at school.

------
philonoist
But how is this different from thonny.org?

How do they both compare?

------
craftyguy
How is this licensed?

~~~
moreati
It's GPL 3

------
hacker_9
As someone who doesn't write python regularly, wasn't python supposed to be
human readable for non coders? Or not need an IDE to be understood? Clearly
very different messages being transmitted here.

~~~
untog
I don't see how the two things contradict. You still need a "run" button for
even the most readable code. And syntax formatting, auto-complete etc is
always going to be useful no matter what.

At the risk of stating the obvious, this is for making code human writable,
not human readable.

~~~
ntoll
That's a great way to put it... I think I might steal that if you don't
mind... ;-)

"Python is a language that helps make code readable, Mu is an editor to help
make code writable."

 _love it_

~~~
untog
More than happy for you to steal, it's a fantastic project!

