Page 1 of 1

newbie questions: Development flow

Posted: Thu Nov 01, 2018 9:39 am
by arrowcircle
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?

Re: newbie questions: Development flow

Posted: Thu Nov 01, 2018 10:02 am
by kevinkk525
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.

Re: newbie questions: Development flow

Posted: Thu Nov 01, 2018 7:46 pm
by HermannSW
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.

Re: newbie questions: Development flow

Posted: Fri Nov 02, 2018 9:00 am
by stijn
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/