Wykres commitów

1659 Commity (852f2cceff9f35ecf59db303400b8cd8e63dbc1d)

Autor SHA1 Wiadomość Data
Damien George 852f2cceff inspect: Support closures/generators/async-funcs in inspect.signature.
This is a follow-up to b4565b41ea (PR #1043),
to support closures, async functions and generators in `inspect.signature`.

Signed-off-by: Damien George <damien@micropython.org>
2025-11-24 13:03:03 +11:00
Breno RdV 7d0a1f86be lora: Fix import error detection for missing drivers.
Signed-off-by: Breno RdV <breno@raccoon.ninja>
2025-11-19 09:17:51 +11:00
Marcel Petrick b3125247bf all: Correct various typos in comments and docs.
Non-functional changes only:
- Fixed minor spelling mistakes in comments.
- Corrected typos in user-facing strings.
- No variables, logic, or functional code was modified.

Signed-off-by: Marcel Petrick <mail@marcelpetrick.it>
2025-11-19 00:43:18 +11:00
Jos Verlinde 95fd713b8a pyproject.toml: Reorganize ruff lint settings for newer ruff.
Changes are:
- Reorganize lint settings to new sections.
- Align ignore rules with micropython/micropython repo.
- Update to python38 syntax to enable `:=` operator.

Signed-off-by: Jos Verlinde <Jos_Verlinde@hotmail.com>
2025-11-19 00:32:23 +11:00
Jos Verlinde 9ff562640d cbor2: Silence missing `__eq__` warning.
Signed-off-by: Jos Verlinde <Jos_Verlinde@hotmail.com>
2025-11-19 00:27:53 +11:00
Jos Verlinde bfd33d581a CONTRIBUTING: Add guidelines for module documentation and versioning.
Signed-off-by: Jos Verlinde <Jos_Verlinde@hotmail.com>
2025-11-19 00:16:52 +11:00
Jos Verlinde 2992784136 all: Fix formatting errors in docstrings.
No changes to versions as only comments and docstrings changed

Signed-off-by: Jos Verlinde <Jos_Verlinde@hotmail.com>
2025-11-19 00:16:52 +11:00
Jos Verlinde 886f136662 requests: Update example for fetching using requests.
This is a working alternative to PR #919.

Signed-off-by: Jos Verlinde <Jos_Verlinde@hotmail.com>
2025-11-19 00:16:52 +11:00
Jos Verlinde 0b78a15fb9 copy: Fix typo in _deepcopy_dispatch.
Fixes issue #952.

Signed-off-by: Jos Verlinde <Jos_Verlinde@hotmail.com>
2025-11-19 00:16:50 +11:00
Jos Verlinde 7b01b50bfb aioble: Fix typo in README in aioble.ADDR_PUBLIC.
Fixes issue #699.

Signed-off-by: Jos Verlinde <Jos_Verlinde@hotmail.com>
2025-11-19 00:16:26 +11:00
Jos Verlinde 28136d837a aioble/examples: Change variable name to _ADV_INTERVAL_US.
Fixes issue #1055.

Signed-off-by: Jos Verlinde <Jos_Verlinde@hotmail.com>
2025-11-19 00:16:05 +11:00
Jos Verlinde a7c805cc37 mip: Optimize _CHUNK_SIZE const for code size.
17 bytes reduced.

Signed-off-by: Jos Verlinde <Jos_Verlinde@hotmail.com>
2025-11-13 14:39:50 +11:00
Ben Wynn 200e8d13c9 sdcard: Updating sector calculation for SDXC.
The current code only calculates sectors for SDHC, with a max of 32G
The new code will calculate sectors for SDXC, with a max of 2T

C_SIZE is 22 bits[69:48] and the high 2 bits of csd[7] are required
to be 0, currently, so i'm not masking them off.

The max value for C_SIZE is 0x3FFEFF, so C_SIZE+1*1024 is a 32-bit number.

bumped version in manifest.py

Signed-off-by: Ben Wynn <bwynn@glowie.com>
2025-11-13 10:27:31 +11:00
Damien George 3eaf0279f3 datetime: Optimize for code size.
Optimizations applied here are:
- writing once-used helper functions inline in their place of use
- writing once-used constant tuples inline in their place of use (I would
  have used `from micropython import const` but that renders the code not
  runnable under CPython for testing, and also increases code size itself
  for the import)
- renamed _tmod to _t
- renamed _format to _fmt
- optimised timedelta._tuple() slightly

Reduces datetime.mpy by: 8897 -> 8728, so saves 169 bytes.

Signed-off-by: Damien George <damien@micropython.org>
2025-10-02 00:27:10 +10:00
Damien George 656f42071e datetime: Apply localtz patch to include naive date/time support.
This commit applies the existing `localtz.patch` patch to add support for
naive datetime objects.  That is, objects that don't have any info about
the current timezone.

This allows `datetime.datetime.now()` to work; prior to this patch it would
raise NotImplementedError.

Although we don't really have support for localtime vs gmtime on
bare-metal, ports such as the unix port and webassembly port do have this
distinction, and for them being able to do `datetime.datetime.now()` is
quite important (at least, that's what users expect to be able to do).

The associated unittest test has been updated.

This patch changes the size of datetime.mpy: 8466 -> 8897, so +431 bytes.

Signed-off-by: Damien George <damien@micropython.org>
2025-10-02 00:25:35 +10:00
Damien George b4565b41ea inspect: Implement a very basic signature function.
This implements a very basic `inspect.signature()` function.

At the moment it returns only a simple `Signature` instance with a
`parameters` attribute that holds an `OrderedDict` whose length matches the
arity of the input function (the number of arguments it takes).

So, the following code works and is compatible with CPython:

    def f(a, b, *, c):
        pass

    print(len(inspect.signature(f).parameters))

That should print 3.

Signed-off-by: Damien George <damien@micropython.org>
2025-10-02 00:07:34 +10:00
Hyx bdc4706cc7 usb-device-hid: Return True after submit_xfer.
This tells the caller that no error has occurred. The child classes can
use this state to do double buffering correctly.

If any fundamental error occurs in submit_xfer, the underlying code will
raise an exception.

Signed-off-by: Hyx <hyx0329@outlook.com>
2025-08-05 21:50:53 +10:00
Hyx ea763cad8d usb-device: Raise RuntimeError when DCD error occurs.
So the behavior matches the comment.

Signed-off-by: Hyx <hyx0329@outlook.com>
2025-08-05 21:50:48 +10:00
Andrew Leech 34c4ee1647 aiorepl: Handle stream shutdown.
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2025-08-01 00:59:51 +10:00
FuNK3Y b95ca2491a aiohttp: Fix partial reads by using readexactly.
Fixes issue #1012.

Signed-off-by: FuNK3Y <fun__key@hotmail.com>
2025-08-01 00:27:01 +10:00
Alon Bar-Lev f95568da43 abc: Add ABC base class.
This trivial addition will allow less code differences between standard
Python classes and MicroPython code.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
2025-07-08 07:45:40 +10:00
Andrew Leech 913498ef05 aioble-l2cap: Raise correct error if l2cap disconnects during send.
If BLE disconnects in the middle of a send process, this change makes the
code raise `L2CAPDisconnectedError` rather than `TypeError` due to `_cid`
being `None`.

Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2025-06-24 12:31:37 +10:00
Nick Budak 6e24cffe95 logging: Allow logging.exception helper to handle tracebacks.
Although `Logger.exception` supports passing exception info with
`exc_info`, when you use `logging.exception` keyword arguments are not
forwarded to the root logger, which makes passing `exc_info` raise
`TypeError`.

Signed-off-by: Nick Budak <thatbudakguy@gmail.com>
2025-06-06 11:46:43 +10:00
Nick Budak 15a6233d04 errno: Add ENOTCONN constant.
This is present in core MicroPython so needs to be added here.

Signed-off-by: Nick Budak <thatbudakguy@gmail.com>
2025-06-05 16:59:50 +10:00
Andrew Leech aad2e48098 aiorepl: Use blocking reads for raw REPL and raw paste.
Raw REPL mode is generally used as a command channel where all stdio
traffic is related directly to the raw commands and responses sent.

For this to work in aiorepl we need to ensure background tasks don't sent/
receive anything on stdio else the command channel will be corrupted.

The simplest way to achieve this is to make the raw commands blocking and
atomic rather than asyncio, assuming the user wont leave the device in raw
mode for too long at any one time.

Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2025-06-04 00:39:31 +10:00
Adam Lewis 96bd01ec04 urllib.urequest: Add support for headers to urequest.urlopen.
This is an extension to CPython, similar to the `method` argument.

Signed-off-by: Adam Lewis <dotdashnotdotsoftware@gmail.com>
2025-05-28 11:56:45 +10:00
Daniël van de Giessen 567540d4e0 tools/verifygitlog.py: Sync with changes from the main repo.
This includes the following commits:

- Allow long co-author and sign-off names.
- Disallow a leading slash in commit subject line.
- Apply stricter rules on git subject line.
- Show invalid commit subjects in quotes.

Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2025-05-22 10:00:37 +10:00
Daniël van de Giessen 54d5f7cee2
utop: Print IDF heap details.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2025-05-15 17:38:39 +02:00
Daniël van de Giessen 08e09afbe3
utop: Print MicroPython memory info.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2025-05-15 17:38:38 +02:00
Daniël van de Giessen 0d60de65b7
utop: Add initial implementation for ESP32.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2025-05-15 17:38:37 +02:00
Angus Gratton 68e0dfce0a all: Apply Ruff 0.11.6 reformatting changes.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-04-24 16:54:10 +10:00
Angus Gratton d887a021e8 top: Bump the Ruff version to 0.11.6.
With small code fixes to match.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-04-24 16:53:59 +10:00
Angus Gratton f8c8875e25 lora: Fix SNR value in SX126x received packets.
Wasn't being treated as a signed value.

Fixes issue #999.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-04-24 16:20:47 +10:00
Damien George 5b496e944e inspect: Implement iscoroutinefunction and iscoroutine.
Signed-off-by: Damien George <damien@micropython.org>
2025-04-14 10:26:38 +10:00
Damien George 2665047fa7 inspect: Add basic unit tests.
Signed-off-by: Damien George <damien@micropython.org>
2025-04-14 10:26:38 +10:00
Damien George 48bf3a74a8 inspect: Fix isgenerator logic.
Also optimise both `isgenerator()` and `isgeneratorfunction()` so they use
the same lambda, and don't have to create it each time they are called.

Fixes issue #997.

Signed-off-by: Damien George <damien@micropython.org>
2025-04-14 10:26:38 +10:00
Matthias Urlichs 9307e21dfb usb-device-cdc: Optimise writing small data so it doesn't require alloc.
Only allocate a memoryview when the (first) write was partial.

Signed-off-by: Matthias Urlichs <matthias@urlichs.de>
2025-04-13 13:27:47 +10:00
jomas 05a56c3cad aiohttp: Allow headers to be passed to a WebSocketClient.
This commit will make it possible to add headers to a Websocket.

Among other things, this allows making a connection to online MQTT brokers
over websocket, using the header entry "Sec-WebSocket-Protocol":"mqtt" in
the handshake of the upgrade protocol.

Signed-off-by: Damien George <damien@micropython.org>
2025-04-13 00:20:58 +10:00
FuNK3Y 86df723301 aiohttp: Fix header case sensitivity.
According to RFC https://datatracker.ietf.org/doc/html/rfc7230#section-3.2
header names are case-insensitive.

This commit makes sure that the module behaves consistently regardless of
the casing of "Content-type" and "Content-Length" (other headers are not
considered by the module).

Without this fix, the client seems to wait for the connection termination
(~10 seconds) prior to returning any content if the casing of
"Content-Length" is different.

Signed-off-by: FuNK3Y <fun__key@hotmail.com>
2025-04-12 10:51:31 +10:00
黃昕暐 43ad7c58fd requests: Use the host in the redirect url, not the one in headers.
The host in headers extracted from the original url may not be the same as
the host in the redirect url.  Poping out the host in headers force the
code to use the host in the redirect url, otherwise the redirect may fail
due to inconsistence of hosts in the original url and the redirect url.

Signed-off-by: 黃昕暐 <meebox@gmail.com>
2025-04-12 10:47:56 +10:00
Bas van Doren 42caaf14de unix-ffi/machine: Use libc if librt is not present.
Newer implementations of libc integrate the functions from librt, for
example glibc since 2.17 and uClibc-ng.  So if the librt.so cannot be
loaded, it can be assumed that libc contains the expected functions.

Signed-off-by: Bas van Doren <basvdoren@gmail.com>
2025-04-10 22:53:46 +10:00
Dominik Heidler d1a74360a2 unix-ffi/json: Accept both str and bytes as arg for json.loads().
Same as micropython's internal json lib does.

Fixes #985.

Signed-off-by: Dominik Heidler <dheidler@suse.de>
2025-04-10 22:46:28 +10:00
Leonard Techel f72f3f1a39 lora-sx126x: Fix invert_iq_rx / invert_iq_tx behaviour.
This commit fixes a typo and changes a tuple that needs to be mutable to a
list (because other parts of the code change elements of this list).

Signed-off-by: Damien George <damien@micropython.org>
2025-04-10 22:39:40 +10:00
Damien George 221a877f8a nrf24l10: Bump minor version.
Due to the previous three commits.

Signed-off-by: Damien George <damien@micropython.org>
2025-04-10 22:33:53 +10:00
marcsello c7103bb464 nrf24l01: Optimize status reading.
The value of the STATUS register is always transmitted by the chip when
reading any command.  So a R_REGISTER command and the turnaround time can
be spared by issuing a NOP command instead.

This implementation suggested by the datasheet.

This operation is compatible with both nRF24L01 and nRF24L01+.

Signed-off-by: Marcell Pünkösd <punkosdmarcell@rocketmail.com>
2025-04-10 22:31:47 +10:00
marcsello bd1ab77324 nrf24l01: Properly handle timeout.
The timeout condition was not handled before.  Upon timeout, this caused
the chip to stay active until another send command changed it's state.

Sometimes when it was unable to transmit the data, it got stuck in the tx
fifo causing it to fill up over time, which set the TX_FULL flag in the
STATUS register.

Since there was no exceptions raised, the user code could not differentiate
a successful send or a timeout condition.

Signed-off-by: Marcell Pünkösd <punkosdmarcell@rocketmail.com>
2025-04-10 22:29:46 +10:00
marcsello 3e859d2118 nrf24l01: Increase startup delay.
According to the datasheet of the NRF240L1 chip, 150 μs startup time is
only acceptable when the chip is clocked externally.  Most modules use a
crystal, which require 1.5 ms to settle.  It should be okay to wait more in
both cases, for a reliable startup.

Signed-off-by: Marcell Pünkösd <punkosdmarcell@rocketmail.com>
2025-04-10 22:25:40 +10:00
Damien George 98d0a2b69a umqtt.simple: Restore legacy ssl/ssl_params arguments.
Commit 35d41dbb0e changed the API for using
SSL with umqtt, but only did a minor version increase.  This broke various
uses of this library, eg
https://github.com/aws-samples/aws-iot-core-getting-started-micropython

Reinstate the original API for specifying an SSL connection.  This library
now supports the following:
- default, ssl=None or ssl=False: no SSL
- ssl=True and optional ssl_params specified: use ssl.wrap_socket
- ssl=<SSLContext instance>: use provided SSL context to wrap socket

Signed-off-by: Damien George <damien@micropython.org>
2025-04-10 21:10:01 +10:00
Damien George 96e17b65d1 mip: Make mip.install() skip /rom*/lib directories.
If a ROMFS is mounted then "/rom/lib" is usually in `sys.path` before the
writable filesystem's "lib" entry.  The ROMFS directory cannot be installed
to, so skip it if found.

Signed-off-by: Damien George <damien@micropython.org>
2025-03-11 16:27:09 +11:00
Damien George 7337e0802a github/workflows: Update actions/upload-artifact to v4.
Because v3 is now deprecated.

Signed-off-by: Damien George <damien@micropython.org>
2025-02-24 14:28:14 +11:00