newbie questions: Development flow

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
arrowcircle
Posts: 2
Joined: Thu Nov 01, 2018 8:36 am

newbie questions: Development flow

Post by arrowcircle » Thu Nov 01, 2018 9:39 am

Hi! I am just starting to get into micropython and have a lot of questions about the flow of the development and tools.
It will be good if someone will help with part of the questions or directions to the solution.

1. Tools for syntax check and linters. Its very bad idea to know if there is a syntax error in the code and know about it only after uploading the code and looking at the logs of the board. I tried pylint, but it does not like micropython std libraries. Is there are any syntax check cli tools for micropython?

2. Uploading files is pain in the ass. Is there are any bash or other scripts to precompile the code, upload it to the board and show logs?

3. I've seen unittest library in std, but there are no info in the repo or google about how to use it. I am looking at two cases: running tests in unix version of micropython on CI/CD and running integration tests on the board itself for final checks. How this can be solved?

kevinkk525
Posts: 969
Joined: Sat Feb 03, 2018 7:02 pm

Re: newbie questions: Development flow

Post by kevinkk525 » Thu Nov 01, 2018 10:02 am

As for 1) and 2) you will find a lot of information just searching the forum. There are many threads about IDE for development and ways of uploading code including freezing to firmware but it also depends on your board so mention this.
Personally I use PyCharm with micropython plugin for development.
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode

HermannSW
Posts: 197
Joined: Wed Nov 01, 2017 7:46 am
Contact:

Re: newbie questions: Development flow

Post by HermannSW » Thu Nov 01, 2018 7:46 pm

arrowcircle wrote:
Thu Nov 01, 2018 9:39 am
2. Uploading files is pain in the ass. Is there are any bash or other scripts to precompile the code, upload it to the board and show logs?

3. I've seen unittest library in std, but there are no info in the repo or google about how to use it. I am looking at two cases: running tests in unix version of micropython on CI/CD and running integration tests on the board itself for final checks. How this can be solved?
2) Enable WebREPL, and use "webrepl_cli.py" to copy files to/from board then as if using "ssh". Just git sync official webrepl repo and you have it. You can use WebREPL in brower to run a remote MicroPython session as well. If you want such session on the command line, use webrepl_client.py. You can precompile (.py -> .mpy) using mpy-cross from micropython repo. It is enough to upload "mod1.mpy" to be able to "import mod1".

3) I did build micropython/ports/unix and was able to run testsuite for unix MP easily. I was able to run against ESP32 board as well, but don't remember how I did it. Maybe with --pyboard option.
Pico-W Access Point static file webserver:
https://github.com/Hermann-SW/pico-w

Tiny MicroPython robots (the PCB IS the robot platform)
viewtopic.php?f=5&t=11454

webrepl_client.py
https://github.com/Hermann-SW/webrepl#webrepl-shell

stijn
Posts: 735
Joined: Thu Apr 24, 2014 9:13 am

Re: newbie questions: Development flow

Post by stijn » Fri Nov 02, 2018 9:00 am

1. Any editor with Flake8 (and PEP8 autoformat while you're at it) support is a good start, it will catch many 'stupid' errors.
Previous topics:
viewtopic.php?f=18&t=4567
viewtopic.php?f=15&t=4242
viewtopic.php?f=18&t=4567

2. You need micropython-lib for the unittest module: https://github.com/micropython/micropython-lib/

Post Reply