Code Monkey home page Code Monkey logo

intellij-micropython's Introduction

MicroPython Plugin for IntelliJ and PyCharm

JetBrains team project

The Python code development plugin for MicroPython devices in IntelliJ IDEA and PyCharm.

Supported devices

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!

Features

Code insight for MicroPython modules

  • Context-aware code completion and documentation

    • Use Ctrl+Q (F1 on macOS) for quick documentation window, you can dock it permanently

      Code completion

  • Syntax checking and type checking

    • The plugin checks your code while you're typing it

      Type checking

Run code on MicroPython devices

  • Flash Python files to devices

    • Use "MicroPython" run configurations to flash files or folders in "Run | Edit Configurations..." menu

      Run

  • MicroPython REPL

    • Use "Tools | MicroPython | MicroPython REPL" menu to run a MicroPython shell on your device

      REPL

Requirements

  • 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.

Installation

  1. Install the "MicroPython" plugin from your IDE settings.

  2. 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"

    Configurable

  1. Windows Note:
  • There are usually two options for project interpreter under Windows: python.exe and pythonw.exe. Make sure you select python.exe as the Project Interpreter or you will not be able to start the Micropython REPL

Usage details

Flash all project files

  • Exclude the PyCharm .idea directory. This prevents the contents of this directory from being uploaded to the MicroPython device.

    Project Structure

  • Select the top level folder of the project in the path browser of "Run/Debug Configurations".

    Project Flash

  • Name the Run/Debug Configuration and hit OK or Apply

Create run configurations for individual files

  • Right click on the file and select "Create Flash ..."

    Quick Configuration Creation

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.

    Non-python File Upload

Known Issues

  • References to pyb module are marked as unresolved (#16)
  • References to some modules from the MicroPython standard library are marked as unresolved

Source Code

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:

  1. Check out this project from GitHub
  2. 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!

License

The plugin is licensed under the terms of the Apache 2 license.

intellij-micropython's People

Contributors

kaybee335 avatar lensvol avatar plugowski avatar vlasovskikh avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.