Wykres commitów

1599 Commity (7f5ac838655862cb19d8a5762a0a1e0b320b480a)

Autor SHA1 Wiadomość Data
Angus Gratton 1eb282ad47 tools/ci.sh: Support publishing package and index files to GitHub Pages.
Opt-in feature to make it easier for folks to test packages that are still
in development, open in Pull Requests, or even in independent forks.

---

To enable this on your own GitHub fork of the micropython-lib repository
then navigate to the fork's "Settings" -> "Secrets and variables" ->
"Actions" -> "Variables" page, then click "New repository variable", and
create a variable named MIP_INDEX with value true (or any "truthy" value).

Once enabled then any time a branch is pushed to your fork and builds
successfully, GitHub Actions will also push the built packages and package
index to the gh-pages branch which is associated with the repo's GitHub
Pages web site.  The packages can then be installed remotely via:

    mpremote mip --index \
      https://USERNAME.github.io/micropython-lib/mip/BRANCH_NAME PACKAGE_NAME

or on a device as:

    mip.install(PACKAGE_NAME, index="https://USERNAME.github.io/micropython-lib/mip/BRANCHNAME")

(Replace USERNAME, BRANCH_NAME and PACKAGE_NAME as applicable. If you've
renamed your fork, change the name micropython-lib to match.)

Note: As well as the MIP_INDEX repository variable, this functionality
depends on both GitHub Actions and GitHub Pages being enabled on your
repository in GitHub.  However both options should enable automatically,
unless they have been manually disabled.

This work was funded through GitHub Sponsors.
2023-03-02 16:44:18 +11:00
iabdalkader 9ee02576cb senml: Add SenML library.
This is a new library that doesn't follow any existing API.

The library is originally from
https://github.com/kpn-iot/senml-micropython-library.
2023-03-01 01:18:30 +11:00
iabdalkader 52fcb8e4a7 cbor2: Add cbor2 library.
This aims to follow the API of the cbor2 library found at
https://github.com/agronholm/cbor2 (also on PyPI as cbor2).

The original source for this MicroPython version of cbor2 is from
https://github.com/kpn-iot/senml-micropython-library.
2023-03-01 01:13:06 +11:00
Daniel Flanagan 78900afca5 aioble: Add short name support to scan results.
Signed-off-by: Damien George <damien@micropython.org>
2023-02-28 11:07:34 +11:00
Gavin Douch 23018a86bf unittest: Add subtest usage examples.
This work was funded by Planet Innovation.
2023-02-21 23:56:06 +11:00
iabdalkader e3371bef6c bmm150: Add new magnetometer driver.
For the BOSCH BMM150 magnetometer.
2023-02-18 15:55:36 +11:00
iabdalkader 92854c1754 bmi270: Add new IMU driver.
For the BOSCH BMI270 IMU.
2023-02-18 15:55:10 +11:00
iabdalkader bf8b3c04de lsm9ds1: Refactor driver.
Changes are:
- fix typos
- simplify the driver init code
- support setting the magnetometer ODR separately
- update manifest
2023-02-18 15:54:04 +11:00
iabdalkader e88aa3af16 lsm6dsox: Refactor driver.
Changes are:
- fix typos
- make constants global
- rename functions with double underscore to single underscore
- rename __init__ keyword argument cs_pin -> cs
- rename read_mlc_output() -> mlc_output()
- rename read_gyro() -> gyro()
- rename read_accel() -> accel()
- update manifest
2023-02-18 15:51:53 +11:00
iabdalkader 203e1e63b1 hs3003: Add new relative humidity and temperature sensor driver.
Renesas HS3003 Humidity and Temperature sensor driver.
2023-02-18 15:50:57 +11:00
Jim Mussared a08087249f top: Update Python formatting to black "2023 stable style".
See https://black.readthedocs.io/en/stable/the_black_code_style/index.html

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-02-03 17:12:38 +11:00
Damien George c1526d2d1e github/workflows: Add workflow to build all packages.
Signed-off-by: Damien George <damien@micropython.org>
2023-02-01 12:28:25 +11:00
Damien George e3059a9b58 bundle-networking: Fix metadata to correctly use "description" field.
Signed-off-by: Damien George <damien@micropython.org>
2023-02-01 12:21:08 +11:00
Damien George 2cd63d6cf4 glob: Fix require of os-path.
Signed-off-by: Damien George <damien@micropython.org>
2023-02-01 12:07:28 +11:00
Damien George 212cb7790f urllib.parse: Fix require of collections-defaultdict.
Signed-off-by: Damien George <damien@micropython.org>
2023-02-01 12:04:07 +11:00
Jim Mussared c1f553eab9 micropython/bundles: Add a bundle-networking meta-package.
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>
2023-02-01 11:28:42 +11:00
Andrzej Kowalczyk 863a018b89 unittest: Remove dependence on sys.exc_info.
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>
2023-01-31 12:38:00 +11:00
Jim Mussared a5ef231e7d aioble/README.md: Demostrate optional args to aioble.scan().
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>
2023-01-17 14:36:41 +11:00
Damien George 423f5fa2c2 logging: Bump version to 0.5.
Signed-off-by: Damien George <damien@micropython.org>
2022-12-21 14:55:56 +11:00
Jim Mussared 8a7eb40009 logging: Simplify check for strftime.
Only needs to be checked at the call site.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-12-21 12:08:43 +11:00
Jim Mussared 58bab0add3 logging: Fall back to root logger level for unset child.
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>
2022-12-21 09:52:26 +11:00
Jim Mussared a9e52d085c top: Update top-level docs.
* 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>
2022-12-16 17:16:03 +11:00
Damien George 8d653e96db time: Add unit test for time.strftime.
Signed-off-by: Damien George <damien@micropython.org>
2022-12-14 11:57:55 +11:00
iabdalkader 8456a2aa68 time: Add time module to provide strftime. 2022-12-14 11:57:12 +11:00
iabdalkader d717b04cb3 logging: Improve the logging module.
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()`.
2022-12-06 17:40:10 +11:00
Brian Pugh 0051a5ef50 pathlib: Add initial pathlib implementation.
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.
2022-11-17 14:26:33 +11:00
Peter Hinch d1aaec7174
nrf24l01: Improve test to add RP2 support, fix ESP32.
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.
2022-11-15 23:50:04 +11:00
Fredrik Strupe 4556023a0c sensor/mhz19: Add driver for MH-Z19 (CO2 sensor).
Originally by Fredrik Strupe, updated for micropython-lib.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-11-15 23:06:42 +11:00
Jim Mussared 6fca45f4f5 sdcard: Set MISO high before readblocks/writeblocks.
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>
2022-11-14 22:46:37 +11:00
Damien George 56dc65b6a7 tempfile: Add manifest.py file at version 0.0.1.
Signed-off-by: Damien George <damien@micropython.org>
2022-11-11 13:05:04 +11:00
Brian Pugh a99b80186d tempfile: Add unit tests for tempfile, and don't use os.path.join. 2022-11-11 13:04:16 +11:00
Brian Pugh 8ce4adf8bf shutil: Add unit tests for shutil. 2022-11-11 13:04:16 +11:00
Brian Pugh 69e8a502dd shutil: Don't allow an empty string in rmtree. 2022-11-11 13:04:14 +11:00
Brian Pugh 4ae896afdc shutil: Fix shutil.rmtree to use os.ilistdir instead of os.walk. 2022-11-11 13:01:23 +11:00
Brian Pugh ee286ed28c tempfile: Add initial tempfile implementation.
With TemporaryDirectory class and mkdtemp function.
2022-11-11 13:00:51 +11:00
robert-hh 2b07820df3 dht: Fix regression importing dht_readinto from pyb.
sys.platform of Pyboard is "pyboard", not "pyb".
2022-11-10 11:13:37 +11:00
Jim Mussared 038b4ac657 unittest: Convert to a package.
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>
2022-11-09 14:56:34 +11:00
Patrick Joy a14226f7c5 shutil: Add disk_usage function.
Signed-off-by: Patrick Joy <patrick@joytech.com.au>
2022-11-09 14:44:40 +11:00
Jim Mussared c26d77b52e venv: Add a command-line package for creating virtual environments.
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>
2022-11-09 12:52:03 +11:00
Jim Mussared 143c2937de mip: Set opt=3 by default.
mip will be installed by default on many boards. Make it small.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-11-09 12:43:31 +11:00
Jim Mussared a363ac6b21 micropython/mip: Add command-line functionality for the Unix port.
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>
2022-11-09 12:43:04 +11:00
sandyscott 81c1408a07 aiorepl: Fix ordering of saving previous character.
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>
2022-11-09 12:36:05 +11:00
sandyscott d6eb5b6f7e aiorepl: Ignore duplicate LFLF after converting CRLF from Windows.
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>
2022-11-09 12:35:57 +11:00
Jim Mussared 50b7aca171 aioble/client.py: Fix default for the `response` arg to char.write().
- `_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>
2022-11-08 18:57:29 +11:00
iabdalkader 82f6b18b88 espflash: Add a minimal ESP32 bootloader protocol implementation.
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.
2022-11-08 18:45:22 +11:00
robert-hh 0e25b109c2 dht: Change the sequence for importing dht_readinto.
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.
2022-11-08 18:23:26 +11:00
iabdalkader 900dd1c61b ntptime: Allow overriding default NTP timeout.
The default 1 second timeout is sometimes not enough depending on the host
and network latencies.  This patch makes timeout configurable.
2022-10-26 00:05:19 +11:00
Jim Mussared 8503017e3b aioble: Split into optional components.
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>
2022-10-06 16:45:15 +11:00
Ian Cotter-Llewellyn 4dc2d5e17f umqtt.robust: Fix check_msg blocking after reconnect.
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.
2022-10-04 12:59:09 +11:00
Meir Armon b50d3462d7 umqtt.simple: Return op from wait_msg() as indication of reception.
Fixes issue #328.
2022-10-04 12:34:31 +11:00