This is designed to be a common set of packages that all deployments with
networking support should include.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This is not included by default in most builds, and isn't necessary for
this module anyway.
Also fix the local variable shadowing the traceback module in _capture_exc.
Added test for both (works on CPython and MicroPython).
Version bump to 0.10.2.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Adds missing "duration_ms" argument to the example, and a second example
that shows the "interval_us" / "window_us" and also active scan.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Previously a child logger just uses the global default when unset.
Modified to matches the CPython behavior of using the parent's level.
Also implemented CPython's getEffectiveLevel() which provides a convenient
way to implement this. In our version, we only ever have one parent
(the root), so it only has to recurse one level.
Also set the default level to WARNING to match CPython.
Updated the examples to highlight the differences (but they now match).
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
* Add instructions for how to use micropython-lib.
* Add a terminology guide and use consistent terminology
(package/module/library).
* Improve code conventions and contributor guidelines.
* Misc readme updates.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Add support for all format specifiers, support for `datefmt` using
(optional) strftime, and support for Stream and File handlers.
Ports/boards that need to use `FileHandlers` should enable
`MICROPY_PY_SYS_ATEXIT`, and enabled `MICROPY_PY_SYS_EXC_INFO` if using
`logging.exception()`.
This adds most of the common functionality of pathlib.Path.
The glob functionality could use some work; currently it only supports a
single "*" wildcard; however, this is the vast majority of common use-cases
and it won't fail silently if non-supported glob patterns are provided.
Use explicit pin numbers to instantiate the SPI interface on RP2.
On ESP32 use SoftSPI(...) rather than SPI(-1, ...).
Update terminology to initiator/responder.
Tested with two Pico boards.
Originally by @peterhinch.
See https://github.com/micropython/micropython/pull/6007 for discussion.
The summary is that on some cards (especially older Kingston ones) if the
bus is shared with other SPI devices, then it seems to require that MISO
is high for a few cycles before the transaction is initiated.
Because CS is high, this change should otherwise be a no-op.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This allows a much more natural way of implementing unitttest-discover:
- unittest provides unittest/__init__.py
- unittest-discover provides unittest/__main__.py
It also fixes an bug where unittest.py previously detected the presence of
unittest-discover.py by importing an checking for the ImportError. But that
could also be raised by a missing dependency. Now when you run
`micropython -m unittest` without unittest-discover, you get
`ImportError: no module named 'unittest.__main__'`, and without the
required deps, `ImportError: no module named 'argparse'`.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Works like "python -m venv path" and creates a rudimentary virtual
environment for the Unix port:
- sets MICROPYPATH
- copies the micropython binary to venv/bin/micropython which is in $PATH
- installs mip & mip-cmdline in the venv
Using the venv is the same as for CPython -- source the activate script to
enter, and call the deactivate function to leave.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Moves mip.py to mip/__init__.py, so that the optional (added in this
commit) mip/__main__.py can exist to support:
`micropython -m mip install [--target,--index,--no-mpy] package@version`
"install" works by forwarding the arguments directly to mip.install.
Updates mip to v0.2.0 because of the change in directory structure.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Duplicate Ctrl-C and LF detection requires this, but it was incorrectly
saving the current value, not the previous.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
The regular REPL uses the uncooked input, but aiorepl reads from sys.stdin
which is cooked. The result is that if the client sends a CRLF, aiorepl
will see LFLF.
This ignores a second LF in quick succession from the first.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
- `_FLAG_WRITE` was incorrectly `_FLAGS_WRITE`
- `response` should be defaulted to `None` rather than `False` in order
to detect that when it is unspecified.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This tool implements a subset of the ESP32 ROM bootloader protocol, and
it's mainly intended for updating Nina WiFi firmware from MicroPython, but
can be used to flash any ESP32 chip.
Check the machine module first, then search in previous places. This
supports having machine.dht_readinto as the new standard, while still being
backwards compatible.
This replaces the options that could be specified previously to include
and require.
The `aioble` package now provides everything. For a minimal install, the
individual components can now be installed or require()'ed explicitly.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
After `reconnect()`, MQTTClient.socket is blocking by default, and
check_msg() can block. This commit aims to fix that behaviour by
reimplementing `check_msg()` for umqtt.robust and setting the socket to
non-blocking.
Fixes issue #192.
The statement "with assertRaises(errtype) as ctxt" checks the type of a
raised exception, but did not store the exception into ctxt like unittest
of CPython. The exception instance is usually used to check its message or
other args.
Riffing on "pip", "mip installs packages".
This is a replacement for the previous `upip` tool for on-device
installation of packages.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This populates https://micropython.org/pi/v2 with compiled packages,
suitable for use by `mip` and `mpremote`.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This replaced the per-characteristic queues with a single shared queue,
which means that the characteristics will return from `written()` in the
exact order that the original writes arrived, even if the writes are
occuring across multiple different characteristics.
This work was funded by Planet Innovation.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This provides an async REPL with the following features:
- Run interactive REPL in the background.
- Execute statements using await.
- Simple history.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
In order to make this more suitable for non-unix ports, the discovery
functionality is moved to a separate 'extension' module which can be
optionally installed.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Although this primarily makes sense for the unix port, there's nothing
preventing it being used on any port, and it's written for MicroPython.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>