IDEs (PyCharm, NetBeans, etc.) for MicroPython

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
User avatar
khargh
Posts: 2
Joined: Mon Oct 05, 2015 10:20 am

IDEs (PyCharm, NetBeans, etc.) for MicroPython

Post by khargh » Tue Oct 06, 2015 3:13 pm

Hello Everyone,

I'm just started my adventure with pyboard and python so I beg your indulgence in this regard.
I was trying to find some kind of tool like PyCharm or Netbeans which could help me as a beginner with code completion for example.
I'm just started so syntax is quite a problem. What I could find on the forum was two threads regarding IDE for pyboard - tool integrated with chrome (WEB IDE) and IPython. Please let me know if its possible to import/copy the pyb.py module that i can use it in IDE like PyCharm. If this would be possible then I could import pyb in my project and use pyb.timers for example. Of course I could not debug this without the hardware but all problem with syntax would gone forever.
Maybe this is just dead end so I would be very grateful if you could write your comments.

Many thanks,

Khargh

User avatar
platforma
Posts: 258
Joined: Thu May 28, 2015 5:08 pm
Location: Japan

Re: PyCharm or NEtBeans with pyBoard.

Post by platforma » Tue Oct 06, 2015 3:45 pm

Hey Kharg,

If you're comfortable with python syntax in general, I'd suggest you don't go overboard and just use your favorite text editor together with python documentation (which you can build locally by the way), by looking at examples or test files you will quickly memorize the API and will be able to work with it. You can, of course, set up PyCharm and set up your environment to push the scripts onto your board, in whichever way you do it. Importing upy modules into your PyCharm project will give you code completion and other bells and whistles.

I personally use Makefiles and a text editor. Unless your projects are going to have dozens of files, you probably shouldn't worry about an IDE too much. But that's just my opinion of course!

User avatar
khargh
Posts: 2
Joined: Mon Oct 05, 2015 10:20 am

Re: PyCharm or NEtBeans with pyBoard.

Post by khargh » Tue Oct 06, 2015 9:54 pm

Thank you for replay platforma,
I believe that you can use just text editor like notepad++ for example it was always great tool for me.
In other hand when you are thinking about comfort for newbies like me it would be much easier to use project in IDE where you can have all your fies, clesses etc, code competion and so on.
I was trying to find pyb.py file in the https://micropython.org/download/ micropython-master-zip but without luck.
Please just guide me where I can find files like pyb.py and if it's only one file which need to be imported into project.
Many thanks in advance!
Khargh

User avatar
dhylands
Posts: 3247
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: PyCharm or NEtBeans with pyBoard.

Post by dhylands » Wed Oct 07, 2015 12:13 am

Unfortunately, there is no pyb.py file, because the pyb module is written entirely in C.

I think that having a pyb.py file would be a good idea, but to be feasible I think it really needs to be auto generated. Maybe there is a way to do this in sphinx (which is currently used to generate the online docs).

dastultz
Posts: 20
Joined: Mon Jan 11, 2016 2:56 am

Re: PyCharm or NEtBeans with pyBoard.

Post by dastultz » Sun Jan 31, 2016 3:23 am

I use PyCharm for development, and I too want code completion. I've been looking at the `inspect` module and it would seem to me that this could be used to generate the modules, classes, methods, and fields in `pyb`. This doesn't seem too hard, but it also seems like someone would have thought of this before me.

Has anyone seen the `inspect` module used to do something like this?

/Daryl

User avatar
dhylands
Posts: 3247
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: PyCharm or NEtBeans with pyBoard.

Post by dhylands » Sun Jan 31, 2016 6:28 am

MicroPython on the pyboard has tab completion for module names and method names already.

See: http://docs.micropython.org/en/latest/r ... completion

dastultz
Posts: 20
Joined: Mon Jan 11, 2016 2:56 am

Re: PyCharm or NEtBeans with pyBoard.

Post by dastultz » Sun Jan 31, 2016 2:44 pm

Yes, on the pyboard which is nice for exploratory work while connected to the board. I'm talking about development in an IDE. This thread is about getting code completion and whatnot in an IDE and the responses are mostly redirecting - use a simple text editor... I know there are plenty of people happy working with emacs, vim, and other simple editors. I am not, I'm in the "fat IDE" camp.

So I'm trying to address the problem of there being no pyb.py file. I'd like to generate one using the "inspect" module but I don't want to do any work that's already been done.

Thanks.

/Daryl

User avatar
dhylands
Posts: 3247
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: PyCharm or NEtBeans with pyBoard.

Post by dhylands » Sun Jan 31, 2016 5:51 pm

Currently MicroPython has no inspect module.

However, you can do a fair bit using the dir command:

Code: Select all

>>> import pyb
>>> dir(pyb)
['__name__', 'bootloader', 'hard_reset', 'info', 'unique_id', 'freq', 'repl_info', 'wfi', 'disable_irq', 'enable_irq', 'stop', 'standby', 'main', 'repl_uart', 'usb_mode', 'hid_mouse', 'hid_keyboard', 'USB_VCP', 'USB_HID', 'have_cdc', 'hid', 'millis', 'elapsed_millis', 'micros', 'elapsed_micros', 'delay', 'udelay', 'sync', 'mount', 'Timer', 'rng', 'RTC', 'Pin', 'ExtInt', 'pwm', 'servo', 'Servo', 'Switch', 'SD', 'LED', 'I2C', 'SPI', 'UART', 'CAN', 'ADC', 'ADCAll', 'DAC', 'Accel', 'LCD']
You can iterate through those and then dir on them. If the type(obj).__name__ == 'type' then you know its really a class name, and you can call dir it to get the attributes. (so dir(pyb.Pin) for example).

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: PyCharm or NEtBeans with pyBoard.

Post by pfalcon » Mon Feb 01, 2016 10:18 am

micropython-lib has inspect module: https://github.com/micropython/micropyt ... er/inspect (as wells as tons of other modules). It's pretty bare so far, as that's what was needed of it so far by folks who used it.
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

dastultz
Posts: 20
Joined: Mon Jan 11, 2016 2:56 am

Re: PyCharm or NetBeans with pyBoard.

Post by dastultz » Tue Feb 02, 2016 1:51 am

I wrote a quick thing using the inspect module against a module on the CPython side and it was super easy and short. But it didn't work on the Pyboard. I thought I found the inspect module was not on the Pyboard but maybe it just didn't have that parts I needed. The inspect module on CPython didn't fit! Then I tried Docutils parsing the RST documentation but found the API difficult. So now I'm just going brute-force manual on the RST documents. I'm determined!

/Daryl

Post Reply