Announcing the MicroPython Plugin for PyCharm

Today we’ve released the MicroPython plugin 1.0 for PyCharm. This plugin lets you edit your MicroPython code and interact with your MicroPython-powered microcontrollers using PyCharm. It supports ESP8266, Pyboard, and BBC Micro:bit devices. The plugin is being developed as a team project by the PyCharm Community lead Andrey Vlasovskikh. The source code for the project can be found on GitHub.

MicroPython is a relatively new member of the Python interpreters family. It’s basically a Python 3.5 implementation designed for microcontrollers — small computing devices that are used everywhere from smart watches to cars. People usually program microcontrollers in C or an assembly language due to low performance and memory limits. Thanks to clever optimization techniques implemented in MicroPython you can now use (almost) standard Python for microcontrollers. For example, you can create your own Internet of Things device and program it in MicroPython.

The MicroPython plugin is compatible with both PyCharm Community and Professional editions. We’re going to make it available for IntelliJ IDEA soon as well. Let me walk you through the setup process and the features of the plugin using PyCharm:

We’ll be using an ESP8266-based device called WEMOS D1 mini. Basically, it’s a Wi-Fi chip with a couple of digital and analog I/O pins to connect external sensors and actuators. But for our simple demo, we won’t need anything besides the LED light that is already located on the device and is connected to the digital output pin 2.

This is our demo program which toggles the LED every second:

Let’s get started setting up our device!

First of all, make sure your OS can see your device via USB. This step is device-dependent. For WEMOS D1 mini on Windows and macOS you’ll need a serial port driver provided by the device vendor.

Next, we’ll setup PyCharm to work with your device. First, you need to install the MicroPython plugin in PyCharm “File | Settings | Plugins”. Then you need to create a new Python project in “File | New Project…”. In PyCharm 2017.3 the new project dialog with the correct settings will look like this:


Make sure you’ve configured a Python 3.5 or a newer interpreter for it (preferably a virtual environment), since the MicroPython plugin will later ask you to install a few Python packages to communicate with your device.

After that add a new file to your new project with the contents of our program above. Finally, enable MicroPython support for your project in “File | Settings | Languages & Frameworks | MicroPython” and specify your device there:

MicroPython Configurable

Now let’s see what the plugin has to offer.

Code Completion and Documentation

The MicroPython plugin provides code completion and documentation for MicroPython-specific modules:

MicroPython Code Completion

Notice that code completion is context-aware. On this screenshot PyCharm shows you only the members of the utime module.

The quick documentation window contains the docs for the selected name. Use Ctrl+Q (F1 on macOS) to show this pop-up window. You can also dock it and enable “Auto-update from Source” to keep it permanently.

Syntax Checking and Type Checking

The plugin searches syntax errors and other problems in your code like potential AttributeError or ImportError using static code analysis. It comes with Python stub files for device-specific binary modules. These stubs contain Python type hints that make it possible to check types in your MicroPython code:

MicroPython Type Checking

On the screenshot above you can see several Python syntax errors when the user tries to write some C code in the middle of their Python file. There is also a type error in utime.sleep_ms(3.14), since this function only accepts integers.

Flash Files to Devices

The MicroPython plugin helps you to upload your files to your MicroPython device via USB. Use “MicroPython” run configurations to flash files or folders to your device in “Run | Edit Configurations…” menu. To quickly upload a single file you can select “Run ‘Flash <your-file-name>.py’” from the context menu of your Python file:

MicroPython Run Configuration

MicroPython REPL

Interactive experiments play an important role in Python development, but they are even more important with microcontrollers which usually don’t have any screens to show possible errors. The MicroPython plugin allows you to quickly run an interactive Python REPL console. Use “Tools | MicroPython | MicroPython REPL” menu to run a MicroPython shell on your device.

MicroPython REPL

I hope you enjoy this plugin. I’ll be glad to hear your feedback and how you’re using it. Tell me about your experience with it in the comments below, or on twitter: @vlasovskikh or @pycharm. Star or fork the intellij-micropython repository on GitHub, send your issues and pull requests!

This entry was posted in Cool Feature and tagged . Bookmark the permalink.

47 Responses to Announcing the MicroPython Plugin for PyCharm

  1. Swington says:

    Great work! I am currently using MicroPython for my masters project and the ability to use PyCharm power while writing code could be a gamechanger.
    I also want to ask if you are planning on supporting unix porting of MicroPython? Thanks to its enormous speed it’s gaining more and more popularity and it would be great if you could use PyCharm to develop proper applications with MicroPython.

    • Andrey Vlasovskikh says:

      Is your use case about using it instead of CPython for your regular Python code or is it about testing your MicroPython programs before flashing them to devices? Do you need any MicroPython-specific features for it?

      • Swington says:

        Well, testing code for embedded systems is one useful application for unix porting.
        Another is for writing regular ‘desktop’ programs in MicroPython, which has a huge speed advantage over regular Python. I am, for instance, using it for writing system management scripts for my system, as MicroPython is faster than bash – great for working in background.
        I am also currently investigating usage of MicroPython for microservices, where it can sometimes be a valuable resource saver.
        What I am saying, I guess, is that MicroPython seems to have a bright future ahead of it, not only on embedded systems. Preparing PyCharm to use it could be valuable.

      • Swington says:

        As to specific features – from what I saw, you cannot choose MicroPython to be a project interpreter. It would be great if you could.

  2. Helgi Borg says:

    Thanks for an interesting post. Do you plan to support Arduino devices?

    • Andrey Vlasovskikh says:

      My current understanding is that Arduino is a separate ecosystem not related to MicroPython. Could you describe your workflow with Python on Arduino and share some links to projects / other resources on this topic?

      • Helgi Borg says:

        You are of course right! I first learned about MicroPython while reading this blog post. I then scan some Arduino pages and though I saw a mention of MicroPython support in Arduino boards, but now that I checked it better I see that I’m wrong. The Arduino eco system doesn’t seem to support MicroPython yet – hopefully some day.

        • Andrey Vlasovskikh says:

          Got it. Thanks for your comment!

        • Janez Demšar says:

          Arduino has Harvard architecture with 32 KB of program space and only 2 KB of SRAM that you can use for heap and stack. Python won’t fit; 2 KB is probably too small to do anything useful. In comparison, ESP8266 has 64 KB for instructions and 96 KB for data.

          For using Arduino from Python, check Firmata, but that’s different: the interpreter runs on a PC and communicates with Arduino using serial port.

  3. Sohail Qureshi says:


    REPL is not working on windows. The Windows command prompt is shown instead of REPL.

    • Andrey Vlasovskikh says:

      Thanks for your feedback! Yes, it’s a known problem, I’m looking for contributors to address it. See issue #12.

    • Andrey Vlasovskikh says:

      I’ve fixed REPL on Windows in 1.0.4.

      • Kris says:

        Just installed the plugin update I think I still have issues. If I select the Python Console tab I see the REPL from what looks like my conda environment (similar to venv’s) not the REPL from the board. The Terminal tab has the usual CMD,EXE/PowerShell prompt (shudder – now that’s where I would really like to see an ssh session to WSL!!). The Run tab has the usual upload to board progress stuff in it.

        Have I done something wrong or is it possibly the fact that I use conda rather than venvs that may be the issue?

        Sorry – just finished this and realised I should have put it in the tracker. Off to do that now.

  4. Kris says:

    I can report success on an Adafruit ESP32 Feather board on latest PyCharm Pro/Win10. successfully flashed, reset and running. No REPL as I am on Win10 (known issue).

    Great job! I’m going to try to set it up so it uses my conda environment under WSL. That SHOULD be more Unix-like and may allow the REPL to function. And it’s where I want to work anyway, man I hate CMD.EXE/PowerShell. One does too little, the other makes emacs look like a flyweight.

    I’ll update on the result of the WSL test (and possibly other micropython boards if it is of interest).

    • Kris says:

      Well, that was quick. Looks like PyCharm wants nothing to do with my conda environments under WSL. The fact that none of them have any files ending in .EXE in them may have a lot to do with it :-)

      Not sure if I want to go to the pain of getting all the GUI prerequisites installed under WSL so I can run PyCharm under WSL instead. I can still use MobiXterm to get to the board REPL so I still get all the other goodies from this plugin under WIN10 including flashing and then running the new code.

      It may be time to take a look at the kotlin and see if I can figure out what may be going on. The fact that I know absolutely nothing about kotlin discourages me a little bit so don’t hold your breath…. I am likely going to play with my boards a bit first.

      • Andrey Vlasovskikh says:

        I believe issue #12 about REPL on Windows won’t be hard to fix.

        Currently you can configure a WSL Python interpreter only as a remote interpreter in PyCharm Professional. See Configuring Remote Interpreters via WSL. Feel free to vote for PY-27879 for native WSL support.

        • Kris says:

          I added my vote (it seemed to be the first unless I did something wrong.

          I’m a little confused about the remote interpreters/WSL link you sent me to. That seems to be the way to get to a python REPL from provided by a python installed within WSL, not the REPL from the connected micropython board.

          Is that how Win10 PyCharm would get to a REPL on the micropython board? Via a python interpreter installed under WSL? Presumably then the commmunications port used would have to provided in the form used by WSL (/dev/ttyS03 or something similar) within the MicroPython Languages/Framework setup in Win10 PyCharm.?

          Sorry for all the questions but I am having a little bit of a problem visualising this….

          • Andrey Vlasovskikh says:

            I’ve fixed the REPL on Windows issue in 1.0.4, so the WSL option isn’t worth investigating further.

  5. Kris says:

    Can I recommend you change this statement:

    “Make sure you’ve configured a Python 3.5 or a newer interpreter for it”

    To “Python 3.5 only (or latest Python 3.5 available)”.

    I suggest not installing Python 3.6 or later as features that are available in 3.6 or later will not be syntax highlighted as incorrect. An example of this is f-strings. If you installed 3.6 then f-strings will be OK according to PyCharm but if you installed 3.5 then you will get notified of the problem. If micropython moves forward to being closer to base 3.6 then the Python version can be updated.

    This is why we use virtual environments, right?

  6. Kris says:

    Gotta say my workflow has been vastly sped up by using this plugin over how I was doing things before. Being able to upload 5 project files to my board with the push of a button is just awesome!! Don’t care about the missing Win10 REPL – this has already made me twice as fast at creating my micropython code. Not missing having to run ampy myself at all!!

    One question – in an image above there is a dropdown with “Flash micropython-project”. How do you get that? The way I got multiple files to upload was to make multiple configurations, one for each python file. Then my project uploads but as a prerequisite runs the individual configurations for the other files in the project. Is there an easier way?

    Certainly providing just the root directory was not a good plan as it initiated an attempt to also upload the ‘.idea’ subdirectory that PyCharm creates (not a good IDEA, sorry just couldn’t let that one pass).

    • Andrey Vlasovskikh says:

      Thanks for your feedback!

      You can specify either individual files or directories in your MicroPython run configurations. Create a new one via “Run | Edit Configurations” menu and specify the path you want to become your root folder after uploading to your device. You can mark unnecessary sub-directories as excluded by right-clicking on them in the project view and selecting “Mark Directory as | Excluded”. The .idea folder is hidden and excluded by default, so it should interfere with your upload.

      Feel free to report any problems with this feature to the issue tracker.

      • Kris says:

        You are way ahead of me apparently. I had not noticed that I could exclude files/directories.

        Would you like feature requests on the issue tracker as well? I am sure I can come across something I would like to see improved although it is proving difficult so far :-) A solution to issue #12 would certainly be my highest priority right now.

        • Andrey Vlasovskikh says:

          Sure, feel free to file new feature requests.

          • Kris says:

            Solution didn’t work – under Win10 the ‘.idea’ directory isn’t displayed in the project view to select in order to exclude. I can’t seem to find a setting to change that…

        • Andrey Vlasovskikh says:

          Could you report an issue about mistakenly uploading .idea alongside the rest of the project to the issue tracker and share your project with all the project files (as a GitHub project or as a link to an archive)?

  7. Marijn Vriens says:

    Totally awesome! I’m going to love using this for my next embedded projects!

    Next stop: Remote device debugging in CLion 😉

  8. aaron says:

    Trying to install the plugin based what is stated in the article, however, I keep getting this error:

    Plugin MicroPython was not installed: Cannot download ‘’: Read timed out

    What might be the issue?


  9. aaron says:

    Yes, it loaded.

    Another question how do you find the device path for the usb? I looked in device manager and the device instance path for Com port 6 and it gives me USB\VID_10C4&PID_EA60\013742A2. This is not anything like what the tutorial show?

    • Andrey Vlasovskikh says:

      The plugin has a hard-coded list of (VID, PID) for several devices in their device type provider class. For ESP8266 it’s this line. These IDs are then passed to that returns a device name on Windows or a device path on macOS/Linux.

      Feel free to test the plugin build from sources for your device and send a pull request.

  10. Wasanka says:


    Are there any plans to add websocket connection to micropython devices so that programming and flashing can be done wireless?

  11. Jaime Caballero says:

    Hey, I own a pyboard and I been using it just editing the file. It is really cool to have the REPL o pycharm but theres a problem for me… I have Windows 10 and there no driver support for the pyboard. Do you know what can I do ?

  12. Federico says:

    Hello Andrey, first of all, I wanted to congratulate you for this great work, it is a great effort.
    I was following the steps, but I have a problem when downloading the firmware to ESP8266. I get the following sentence:

    Connecting to / dev / ttyUSB0
    Uploading files: 0% (0/1)

    and it does not advance anymore, it stays there.
    I would be grateful for the help you can give me.
    Thank you very much!

    • Andrey Vlasovskikh says:

      Thanks Federico!

      The plugin doesn’t update the MicroPython firmware. You need to flash your interpreter manually via esptool, see wiki page on ESP8266 for an example. The parameters will be specific to your board.

      The plugin is capable of flashing Python files after your interpreter on the device is set up.

      Please feel free to file bug reports to the issue tracker.

      • Federico says:

        Resolved, thank you very much for the help, I overlooked this item.
        It goes very well, I will continue working with him and I will recommend him to my colleagues.

        Thanks and congratulations for the work.

  13. Jonas says:

    Hey, great work! The MicroPython entry under Tools does not show up for me. Could this be a configuration error on my side? Flashing files works, so the Plugin seems to work generally.

  14. PointOnePA says:

    Just some feedback from using MicroPython Plugin for PyCharm Community 2017.3 under Windows 10 and the pyboard.

    1) The plugin won’t work with the PyCharmEDU version because that version doesn’t install the embedded terminal. I could not find the correct terminal plugin to add after the fact, which is why I installed the Community edition

    2) REPL works under Windows, but if you start it, it stops any running program on the pyboard and ties up the COM port. Thus you have to close the REPL terminal in order to use RUN again.

    3) RUN connects to the COM port long enough to upload the file, then released the COM port. If the pyboard program writes to the pyboard console using “print”, then you can use Putty or some other serial program to connect to the COM port to monitor the activity.

    4) I could get around the above console issue just by opening another COM port and using that for print/diagnostics, instead of the default, (thus leaving the default available to PyCharm for the RUN command). I use a 3.3V USB to serial device (FTDI TTL-232R-3V3) and a 2nd USB port on the PC.

    5) I see the value of having this tool and of using PyCharm IDE and IntelliJ to do code development. Another way that I’ve been using for a while with the pyboard is to locate the project files located on the pyboard via the Windows USB flashdrive. PyCharm the edits those files upon the pyboard, (this may not be possible on other devices). I then use from the Putty COM interface to test the files that I’m working on in PyCharm IDE. So I still have that advantages of PyCharm and IntelliJ and leaves Putty open for diagnostics and doesn’t require a second serial port for diagnostics.


Leave a Reply

Your email address will not be published. Required fields are marked *