MicroPython Plugin for IntelliJ and PyCharm
The plugin supports these devices:
Note: This plugin is intended for the development, upload and execution of Python files using an attached MicroPython device. It does not yet support flashing the MicroPython firmware image to that device. See these instructions flashing MicroPython firmware images to devices.
This plugin is still in its early days. It will support more MicroPython devices and more device-specific and MicroPython-specific modules eventually. We are interested in your contributions to the project. Feel free to open issues and send pull requests!
Code insight for MicroPython modules
Context-aware code completion and documentation
Syntax checking and type checking
Run code on MicroPython devices
Flash Python files to devices
- IntelliJ 2017.3+ or PyCharm 2017.3+
- Python 3.5+
- MicroPython language version is 3.5. If you select a newer version, turn on "File | Settings | Editor | Inspections | Python | Code compatibility inspection" and add Python 3.5 to the compatibility list there
- Python plugin (IntelliJ only)
- Supported MicroPython development board with recent version of MicroPython firmware flashed to board.
Install the "MicroPython" plugin from your IDE settings.
The setup steps differ for IntelliJ and PyCharm:
IntelliJ: Add the MicroPython facet to a Python module in your project structure
PyCharm: Enable MicroPython support in "File | Settings | Languages & Frameworks | MicroPython"
- Windows Note:
- There are usually two options for project interpreter under Windows:
pythonw.exe. Make sure you select
python.exeas the Project Interpreter or you will not be able to start the Micropython REPL
Flash all project files
Exclude the PyCharm .idea directory. This prevents the contents of this directory from being uploaded to the MicroPython device.
Select the top level folder of the project in the path browser of "Run/Debug Configurations".
Name the Run/Debug Configuration and hit OK or Apply
Create run configurations for individual files
Flash non-python files
Currently non-python files do not display in the "Run/Debug Configurations" file picker although they do display in the Project Navigator.
Non-python files can be uploaded to the board by manually typing the required filename/path components into the "Path:" dialog.
It is easier to select a python file in the same directory as the file to be uploaded using the file picker and then manually edit the filename. This ensures that the path component of the file to be uploaded is correct
Note that when flashing an entire project using the technique above, ALL files are uploaded to the device, including non-python files. This is the reason the .idea directory should be excluded from the project structure.
- References to
pybmodule are marked as unresolved (#16)
- References to some modules from the MicroPython standard library are marked as unresolved
The plugin is written in Python and Kotlin. Kotlin a new JVM language by JetBrains, the makers of IntelliJ and PyCharm. Google recently selected Kotlin as an officially supported language for Android development.
The steps for setting up the development environment:
- Check out this project from GitHub
- Create a new project from existing sources in IntelliJ 2017.3 or newer
To just run the development version use
./gradlew clean runIde from the command line.
Contributions are welcome!
The plugin is licensed under the terms of the Apache 2 license.