ANN: micropython-dev - MicroPython variant for development/research (unix port)

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

ANN: micropython-dev - MicroPython variant for development/research (unix port)

Post by pfalcon » Sat Dec 22, 2018 9:23 pm

One of the biggest aims of MicroPython is to stay small, to accommodate the smallest of systems, and leave as much as possible resources for user applications, instead of hogging them for MicroPython itself. That means that amount of new features which can be added to "production" versions is limited. (That's beyond the plenitude of features they already offer, by which MicroPython surpasses any other embedded scripting language).

Well, there're some issues with that:

1. People always want more, more and MORE!!11
2. With the focus of currently provided executables on "production" mode, i.e. running well-developed and debugged applications, there's no place where to put various things which aren't (shouldn't be) needed in production, but may be quite helpful during development, debugging, and experimentation and research overall.

With that in mind, in https://github.com/micropython/micropython/pull/4309 I made a proposal to add "micropython-dev" executable/variant for Unix port. It immediately would offer all(most) features implemented in MicroPython codebase, and open room to add various development aids.

Beyond that patch, micropython-dev is available in my fork, viewtopic.php?f=15&t=5699. To build it:

Code: Select all

cd ports/unix
make dev
./micropython-dev
To show what it can do now (and it's just starting):

Code: Select all

$ micropython-dev 
...
>>> "" == b""
<stdin>:1: BytesWarning: Comparison between bytes and str
False
With production version:

Code: Select all

$ micropython
MicroPython v1.9.4-872-ga8a4ab584-dirty on 2018-12-22; linux version
Use Ctrl-D to exit, Ctrl-E for paste mode
>>> "" == b""
Warning: Comparison between bytes and str
False
I.e. with -dev version, warnings are printed with the location where they happen, so finding problems spots and fixing them is easy.
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/

jickster
Posts: 629
Joined: Thu Sep 07, 2017 8:57 pm

Re: ANN: micropython-dev - MicroPython variant for development/research (unix port)

Post by jickster » Sat Dec 22, 2018 9:56 pm

Printing exact location of warnings should be part of mainline.

I vaguely remember someone requesting this and mods said “too much resources” or something like that.


Sent from my iPhone using Tapatalk Pro

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

Re: ANN: micropython-dev - MicroPython variant for development/research (unix port)

Post by pfalcon » Tue Jan 22, 2019 11:23 pm

Another example of a feature implemented in micropython-dev: ability to override __import__() builtin, i.e. module import mechanism. This allows for great extensibility of language environment. For example, it's possible to implement automatic precompilation of .py files into bytecode files, .mpy. I.e. make it work the same as CPython, but without touching the core of the language.
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/

Post Reply