Porównaj commity

...

739 Commity

Autor SHA1 Wiadomość Data
Damien George 50ed36fbeb pyusb: Add MicroPython implementation of PyUSB library.
Signed-off-by: Damien George <damien@micropython.org>
2024-05-27 14:02:54 +10:00
Damien George 2c30a4e91b aioble/multitests: Use multitest.output_metric for perf results.
The perf multitests now "pass" when run.

Signed-off-by: Damien George <damien@micropython.org>
2024-05-25 20:51:51 +10:00
Damien George 1e792c39d3 aioble/multitests: Adjust expected output for write capture test.
Testing shows that the first two writes always go through and the rest are
dropped, so update the .exp file to match that.

Signed-off-by: Damien George <damien@micropython.org>
2024-05-25 20:51:51 +10:00
Damien George 63736c182a aioble/multitests: Add test for advertising and scanning services.
This tests both encoding and decoding multiple 16-bit and 32-bit services
within the one advertising field.

Signed-off-by: Damien George <damien@micropython.org>
2024-05-25 20:51:51 +10:00
Damien George 46e243c592 aioble/central.py: Fix ScanResult.services when decoding UUIDs.
Fixes are needed to support the cases of:
- There may be more than one UUID per advertising field.
- The UUID advertising field may be empty (no UUIDs).
- Constructing 32-bit `bluetooth.UUID()` entities, which must be done by
  passing in a 4-byte bytes object, not an integer.

Signed-off-by: Damien George <damien@micropython.org>
2024-05-25 18:27:37 +10:00
Trent Piepho e5389eb26a aioble/peripheral.py: Place multiple UUIDs in single advertisement LTV.
When multiple UUIDs of the same size are advertised, they should all be
listed in a single LTV.  Supplement to the Bluetooth Core Specification,
Part A, §1.1.1:  "A packet or data block shall not contain more than one
instance for each Service UUID data size."

When aioble construct the advertisement data, it is creating a new data
block for each UUID that contains only that single UUID.  Rather than,
e.g., a single 16-bit UUID block with a list of multiple UUIDs.

Not only is this against the specification, it wastes two bytes of limited
advertisement space per UUID beyond the first for the repeated data block
length and type fields.

Fix this by grouping each UUID size together.

Signed-off-by: Trent Piepho <tpiepho@gmail.com>
2024-05-24 21:42:33 +10:00
Rob Knegjens db7f9a18d4 aioble/device.py: Make default timeout None for disconnected() method.
The value for the `timeout_ms` optional argument to
`DeviceConnection.disconnected()` async method is changed from 60000 to
None.  This way users awaiting a device disconnection using `await
connection.disconnected()` won't be surprised by a 1 minute timeout.
2024-05-24 19:13:42 +10:00
Andrew Leech e7f605df33 aioble/device.py: Always create connection._event.
If the client disconnects immediately after connection, the irq can be run
before the initial connect handler has finished.
2024-05-24 19:03:49 +10:00
Rob Knegjens f0b683218e aioble/examples/temp_client.py: Check connection before reading temp.
Only read from the temp characteristic if the connection is still active.
Improves the example by avoiding a TypeError exception if/when the sensor
disconnects.
2024-05-24 18:48:10 +10:00
Brian Pugh da46c4b9f7 pathlib: Add __rtruediv__ magic method to pathlib.Path.
MicroPython now supports this behaviour of __rtruediv__.
2024-05-24 18:32:25 +10:00
Stephen More d4362d5cc3 aioble/examples/temp_sensor.py: Wait forever for client to disconnect.
This sets the disconnected timeout to None, so that the peripheral waits
forever for the client to disconnect.  Previously the peripheral would
abort the connection after 60 seconds (because that's the default timeout).

Signed-off-by: Stephen More <stephen.more@gmail.com>
2024-05-24 18:05:19 +10:00
Stephen More 191494ede7 aioble/examples/temp_sensor.py: Properly notify on update.
This ensures that the peripheral notifies subscribed clients when the
characteristic is written to.

Signed-off-by: Stephen More <stephen.more@gmail.com>
2024-05-24 18:03:41 +10:00
AuroraTea 2b0d7610ce aiohttp: Fix type of header's Sec-WebSocket-Key.
The function `binascii.b2a_base64()` returns a `bytes`, but here needs a
string.  Otherwise, the value of `Sec-WebSocket-Key` in the headers will be
`b'<BASE64-ENCODED_RANDOM_VALUE>'`.

Signed-off-by: AuroraTea <1352685369@qq.com>
2024-05-24 17:26:22 +10:00
Angus Gratton 00fc3fd37b all: Enable ruff E401 and E402 import lints.
Mostly small cleanups to put each top-level import on its own line.  But
explicitly disable the lint for examples/tests which insert the current
directory into the path before importing.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-05-17 17:06:33 +10:00
Angus Gratton 992eecfed4 all: Enable Ruff lint F541 'f-string without any placeholders'.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-05-15 18:11:46 +10:00
Angus Gratton 6c6fab1db1 all: Enable ruff F841 'Local variable is assigned to but never used'.
Most of these look like they were used for print debugging and then kept in
when the print statements were removed or commented.

Some look like missing or incomplete functionality, these have been marked
with comments where possible.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-05-15 18:05:21 +10:00
Jon Foster cb281a4177 ntptime: Fix Year 2036 bug.
Fix NTP client - it would report the wrong time after 7 Feb 2036.

Signed-off-by: Jon Foster <jon@jon-foster.co.uk>
2024-05-15 15:36:02 +10:00
Matt Trentini a2e4efa09a collections: Remove micropython-lib Python implementation of deque.
It's no longer necessary since the built-in C version of this type now
implements all the functionality here.

Signed-off-by: Matt Trentini <matt.trentini@gmail.com>
2024-05-15 14:12:14 +10:00
Damien George 7206da4645 mip: Bump minor version.
The previous commit added a new feature (ability to install from GitLab).

Signed-off-by: Damien George <damien@micropython.org>
2024-05-15 13:53:01 +10:00
Olivier Lenoir 57cbc34840 mip: Add support to mip install from GitLab.
Modify _rewrite_url() to allow mip install from `gitlab:` repository.

Signed-off-by: Olivier Lenoir <olivier.len02@gmail.com>
2024-05-15 13:43:06 +10:00
Angus Gratton 583bc0da70 usb: Add USB device support packages.
These packages build on top of machine.USBDevice() to provide high level
and flexible support for implementing USB devices in Python code.

Additional credits, as per included copyright notices:

- CDC support based on initial implementation by @hoihu with fixes by
  @linted.

- MIDI support based on initial implementation by @paulhamsh.

- HID keypad example based on work by @turmoni.

- Everyone who tested and provided feedback on early versions of these
  packages.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-04-30 15:57:50 +10:00
Damien George 45ead11f96 ssl: Use "from tls import *" to be compatible with axtls.
axtls doesn't define all the CERT_xxx constants, nor the MBEDTLS_VERSION
constant.

This change means that `tls.SSLContext` is imported into the module, but
that's subsequently overridden by the class definition in this module.

Signed-off-by: Damien George <damien@micropython.org>
2024-03-28 17:44:37 +11:00
iabdalkader 661efa48f0 senml: Use the updated cbor2 API.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-03-19 17:29:22 +11:00
iabdalkader 8ee876dcd6 cbor2: Deprecate decoder and encoder modules.
Deprecate decoder and encoder modules to maintain compatibility with the
CPython cbor2 module.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-03-19 17:28:35 +11:00
Jim Mussared 5c7e3fc0bc json: Move to unix-ffi.
It requires the unix pcre-based re module.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2024-03-19 17:23:07 +11:00
Damien George 23df50d0ea unix-ffi: Remove "unix_ffi" argument from require().
And describe how to use `add_library()` instead.

Signed-off-by: Damien George <damien@micropython.org>
2024-03-17 13:22:36 +11:00
Damien George ffb07dbce5 gzip: Fix recursion error in open() function.
And give the `mode` parameter a default, matching CPython.

Signed-off-by: Damien George <damien@micropython.org>
2024-02-29 14:54:24 +11:00
Angus Gratton 224246531e lora-sx126x: Clean up some struct formatting.
Changes are cosmetic - and maybe very minor code size - but not functional.
_reg_read() was calling struct.packinto() with an incorrect number of
arguments but it seems like MicroPython didn't mind, as result is correct
for both versions.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-02-20 16:58:38 +11:00
Angus Gratton 35bb7952ba lora-sx126x: Fix syncword setting.
Fixes issue #796.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-02-20 16:58:08 +11:00
Angus Gratton 546284817a lora-sx127x: Implement missing syncword support.
This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-02-20 16:58:06 +11:00
Angus Gratton ad6ab5a78c lora-sync: Fix race with fast or failed send().
If send completes before the first call to poll_send(), the driver could
get stuck in _sync_wait(). This had much less impact before rp2 port went
tickless, as _sync_wait(will_irq=True) calls machine.idle() which may not
wake very frequently on a tickless port.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-02-20 16:57:50 +11:00
Angus Gratton b712103519 lora-sx126x: Fix invalid default configuration after reset.
According to the docs, only freq_khz was needed for working output.
However:

- Without output_power setting, no output from SX1262 antenna (theory:
  output routed to the SX1261 antenna).

- SF,BW,etc. settings were different from the SX127x power on defaults, so
  modems with an identical configuration were unable to communicate.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-02-20 16:44:57 +11:00
Angus Gratton 4cc67065dd tools/ci.sh: Add unix-ffi library when testing unix-ffi subdirectory.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-02-19 23:21:04 +11:00
ubi de feo 8058b2935b tarfile-write: Fix permissions when adding to archive.
Signed-off-by: ubi de feo <me@ubidefeo.com>
2024-02-09 10:43:05 +11:00
Carlosgg 56f514f569 aiohttp: Fix binary data treatment.
- Fix binary data `Content-type` header and data `Content-Length`
  calculation.

- Fix query length when data is included.

- Fix `json` and `text` methods of `ClientResponse` to read
  `Content-Length` size

Signed-off-by: Carlos Gil <carlosgilglez@gmail.com>
2024-02-08 19:02:26 +11:00
Adam Knowles ddb1a27957 hmac: Fix passing in a string for digestmod argument.
The built-in `hashlib` module does not have a `.new` method (although the
Python version in this repository does).
2024-02-07 12:45:03 +11:00
Felix Dörre 35d41dbb0e ssl: Restructure micropython SSL interface to a new tls module.
MicroPython now supplies SSL/TLS functionality in a new built-in `tls`
module.  The `ssl` module is now implemented purely in Python, in this
repository.  Other libraries are updated to work with this scheme.

Signed-off-by: Felix Dörre <felix@dogcraft.de>
2024-02-07 12:12:13 +11:00
Felix Dörre 803452a1ac umqtt.simple: Simplify check for user being unused.
There don't seem to be any MQTT implementations that expect an empty
username (instead of the field missing), so the check for unused `user` can
be simplified.

Signed-off-by: Felix Dörre <felix@dogcraft.de>
2024-02-07 12:12:09 +11:00
Carlosgg 7cdf708815 aiohttp: Add new aiohttp package.
Implement `aiohttp` with `ClientSession`, websockets and `SSLContext`
support.

Only client is implemented and API is mostly compatible with CPython
`aiohttp`.

Signed-off-by: Carlos Gil <carlosgilglez@gmail.com>
2023-12-20 16:26:04 +11:00
Bhavesh Kakwani 57ce3ba95c aioble: Fix advertising variable name to use us not ms. 2023-12-20 15:22:21 +11:00
Mark Blakeney 9ceda53180 uaiohttpclient: Update example client code.
Signed-off-by: Mark Blakeney <mark.blakeney@bullet-systems.net>
2023-12-20 14:56:09 +11:00
Mark Blakeney 05efdd03a7 uaiohttpclient: Update "yield from" to "await".
Signed-off-by: Mark Blakeney <mark.blakeney@bullet-systems.net>
2023-12-20 14:56:04 +11:00
Mark Blakeney 9d09cdd4af uaiohttpclient: Make flake8 inspired improvements.
Signed-off-by: Mark Blakeney <mark.blakeney@bullet-systems.net>
2023-12-20 14:56:00 +11:00
Mark Blakeney 149226d3f7 uaiohttpclient: Fix hard coded port 80.
Signed-off-by: Mark Blakeney <mark.blakeney@bullet-systems.net>
2023-12-20 14:55:51 +11:00
scivision ae8ea8d113 os-path: Implement os.path.isfile().
Signed-off-by: Michael Hirsch <michael@scivision.dev>
2023-12-20 14:46:57 +11:00
Andrew Leech f672baa92b aiorepl: Add support for raw mode (ctrl-a).
Provides support for mpremote features like cp and mount.

Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2023-12-20 12:35:40 +11:00
Andrew Leech 10c9281dad aiorepl: Add cursor left/right support.
Allows modifying current line, adding/deleting characters in the middle
etc.  Includes home/end keys to move to start/end of current line.

Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2023-12-20 12:33:43 +11:00
Andrew Leech d41851ca72 aiorepl: Add support for paste mode (ctrl-e).
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2023-12-20 12:33:19 +11:00
Andrew Leech e051a120bc aiorepl: Update import of asyncio.
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2023-12-20 12:33:16 +11:00
Yu Ting 41aa257a31 base64: Implement custom maketrans and translate methods.
Re-implemented bytes.maketrans() and bytes.translate() as there are no such
functions in MicroPython.
2023-12-20 12:26:13 +11:00
Matt Trentini 340243e205 time: Add README to explain the purpose of the time extension library.
Signed-off-by: Matt Trentini <matt.trentini@gmail.com>
2023-12-20 12:05:35 +11:00
Jim Mussared 83f3991f41 lcd160cr: Remove support for options in manifest.
This is the last remaining use of the "options" feature. Nothing in the
main repo which `require()`'s this package sets it.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-12-20 12:01:22 +11:00
Jim Mussared cee0945f1c all: Replace "black" with "ruff format".
- Add config for [tool.ruff.format] to pyproject.toml.
- Update pre-commit to run both ruff and ruff-format.
- Update a small number of files that change with ruff's rules.
- Update CI.
- Simplify codeformat.py just forward directly to "ruff format"

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-12-20 11:56:24 +11:00
Jim Mussared ad0a2590cc tools/verifygitlog.py: Add git commit message checking.
This adds verifygitlog.py from the main repo, adds it to GitHub workflows,
and also pre-commit.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-12-20 11:46:40 +11:00
Christian Marangi d8e163bb5f unix-ffi/re: Convert to PCRE2.
PCRE is marked as EOL and won't receive any new security update.

Convert the re module to PCRE2 API to enforce security.  Additional
dependency is now needed with uctypes due to changes in how PCRE2 return
the match_data in a pointer and require special handling.

The converted module is tested with the test_re.py with no regression.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2023-11-01 10:14:36 +11:00
Jim Mussared 0620d02290 .github/workflows/ruff.yml: Pin to 0.1.0.
The `--format` flag was changed to `--output-format` in the recent update.

Pin to this version to prevent further updates from breaking (e.g. through new rules or other changes).

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-10-26 11:48:26 +11:00
Brian Whitman e025c843b6 requests: Fix detection of iterators in chunked data requests.
Chunked detection does not work as generators never have an `__iter__`
attribute.  They do have `__next__`.

Example that now works with this commit:

    def read_in_chunks(file_object, chunk_size=4096):
        while True:
            data = file_object.read(chunk_size)
            if not data:
                break
            yield data

    file = open(filename, "rb")
    r = requests.post(url, data=read_in_chunks(file))
2023-10-05 10:42:14 +11:00
Jim Mussared 46748d2817 aioble/server.py: Allow BufferedCharacteristic to support all ops.
Previously a BufferedCharacteristic could only be read by the client, where
it should have been writeable. This makes it support all ops (read / write
/ write-with-response, etc).

Adds a test to check the max_len and append functionality of
BufferedCharacteristic.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-10-04 14:47:38 +11:00
Jim Mussared e5ba864470 aioble/server.py: Add data arg for indicate.
In micropython/micropython#11239 we added support for passing data to
gatts_indicate (to make it match gatts_notify).

This adds the same to aioble.

Also update the documentation to mention this (and fix some mistakes and
add a few more examples).

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-10-04 14:37:26 +11:00
Matthias Urlichs 55d1d23d6f __future__: Add "annotations".
MicroPython ignores types anyway.
2023-10-04 12:53:52 +11:00
Damien George e6b89eafa3 all: Remove unnecessary start argument in range.
To satisfy Ruff.

Signed-off-by: Damien George <damien@micropython.org>
2023-09-01 00:17:28 +10:00
Angus Gratton 7fcc728db2 lora/sx126x: Fix busy timeout handling.
- If no reset pin was set, calling standby() in the constructor
  would enable the TCXO (XOSC) before the timeout was correctly set.

- This manifested as a BUSY timeout on the STM32WL5, first time after power
on reset.

- Clean up the general handling of BUSY timeouts, but also add some safety
margin to the base timeout just in case (not an issue, is only a stop-gap
to prevent the modem blocking indefinitely.)

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-26 18:16:37 +10:00
Angus Gratton 0bdecbcba1 lora: Note known issue with STM32WL5 HP antenna.
For unknown reason, power output in this configuration is lower than it
should be (including when compared to the STM32Cube C libraries running on
the same board.

Suspect either the Nucleo board antenna switch or the power amplifier
registers are being set wrong, but the actual root cause remains elusive...

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-26 18:16:25 +10:00
Angus Gratton ed688cf019 lora: Add STM32WL55 subghz LoRa modem class.
Support depends on hardware support in MicroPython.

Also includes some tweaks in the SX126x base class, to deal with slightly
different platform configuration on STM32WL55, longer timeouts, tx_ant
options, etc.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-26 18:16:04 +10:00
Angus Gratton 93bf707d6f lora: Remove the pin parameter from IRQ callback.
It's not necessary to know which pin triggered the IRQ, and it saves some
code size.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-23 11:42:59 +10:00
Damien George dc765ad822 wm8960: Bump patch version.
For changes in 1f3002b537.

Signed-off-by: Damien George <damien@micropython.org>
2023-08-23 11:42:00 +10:00
Damien George 1b557eee5c lsm6dsox: Bump patch version.
For changes in 2d16f210b9.

Signed-off-by: Damien George <damien@micropython.org>
2023-08-23 11:41:22 +10:00
Angus Gratton 5b6fb2bc56 top: Enable Ruff linter to check undefined-name (F821).
Also adds some global ignores for manifest files (which have implicit
imports) and the multitests (which have the same).

Other F821 fixes or accommodations are in the parent commits to this
commit.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-22 22:44:01 +10:00
Angus Gratton b46306cc5a uaiohttpclient: Fix missing name in unreachable example code.
As-written this code is unreachable (return statement two line above),
so this change is really just to make the linter happy.

Found by Ruff checking F821.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-22 22:43:51 +10:00
Angus Gratton 991ac986fd iperf3: Pre-declare some variables set in the loop.
This is a change just to make the linter happy, the code
probably would have run OK without it.

Found by Ruff checking F821.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-22 22:43:46 +10:00
Angus Gratton c6a72c70b9 cbor2: Improve decoder to pass Ruff F821 undefined-name.
These were probably intentional missing names, however raising
NotImplementedError or KeyError is more explicit than trying to call an
unknown function.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-22 22:43:20 +10:00
Angus Gratton 786c0ea895 all: Add missing const imports
Found by Ruff checking F821.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-22 22:43:18 +10:00
Angus Gratton 1f3002b537 wm8960: Add missing self reference for sample table.
Found by Ruff checking F821.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-22 22:43:12 +10:00
Angus Gratton 2d16f210b9 lsm6dsox: Add missing time import.
Driver calls time.sleep_ms() in one place.

Found by Ruff checking F821.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-22 22:43:04 +10:00
Angus Gratton 86050c3d7a bmm150: Remove broken reset function.
Looks like copy-pasta from bmi270 driver.

There is a soft reset capability documented in the BMM150 datasheet, but it
uses different register bits and I don't have a BMM150 at hand to test it.

Found by Ruff checking F821.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-22 22:42:48 +10:00
Angus Gratton 674e734a1c drivers/display/lcd160cr: Use isinstance() for type checking.
Fixes linter warning E721, expanded in Ruff 823 to include
direct comparison against built-in types.
2023-08-09 18:59:03 +10:00
Graeme Winter 01ab7ba6e2 iperf3: Add compatibility for servers pre version 3.2.
Result message from servers pre version 3.2 do not encode start or end
time, so workaround this by using the t3, t0 timestamps used elsewhere for
sending.

Fixes issue #665.
2023-07-27 16:01:30 +10:00
Jim Mussared ce3f282967 github/workflows: Split ruff into its own action.
This matches the main repo, and conceputually ruff is not strictly doing
"code formatting".

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-27 12:28:29 +10:00
Jim Mussared efa0402846 tools/codeformat.py: Fix ruff warnings.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-27 12:28:29 +10:00
Jim Mussared 5cdfe71536 top: Add pre-commit config.
This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-27 12:28:15 +10:00
Jim Mussared 232859250c tools/codeformat.py: Remove git state detection.
This was added to speed up running codeformat.py when only a small number
of files are changed, but it breaks running the tool on the master branch.
The pre-commit tool handles this correctly, and it's working well in the
main repo, so we can remove the special handling.

This makes codeformat.py behave identically to the main repository, but
without additional code for handling .c/.h files.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-27 12:26:08 +10:00
Jim Mussared 36e74c1b57 zlib: Add zlib module.
This is a replacement for the `zlib` module that used to be built-in and
has been replaced by the MicroPython-specific `deflate` module.

Also updates the `gzip` module in a similar fashion and provide the
`gzip.GzipFile` class and `gzip.open` function.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-25 18:19:51 +10:00
Christian Clauss 4da6e6f1b2 all: Lint Python code with ruff.
Signed-off-by: Christian Clauss <cclauss@me.com>
2023-07-24 07:51:33 +02:00
Damien George 752ce66c24 github/workflows: Build all example .py files as part of CI.
Signed-off-by: Damien George <damien@micropython.org>
2023-07-24 10:28:49 +10:00
Jim Mussared 8fc9edabf3 all: Standardise x.y.z versioning for all packages.
- For packages that were just x.y, update to x.y.0.
- For that were x.y.z-n, update to x.y.(z+1)

From now on we'll apply semver rules:
- MAJOR version when you make incompatible API changes
- MINOR version when you add functionality in a backward compatible manner
- PATCH version when you make backward compatible bug fixes

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-23 11:48:57 +10:00
Jim Mussared ebbb78e8e4 logging: Bump minor version.
For changes in 5329ef5301.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-23 11:48:46 +10:00
Jim Mussared a19d2a3596 copy: Bump patch version.
For changes in 0e68c7d518.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-23 11:48:29 +10:00
Jim Mussared 97b7a30ab9 xmltok: Bump patch version.
For changes in 66924d9fa1.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-23 11:48:25 +10:00
Jim Mussared 87b4cdae2f aiorepl: Bump patch version.
For changes in ff842310de.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-23 11:48:14 +10:00
Jim Mussared 8513bfbe9d requests: Rename urequests to requests.
This module implements a subset of the Python requests module, and so
it should have the same name.

Added a backwards-compatibility wrapper to allow people to continue to use
`import urequests`. This lives in micropython/urequests.

Changed requests to be a package, so that we can implement extension
packages in the future for optional functionality.

Added a basic README.md to both.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-23 11:41:44 +10:00
Jim Mussared 5004436164 tarfile: Rename from utarfile.
This is compatible with the CPython module, so should
be named tarfile.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-23 11:41:44 +10:00
Andrew Leech e45a7f6c18 fnmatch: Fix compatibility with ure -> re.
With the recent MicroPython change to remove the u prefix by default on
builtins (micropython/micropython#11740) the format checker in fnmatch
which was detecting ure no longer works.

This commit updates the module to filter the regex automatically as needed.

Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2023-07-21 17:19:43 +10:00
Jim Mussared 6103823b1b all: Remove __version__ from .py files.
It is inserted automatically during publish/freezing and having them in the
code prevents the automatic process from happening.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-21 17:15:00 +10:00
Jim Mussared ff842310de aiorepl: Replace f-string with str.format.
f-strings aren't enabled on all builds (e.g. low-flash ESP8266).

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-21 17:10:41 +10:00
Andrew Leech 0e68c7d518 copy: Declare dependency on types. 2023-07-21 17:07:06 +10:00
Andrew Leech 5329ef5301 logging: Add full support for logging exception tracebacks.
This commit allows you to pass an exception object in as the exc_info kwarg
(CPython allows this), so logging exceptions can work even if the
MICROPY_PY_SYS_EXC_INFO option is disabled in the firmware.

Separately to that, currently even when sys.exc_info() is enabled, it's
only printing the traceback to _stream = sys.stderr - not to the configured
logging handlers.  This means for instance if you've got a file log
handler it misses out on the tracebacks.  That's also fixed in this commit.

Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2023-07-21 17:01:42 +10:00
Andrew Leech 028a369f90 keyword: Add manifest file. 2023-07-21 16:58:48 +10:00
Andrew Leech b95deb31e5 json: Add manifest file. 2023-07-21 16:58:48 +10:00
Andrew Leech 0f768c9af7 bisect: Add manifest file. 2023-07-21 16:58:48 +10:00
Andrew Leech c2b44ea83b types: Add manifest file. 2023-07-21 16:58:48 +10:00
Jim Mussared c48b17dd17 aiorepl/README.md: More info about globals.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-21 16:06:49 +10:00
ThunderEX 66924d9fa1 xmltok: Change StopIteration to EOFError due to PEP-479.
Due to changes in MicroPython to support PEP-479, StopIteration has been
deprecated for return.  This results in xmltok to raise RuntimeError every
time.  This commit is a simple fix to just change from StopIteration to
EOFError and then return it in the generator.
2023-07-21 15:59:10 +10:00
Jim Mussared fe3e0a2fae cmd: Remove comments about using the string module.
Even though we now have a `string` module, just keep the existing
IDENTCHARS definition.

- If someone doesn't already have string installed (or aren't otherwise
  importing it), this would add an extra dependency and more memory used.

- If they do, then the resulting concatenated string has to be allocated
  separately, so there's no gain from using the string.x components.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-21 15:28:14 +10:00
Damien George 0a5b635594 utarfile: Fix read/write handling of nulls in tar header.
For reading, the size is always terminated by a null, so just ignore it by
using 11 for the uctypes entry (this fixes a regression introduced in
7128d423c2).

For writing, the size must always be terminated by a null.

Signed-off-by: Damien George <damien@micropython.org>
2023-07-21 12:58:40 +10:00
Jim Mussared da5ddfc6e2 hashlib: Refactor, split, and optimise.
This splits out each algorithm into its own extension package, so that only
the necessary algorithms can be installed.

This allows for a significant reduction in RAM and flash. i.e. previously
installing hashlib meant that all algorithms were imported.

Additionally ensures that any built-in hash algorithms (from uhashlib) are
still exposed (e.g. `md5`), and retains the existing behavior to use the
built-in preferentially.

Also includes a refactoring of the algorithms to reduce code size and
reduce the number of allocations they do as well as using bytearrays in
place of list-of-int where possible.

Add more comprehensive tests (using unittest).

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-20 23:28:08 +10:00
Angus Gratton 2fba6b8644 lora: Workaround SX1262 bug with GetStatus.
This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-07-20 23:13:03 +10:00
Angus Gratton 1957f24020 lora: Add lora modem drivers for SX127x and SX126x.
Includes:
- component oriented driver, to only install the parts that are needed
- synchronous operation
- async wrapper class for asynchronous operation
- two examples with async & synchronous versions
- documentation

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-07-20 23:07:22 +10:00
Dan Ellis 7128d423c2 utarfile: Support creating/appending tar files.
This adds a utarfile-write extension package that adds the ability to
create and append to tar files.

Work done by Doug Ellis <dpwe@ee.columbia.edu>.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-05-22 15:02:05 +10:00
glenn20 a1b9aa934c aioespnow: Add library providing asyncio support for espnow module.
This module provides asyncio support for the espnow module on ESP32 and
ESP8266 ports.
2023-05-04 14:21:32 +10:00
Jim Mussared c113611765 aioble: Fix descriptor flag handling.
Removes the workaround for micropython/issues/6864.

Sets the default flags for discovered descriptors to be WRITE,
so that d.write() will implicitly set response=True.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-04-12 07:04:12 +10:00
Jim Mussared 01db3da37e senml: Allow publishing to PyPI as micropython-senml.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-04-07 13:28:15 +10:00
Jim Mussared 9b5f4d73b0 tools/makepyproject.py: Add tool to generate PyPI package.
This tool makes a buildable package (including pyproject.toml) from
supported micropython-lib packages, suitable for publishing to PyPI and
using from CPython.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-04-07 13:24:15 +10:00
Jim Mussared afc9d0a541 micropython: Add missing metadata for packages.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-04-07 13:24:15 +10:00
Jim Mussared 386ab99d7f python-ecosys: Add pypi= to metadata.
This is so the package knows the "upstream" name of the corresponding PyPI
package that it's based on.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-04-06 12:06:15 +10:00
Andrew Leech f672353180 unittest-discover: Print results when no tests are found/run.
Prior to this commit, if no tests were found when running unittest discover
then nothing at all was written to stdout, leading one to think it's not
working at all.  CPython unittest does display a "0 tests run" sort of
output in such a case, and this commit ensures this package does the same.
2023-03-27 12:06:04 +11:00
Damien George ea21cb3fdc iperf3: Support devices without os.urandom().
Also add a version to the manifest.

Signed-off-by: Damien George <damien@micropython.org>
2023-03-21 16:04:00 +11:00
iabdalkader c8603192d1 senml: Fix data record encoding to use binascii instead of base64. 2023-03-06 23:12:38 +11:00
iabdalkader 295a9e300a senml: Remove u-module prefix from imports.
Signed-off-by: Damien George <damien@micropython.org>
2023-03-03 12:26:31 +11:00
iabdalkader b9741f6584 cbor2: Remove u-module prefix from imports. 2023-03-03 12:20:28 +11:00
Angus Gratton 40dfc5fbc5 github/workflows: Attach built packages to GitHub workflow artifacts. 2023-03-02 16:45:08 +11:00
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
Oliver Joos 9bc0b15f11 unittest: Make AssertRaisesContext store exception for later retrieval.
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.
2022-10-04 12:28:43 +11:00
Andrew Leech 459e13921a os.path: Remove external / ffi dependencies in os.path.
This work was funded by Planet Innovation.

Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2022-09-30 17:51:06 +10:00
Jim Mussared d0f97fc218 tools/build.py: Make build.py work without f-strings.
Allows running on older CPython versions.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-29 23:51:03 +10:00
Jim Mussared 5e7bac1161 micropython/mip: Add a new `mip` library for on-device installation.
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>
2022-09-29 22:54:32 +10:00
Jim Mussared 58a93f3d7f tools/build.py: Add script for deploying to a static web server.
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>
2022-09-29 22:54:32 +10:00
Jim Mussared 122b68968c uu: Fix dependency on os-path.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-28 00:58:35 +10:00
Andrew Leech eba897420d aioble/server.py: Maintain write order for captured characteristics.
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>
2022-09-27 22:47:30 +10:00
Andrew Leech 0c5880d2e4 aioble/l2cap: Fix psm variable name.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-27 14:28:56 +10:00
Jim Mussared 7602843209 micropython/aiorepl: Initial version of an asyncio REPL.
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>
2022-09-26 16:33:24 +10:00
Jim Mussared ad9309b669 os: Import `path` automatically if available.
This matches CPython behavior:

```
>>> import os
>>> os.path.sep
'/'
```

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-13 14:31:24 +10:00
Jim Mussared f1039fd2f2 collections: Rename collections.* to collections-*.
This is to match the convention for naming "extension" packages.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-13 14:31:24 +10:00
Jim Mussared c262628a41 os: Rename os.path to os-path.
This is to match the convention for naming "extension" packages.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-13 14:31:24 +10:00
Jim Mussared 796a5986cd unittest: Move back to python-stdlib.
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>
2022-09-13 09:57:04 +10:00
Jim Mussared cb88a6a554 argparse: Move back to python-stdlib.
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>
2022-09-13 09:57:04 +10:00
Jim Mussared 8a03f7b91f python-stdlib: Remove pystone (and variants).
We have a more useful version of this in the main repo's performance tests.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-10 01:47:37 +10:00
Jim Mussared d080924d12 aioble/multitests: Add descriptor multitest.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-09 11:26:54 +10:00
Jim Mussared e58b609572 aioble/client.py: Make read/write events work for descriptors.
Descriptors were missing common initialisation for events shared with
characteristics.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-09 11:26:54 +10:00
Jim Mussared 765f14b501 aioble/server.py: Fix registration for descriptors.
This allows a server to register descriptors, which was previously not
fully implemented.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-09 11:26:54 +10:00
Jim Mussared 64e752cce6 aioble/client.py: Use characteristic end handle (when available).
The `bluetooth` module replaced the def_handle field with end_handle
in the characteristic result IRQ. Use this when querying for
descriptors.

In the case where this is not available (older versions of micropython)
continue the existing behavior of searching just past the value handle,
although decrease this to +2 to avoid finding other characteristic's
descriptors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-09 11:26:54 +10:00
Jim Mussared 58f8bec54d micropython/net: Add "ntptime" client from main repo.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-06 13:26:12 +10:00
Jim Mussared cc2cdeb94b micropython/net: Add "webrepl" server from main repo.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-06 13:25:21 +10:00
Jim Mussared cf5ed97b4d micropython/drivers: Move "sdcard" driver from main repo.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-06 13:21:57 +10:00
Jim Mussared 33b5132312 micropython/drivers: Move "lps22h" sensor driver from main repo.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-06 13:21:56 +10:00
Jim Mussared b3e443ca8e micropython/drivers: Move "hts221" sensor driver from main repo.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-06 13:21:55 +10:00
Jim Mussared a336c29cc5 micropython/drivers: Move "dx18x20" sensor driver from main repo.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-06 13:21:54 +10:00
Jim Mussared 0382c9cffa micropython/drivers: Move "dht" sensor driver from main repo.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-06 13:21:53 +10:00
Jim Mussared c1c0eb0c39 micropython/drivers: Move "nrf24l01" radio driver from main repo.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-06 13:21:52 +10:00
Jim Mussared f46401f849 micropython/drivers: Move "neopixel" led driver from main repo.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-06 13:21:50 +10:00
Jim Mussared 75d129b96f micropython/drivers: Move "lsm6sox" imu driver from main repo.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-06 13:21:48 +10:00
Jim Mussared fd84cd92f3 micropython/drivers: Move "lsm9ds1" imu driver from main repo.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-06 13:21:44 +10:00
Jim Mussared a5e2f3239c micropython/drivers: Move "ssd1306" display driver from main repo.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-06 13:21:40 +10:00
Jim Mussared d88505680f micropython/drivers: Move "lcd160cr" display driver from main repo.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-06 13:21:35 +10:00
Jim Mussared 2a849f5ec0 micropython/drivers: Move "wm8960" codec driver from main repo.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-06 13:21:30 +10:00
Jim Mussared 34c9faefd1 micropython/drivers: Move "onewire" bus driver from main repo.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-06 13:21:26 +10:00
Jim Mussared f3cfc52ab0 unix-ffi: Move more unix-only packages to unix-ffi.
With the dependencies captured in manifest.py, several packages in
python-stdlib were still unix-only due to direct or transitive dependencies
on unix-only or ffi modules.  Or they just make no sense to run on
microcontroller targets.

In a few cases (e.g. base64) where possible, the unix dependency could be
removed.

Updates manifest.py to use the `unix_ffi=True` arg to `require()` for these
libraries.

Rename re-pcre to re now that unix-ffi is effectively its own namespace.

Update unix-ffi/README.md, and strengthen the wording that the unix
libraries are unmaintained.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-05 17:50:42 +10:00
Jim Mussared ce66e701a5 all: Replace metadata.txt with manifest.py.
Uses the new require()/package()/module() functions from manifestfile.py.

Add manifest.py for iperf3 and pyjwt.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-05 17:50:28 +10:00
Jim Mussared 8d7753d7d4 micropython/upip: Remove upip library.
This is unmaintained and not the one installed by default on boards
(see github.com/micropython/micropython/blob/master/tools/upip.py).

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-05 17:50:16 +10:00
Jim Mussared ecef7a506c all: Remove all setup.py files.
These are unused and will be replaced with manifest.py.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-05 17:50:11 +10:00
Philip Peitsch a18d49cda7 aioble: Make l2cap chunk size configurable to allow optimization by app. 2022-09-05 15:14:13 +10:00
Philip Peitsch c4fada7f6f aioble: Fix missing GattError import in server.py.
2015-01-01 07:45:46.790 INFO Received OLCP_OP_FIRST
2015-01-01 07:45:46.979 ERROR Error in ble_write_listener
Traceback (most recent call last):
  File "aioble/server.py", line 223, in indicate
NameError: name 'GattError' isn't defined
2022-09-05 15:12:48 +10:00
Andrew Leech 09f0e47386 aioble: Add timeout to device.exchange_mtu.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-01 22:30:43 +10:00
Jim Mussared c3f4779002 python-ecosys/pyjwt/jwt.py: Fix missing whitespace.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-09 17:06:49 +10:00
Jim Mussared f95260d7e3 python-stdlib/hmac: Update to work with built-in hash functions.
This library was non-functional unless used with the micropython-lib
pure-Python implementation of hashlib, even if the device provides
sha1 and sha256.

This updates hmac to be significantly more RAM efficient (removes the
512-byte table), and functional with the built-in hash functions.

The only unsupported function is "copy", but this is non-critical, and now
fails with a NotSupportedError.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-09 00:19:31 +10:00
Miguel Grinberg 9fdf046e27 python-ecosys/pyjwt: Add pyjwt-compatible module. 2022-08-08 22:13:08 +10:00
Andrew Leech 70e422dc2e urequests: Release 0.7.0. 2022-06-29 13:02:46 +10:00
Bogdan a3d6d29b1b urequests: Add timeout, passed to underlying socket if supported. 2022-06-29 13:02:31 +10:00
Andrew Leech dbd8fff830 urequests: Raise error when server doesn't respond with valid http. 2022-06-29 13:02:00 +10:00
karfas a725c42049 urequests: Always open sockets in SOCK_STREAM mode.
On the ESP32, socket.getaddrinfo() might return SOCK_DGRAM instead of
SOCK_STREAM, eg with ".local" adresses.  As a HTTP request is always a TCP
stream, we don't need to rely on the values returned by getaddrinfo.
2022-06-29 13:01:34 +10:00
Diefesson de Sousa SIlva b29cffb3e3 urequests: Add support for redirects. 2022-06-29 13:01:24 +10:00
Diefesson de Sousa SIlva b17e9aaf93 urequests: Add support for requests with chunked upload data. 2022-06-29 13:01:01 +10:00
Diefesson de Sousa SIlva be327a7bc7 binascii: Implement newline param in function b2a_base64.
See: https://docs.python.org/3/library/binascii.html#binascii.b2a_base64
2022-06-29 13:00:50 +10:00
Fabian Schmitt e7e8eff86b urequests: Add Basic Authentication support.
Usage matches the shorthand version described in
https://requests.readthedocs.io/en/latest/user/authentication/#basic-authentication
2022-06-29 12:59:38 +10:00
Andrew Leech 106c28a4d7 urequests: Fix raising unsupported Transfer-Encoding exception.
Would lead to recursive TypeError because of str + bytes.
2022-06-29 12:59:12 +10:00
Paul Sokolovsky d978e246d5 urequests: Explicitly add "Connection: close" to request headers.
Even though we use HTTP 1.0, where closing connection after sending
response should be the default, some servers ignore this requirement and
keep the connection open.  So, explicitly send corresponding header to get
the expected behavior.
2022-06-29 12:58:47 +10:00
Paul Sokolovsky 5854ae1286 urequests: Add ability to parse response headers.
This is controlled by parse_headers param to request(), which defaults to
True for compatibility with upstream requests. In this case, headers are
available as .headers of Response objects. They are however normal (not
case-insensitive) dict.

If parse_headers=False, old behavior of ignore response headers is used,
which saves memory on the dict.

Finally, parse_headers can be a custom function which can e.g. parse only
subset of headers (again, to save memory).
2022-06-28 16:55:15 +10:00
Andrew Leech db4c739863 unittest: Version 0.9.0 2022-05-06 10:47:37 +10:00
Andrew Leech 959115d3a9 unittest: Add support for specifying custom TestRunner. 2022-05-06 10:47:37 +10:00
Steve Li 2d61dbdb93 unittest: Add setUpClass and tearDownClass handling.
Supports setUp and tearDown functionality at Class level.
2022-05-06 10:47:37 +10:00
Andrew Leech ddeb9a7da2 unittest: Improve failure text consistency with cpython. 2022-05-06 10:47:37 +10:00
Andrew Leech 9b6315a2ba unittest: Add exception capturing for subTest. 2022-05-06 10:47:37 +10:00
Andrew Leech 9f6f211506 unittest: Reset python env between tests. 2022-05-06 10:47:37 +10:00
Andrew Leech cb8d108ac1 unittest: Add test for environment isolation. 2022-05-06 10:47:37 +10:00
Andrew Leech a7b2f63117 unittest: Add discover function. 2022-05-06 10:47:37 +10:00
Andrew Leech 9d9ca3d59b unittest: Run test_* functions as well as TestCase classes. 2022-05-06 10:47:37 +10:00
Andrew Leech c7eb3de858 unittest: Print module name on result lines.
Matches cpython format.
2022-05-06 10:47:37 +10:00
Paul Sokolovsky f92833b015 unittest: Support TestCase subclasses with own runTest() method.
E.g. for doctest.

Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
2022-05-06 10:47:37 +10:00
Paul Sokolovsky ac282d861e unittest: Add TextTestRunner as alias for TestRunner.
For CPython compatibility.

Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
2022-05-06 10:47:37 +10:00
Paul Sokolovsky 5a53a75ec1 unittest: Print no. of skipped tests in a way compatible with CPython.
Perhaps, modern CPython (3.8).

Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
2022-05-06 10:47:37 +10:00
Paul Sokolovsky 01fcd42042 unittest: test_unittest: Add tests for expectedFailure decorator.
Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
2022-05-06 10:47:37 +10:00
Paul Sokolovsky 377ebbfe56 unittest: Add expectedFailure decorator.
Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
2022-05-06 10:47:37 +10:00
Paul Sokolovsky 8e82f3d80b unittest: Support recursive TestSuite's.
Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
2022-05-06 10:47:37 +10:00
Paul Sokolovsky e582666f5d unittest: Properly handle failures vs errors.
Also, rework result printing to be more compatible with CPython.

Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
2022-05-06 10:47:37 +10:00
Paul Sokolovsky 1b46612f94 unittest: Implement basic addCleanup()/doCleanup().
Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
2022-05-06 10:47:37 +10:00
Paul Sokolovsky 2c0b508e4d unittest: TestSuite: Add run() method.
For CPython compatibility.

Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
2022-05-06 10:47:37 +10:00
Paul Sokolovsky 04dce89790 unittest: Add dummy TestCase.assertWarns() context manager.
Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
2022-05-06 10:47:37 +10:00
Paul Sokolovsky 555f28ce6d unittest: Add dummy TestCase.subTest() context manager.
Just runs "subtests" in the scope of the main TestCase.

Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
2022-05-06 10:47:37 +10:00
Paul Sokolovsky 7d77774027 unittest: Add TestCase.skipTest() method.
Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
2022-05-06 10:47:37 +10:00
Paul Sokolovsky 5d3a44cb1c unittest: TestCase: Add (dummy) __init__.
Mostly to workaround inherited MicroPython's issues with inheritance.

Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
2022-05-06 10:47:37 +10:00
Paul Sokolovsky f09d2ec608 unittest: Support both test classes and class instances.
And for clarity, rename runner function run_class() -> run_suite().

Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
2022-05-06 10:47:37 +10:00
Paul Sokolovsky d747b21fc6 unittest: Only treat callable fields as test methods.
Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
2022-05-06 10:47:37 +10:00
Paul Sokolovsky c72ec5c029 unittest: TestSuite: Add undescore to internal field, self._tests.
To avoid possible name clashes.

Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
2022-05-06 10:47:37 +10:00
Paul Sokolovsky dc788f4e50 unittest: Reinstate useful debugger helper.
Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
2022-05-06 10:47:37 +10:00
Paul Sokolovsky dedfe2dcd4 unittest: Add assertLessEqual, assertGreaterEqual methods.
As used by CPython testsuite.
2022-05-06 10:47:37 +10:00
Paul Sokolovsky a57b575020 unittest: AssertRaisesContext: Store exception value as self.exception.
For tests to check. This feature is used by CPython stdlib tests.
2022-05-06 10:47:37 +10:00
Paul Sokolovsky 965e25ce89 unittest: test_unittest: Typo fix. 2022-05-06 10:47:37 +10:00
Paul Sokolovsky fca89f65c7 unittest: test_unittest: Add test for .assertRaises(AssertionError).
Make sure that not raising AssertionError from tested function is properly
caught.
2022-05-06 10:47:37 +10:00
sss 669d343feb unittest: Allow to catch AssertionError with assertRaises().
Without this change, current implementaiton produces a false positive
result for AssertionError type.

Example of falsely passing test code:

def test(a, b):
    assert a > 10
    assert b > 10

self.assertRaises(AssertionError, test, 20, 20)
2022-05-06 10:47:37 +10:00
Paul Sokolovsky 663a3d6c54 unittest: test_unittest.py: Fix typo in method name. 2022-05-06 10:47:37 +10:00
Andrew Leech 7d4d02edfc unittest: Log failure tracebacks at test end.
Store traceback details for each test failure and log to console at the
end of the test, like CPython version of the module does.
2022-05-06 10:47:37 +10:00
Andrew Leech a9cd99ce2d unittest: Allow passing module name or instance into unittest.main() 2022-05-06 10:47:37 +10:00
Andrew Leech d64557a211 fnmatch: Release 0.6.0. 2022-05-06 10:47:37 +10:00
Andrew Leech 7259f0fd6f fnmatch: Remove dependency on os.path. 2022-05-06 10:47:37 +10:00
Andrew Leech dcdac1f552 fnmatch: Add ure compatibility.
Removes dependency on re-pcre which is only available on unix port.
2022-04-08 16:16:56 +10:00
Matt Trentini 0c31e0b3d7 micropython/aioble: Prioritise services in advertisement payload.
A number of fields (services, appearance, manufacturer, name) can appear
when a scan is requested.  However there is only so much space in the
header so, if a user has configured multiple fields, some may be 'pushed'
into the active scan response which requires additional communication.

When iOS scans for BLE devices it can filter by services, and so services
must be in the advertising (as opposed to scan response) payload.
2022-03-24 11:25:31 +11:00
robert-hh 760bfefd9d micropython/upysh: Add the cp() function and improve ls and rm.
- cp() copies a file. If the target is a directory, the file is copied
  into that directory.  It uses a small buffer, so it's not fast.
- ls uses ilistdir and creates a sorted output with directories listed as
  the first group.
- rm optionally deletes recursive, if the target is a directory.
2022-03-24 10:37:48 +11:00
Andrew Leech 22cd7fdd64 tools/codeformat: Fix compatibility running from subfolder in repo. 2022-03-23 12:16:24 +11:00
Andrew Leech ab1e6231dc tools/codeformat: By default only check/update on current git branch.
It can be difficult using the codeformat.py tool when there are other files
in the repository not currently matching the standard.

For developers, running over the entire repo can throw up a large list of
changes in a local git which can lead to inclusion of unrelated changes in
commits if they're added accidentally.  If the files arg is used to trim
down the list of files scanned, it runs a risk of missing some files
they've modified.  In CI, it means that PR's can fail on codeformat for
issues that aren't related to that PR.

This change adds a git query in the codeformat tool by default to only work
on the list of files that have been modified in the current branch.  This
can still be overridden by the files arg to run over all files still, eg.
python3 tools/codeformat.py -v '**'.
2022-03-22 16:46:48 +11:00
Lorenzo Cappelletti fc86070ffb python-stdlib/datetime: Add new implementation of datetime module.
This new module is a port of Python datetime providing classes for
manipulating dates, times, and deltas.  It completely replaces the existing
unix-ffi version.

Signed-off-by: Lorenzo Cappelletti <lorenzo.cappelletti@gmail.com>
2022-03-22 14:02:01 +11:00
Damien George 64b8817c0d all: Update formatting for new Black version 22.1.0.
Signed-off-by: Damien George <damien@micropython.org>
2022-03-22 13:30:34 +11:00
Jim Mussared cdd260f079 aioble/multitests: Add multitest for shutdown handlers.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-11-12 13:36:18 +11:00
Jim Mussared 10ec742baa aioble: Add a shutdown handler for cleanup.
This allows `aioble.stop()` to reset all internal state.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-11-12 13:35:52 +11:00
Jim Mussared a61bfc1460 aioble/README.md: Add l2cap example.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-11-12 13:35:50 +11:00
Jim Mussared 3ea74867f3 aioble: Add l2cap channel disconnected().
Allows `await channel.disconnected()`.

This also fixes a bug where connection._l2cap_channel wasn't being set to
None on disconnect.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-11-12 13:35:45 +11:00
Jim Mussared dd9b783568 aioble/multitests: Add test for subscription and notification.
This replicates the failure described in #453 (which is fixed by #459.

Also adds a test for subscription.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-11-10 17:41:11 +11:00
Jim Mussared 9169ca6543 aioble: Add support for write-with-update.
This allows a server to write a characteristic and automatically
notify/indicate all subscribed clients.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-11-10 13:47:04 +11:00
Jim Mussared dc03b4af4d aioble: Fix notified/indicated event waiting.
After a client does a successful `await char.notified()`, then before the
next call to `notified()` a notification arrives, then they call
`notified()` twice before the _next_ notification, the second call will
return None rather than waiting.

This applies the same fix as in 5a86aa5866
which solved a similar problem for server-side `char.written()`. Using
a deque is slightly overkill here, but it's consistent with the server
side, and also makes it very easy to support having a notification queue
in the future.

Also makes the client characteristic properly flags/properties-aware (i.e.
explicitly fail operations that aren't supported).

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-11-08 17:34:08 +11:00
Jim Mussared 43cad17946 aioble/multitests/ble_write_capture.py: Add multitest for write capture.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-11-05 14:30:40 +11:00
Jim Mussared 23b3c7fe2d aioble/multitests: Fix existing multitests.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-11-05 14:30:31 +11:00
Jim Mussared 5a86aa5866 aioble: Add a write queue for gatt server.
This fixes a bug where an incoming write before `written` is awaited causes
`written` to return None.  It also introduces a mechanism for a server to
"capture" all incoming written values (instead of only having access to the
most recent value).

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-11-05 14:30:08 +11:00
Jim Mussared 3c383f6d28 aioble: Fix docs for subscribe (needs await).
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-07-12 13:38:33 +10:00
Jim Mussared 32684886ee micropython/bluetooth/aioble: subscribe must register the connection.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-07-08 15:15:47 +10:00
Martin Komon 2e91b92413 unix-ffi/datetime: Add tzinfo.__new__ to make the package importable.
Add constructor to tzinfo class so that the package can be imported without
errors.
2021-06-02 00:38:42 +10:00
Damien George a3df207934 python-stdlib/random: Add getrandbits with no limit on number of bits.
Thanks to Macarthur Inbody aka @133794m3r for the implementation.

Signed-off-by: Damien George <damien@micropython.org>
2021-05-30 16:04:17 +10:00
Jim Mussared 8631225b7f micropython/aioble: Add asyncio-based wrapper for ubluetooth.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-05-28 18:26:49 +10:00
Damien George fe975d973a python-ecosys/iperf3: Add iperf3.
Signed-off-by: Damien George <damien@micropython.org>
2021-05-28 12:47:35 +10:00
Damien George f7f38ff2f1 python-stdlib/cgi: Apply Black formatting.
Signed-off-by: Damien George <damien@micropython.org>
2021-05-27 22:42:47 +10:00
Damien George c05ee03d5b workflows: Add initial GitHub workflows support, with code formatting.
Signed-off-by: Damien George <damien@micropython.org>
2021-05-27 22:42:43 +10:00
Damien George d093a684a4 tools: Add code formatting and CI scripts.
Adapted from the micropython repo.

Signed-off-by: Damien George <damien@micropython.org>
2021-05-27 22:42:36 +10:00
Jim Mussared 3a6ab0b46d top: Remove upip-related scripts.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-05-27 16:57:06 +10:00
Jim Mussared 35e3c9e4ff python-ecosys: Move urequests to python-ecosys.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-05-27 16:53:02 +10:00
Jim Mussared bc2b6b0b7f micropython/uasyncio: Remove uasyncio-v2.
Superceded by uasyncio-v3 in the main repo.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-05-27 16:52:16 +10:00
Jim Mussared fa13cbbc8b all: Run black over all code.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-05-27 15:50:04 +10:00
Jim Mussared af3e1aff9e all: Update READMEs. 2021-05-27 15:41:08 +10:00
Jim Mussared 1a28fe84e8 top: Move modules into python-stdlib, unix-ffi, or micropython. 2021-05-27 15:41:08 +10:00
Jim Mussared a1c4b5b564 binascii/hashlib: Set type to stdlib. 2021-05-27 15:41:08 +10:00
Jim Mussared cdcce0384d test: Remove PEP380 test (better handled by core testing). 2021-05-27 15:41:08 +10:00
Jim Mussared caf16675cf cpython-uasyncio: Remove as new-uasyncio is compatible with CPython. 2021-05-27 15:41:08 +10:00
Jim Mussared b4eeaae105 top: Remove unhelpful packages. 2021-05-27 15:41:08 +10:00
Jim Mussared 444b45e431 top: Remove all empty packages. 2021-05-27 15:41:08 +10:00
Damien George eae01bd4e4 logging: Add "levelno" entry to log record object/dict.
Useful for custom handlers to do further level filtering.

Signed-off-by: Damien George <damien@micropython.org>
2020-09-03 11:29:36 +10:00
Damien George 7b1161dd1b logging: Add support for custom handlers.
Any custom handlers will be passed a LogRecord instance which has members
and a dict with "levelname", "message" and "name", to be used for creating
a log message.  The handler list is a global singleton so that sub-logging
objects all use the same set of (root) handlers.

The name of the root handler is also changed from None to "root", to match
CPython.

Signed-off-by: Damien George <damien@micropython.org>
2020-07-08 15:59:01 +10:00
Damien George dedf328503 fnmatch: Remove dependency on posixpath module.
In micropython-lib, os.path.normcase is already a no-op.

Signed-off-by: Damien George <damien@micropython.org>
2020-07-07 19:09:59 +10:00
Damien George 6b985bbc1b copy: Support copy and deepcopy of OrderedDict objects.
Signed-off-by: Damien George <damien@micropython.org>
2020-07-07 10:56:10 +10:00
Damien George b89114c834 Revert "README: Add note that repository is unmaintained."
This reverts commit 1509830fee.
2019-02-26 01:02:14 +11:00
Paul Sokolovsky 1509830fee README: Add note that repository is unmaintained. 2019-02-24 21:09:10 +03:00
Paul Sokolovsky f20d89c6aa logging: Release 0.3. 2018-05-11 14:18:02 +10:00
Paul Sokolovsky a4f2d5665d logging: example_logging: Add testcase for exception(). 2018-05-11 14:18:02 +10:00
Paul Sokolovsky b97fe09ed9 logging: Add exc() and exception() methods.
Non-standard exc() method accepts exception instance to log as a
parameter. exception() just uses sys.exc_info().
2018-05-11 14:18:02 +10:00
Paul Sokolovsky 09c59c4704 logging: Add setLevel() method. 2018-05-11 14:18:02 +10:00
Paul Sokolovsky a93d0ee87b logging: Release 0.2. 2018-05-11 14:18:02 +10:00
Paul Sokolovsky 0feab3397e logging: example_logging: Add more testcases. 2018-05-11 14:18:02 +10:00
Paul Sokolovsky 6b67e351f0 logging: Implement isEnabledFor(level) method. 2018-05-11 14:18:02 +10:00
Paul Sokolovsky f788f667ca logging: Some performance and memory use optimizations. 2018-05-11 14:18:02 +10:00
Paul Sokolovsky 220b501eeb unittest: Release 0.3.2. 2018-05-11 14:18:02 +10:00
Konstantin Belyalov 912f9413ac unittest: Exit with non zero code in case of failures. Fixing #259 2018-05-11 14:18:02 +10:00
Paul Sokolovsky 0a581ef357 uasyncio.udp: Release 0.1.1. 2018-05-11 14:18:02 +10:00
Paul Sokolovsky 8d75a36431 uasyncio.udp: Remove optional flags value in a call to usocket.sendto(). 2018-05-11 14:18:02 +10:00
Paul Sokolovsky 4238bc9653 uasyncio: Release 2.0. 2018-05-11 14:18:02 +10:00
Paul Sokolovsky 97be3343fa uasyncio.core: Release 2.0. 2018-05-11 14:18:02 +10:00
Paul Sokolovsky 5149a54f91 uasyncio: Update __init__() to take runq_len & waitq_len params. 2018-05-11 14:18:02 +10:00
Paul Sokolovsky 7e8a3cfe45 uasyncio.core: test_full_wait: Update for runq/waitq refactor. 2018-05-11 14:18:02 +10:00
Paul Sokolovsky 4c63ecf5a6 uasyncio.core: Switch to separate run and wait queues.
Instead of using single priority queue for all tasks, split into using
"run queue", which represents tasks not waiting until specific time,
which should be run on every (well, next) loop iteration, and wait queue,
still a priority queue. Run queue is a simple FIFO, implemented by
ucollections.deque, recently introduced in pfalcon/micropython. Thus,
there's minimal storage overhead and intrinsic scheduling fairness.
Generally, run queue should hold both a callback/coro and its arguments,
but as we don't feed any send args into coros still, it's optimized to
hold just 1 items for coros, while 2 for callbacks.

Introducing run queue will also allow to get rid of tie-breaking counter
in utimeq implementation, which was introduced to enforce fair scheduling.
It's no longer needed, as all tasks which should be run at given time
are batch-removed from wait queue and batch-inserted into run queue. So,
they may be executed not in the order scheduled (due to non-stable order
of heap), but the whole batch will be executed "atomically", and any new
schedulings from will be processed no earlier than next loop iteration.
2018-05-11 14:18:02 +10:00
Paul Sokolovsky ab3198edd7 uasyncio: benchmark/boom_uasyncio.py: More assert output. 2018-05-11 14:18:02 +10:00
Damien George e439624748 upip: Release 1.2.4.
Change PyPI URL to pypi.org.
2018-04-23 16:15:00 +10:00
Dustin Ingram e17efb0844 upip: Fix upip bootstrap script to use pypi.org. 2018-04-23 16:03:17 +10:00
Dustin Ingram b4c27ea1ea upip: Use new JSON API pointing to pypi.org.
So upip doesn't have to follow redirects.
2018-04-23 16:02:29 +10:00
Dustin Ingram 49e8a839a0 README: Update links related to new PyPI URL.
pypi.python.org was turned off on 13th April 2018 and pypi.org is now the
URL to use; see https://packaging.python.org/guides/migrating-to-pypi-org/
2018-04-23 16:01:35 +10:00
Paul Sokolovsky 9e21d6e1ed uasyncio.udp: Typo fix in debug print. 2018-02-05 12:48:06 +02:00
Paul Sokolovsky 72a90a0c93 uasyncio.core: test_full_wait.py: Make easier to debug. 2018-02-05 12:36:13 +02:00
Paul Sokolovsky 85c82e7467 uasyncio.core: example_call_soon.py: Add logging setup. 2018-02-05 00:21:39 +02:00
Paul Sokolovsky bc14f2f6eb uasyncio.core: test_fair_schedule.py: More checks and iterations. 2018-02-05 00:19:34 +02:00
Paul Sokolovsky 5925aa60e2 uasyncio: Release 1.4.2. Packaging fix. 2018-02-04 13:44:38 +02:00
Paul Sokolovsky 04f8f3db0c uasyncio.core: Release 1.7.2. Packaging fix. 2018-02-04 13:43:07 +02:00
Paul Sokolovsky 31b384c137 uasyncio.websocket.server: Release 0.1. 2018-02-02 20:32:27 +02:00
Paul Sokolovsky 60de502676 all: setup.py: Switch to sdist_upip. 2018-02-02 20:30:52 +02:00
Paul Sokolovsky a44ce8dcc6 make_metadata: Switch to use sdist_upip. 2018-02-02 20:30:05 +02:00
Paul Sokolovsky 2ff5940d92 all: setup.py: Consistently update author and maintainer fields. 2018-02-02 20:25:27 +02:00
Paul Sokolovsky c3cded0134 make_metadata: Support multi-level packages.
Need to split off last component, tested with uasyncio.websocket.server.
2018-02-02 20:19:18 +02:00
Paul Sokolovsky bf8eef9d9e uasyncio.websocket.server: Add echo server example. 2018-02-02 01:35:11 +02:00
Paul Sokolovsky 1e2c8d9ce9 argparse: Release 0.4. 2018-02-02 01:22:59 +02:00
stijn 08b522abac argparse: Implement parse_known_args
This is convenient when components need only to parse a subset of an
application's arguments, and can be implemented with minor changes to
_parse_args: basically just add unknown arguments to a list instead of
raising an exception.
2018-02-02 01:21:32 +02:00
Paul Sokolovsky 4c6e7f7107 uasyncio.websocket.server: Websocket server implementation for uasyncio.
During development, following questions were posed, and subsequently,
answered:

Q #1: Should this be in uasyncio package at all? Upstream doesn't have
this. Pro: will be easier for people do discover (see e.g.
https://github.com/micropython/micropython-lib/issues/148)

A: uasyncio diverges more and more from asyncio, so if something is
convinient for uasyncio, there's no need to look back at asyncio.

Q #2: This provides implements 2 ways to create a WS connections:
1) using start_ws_server(); 2) using wrapping existing StreamReader
and StreamWriter. History: initial prototype of course used 2). But
the idea was "it should be like the official start_server()!!1". But
then I though how to integrate it e.g. with Picoweb, and became clear
that 2) is the most flixble way. So, 1) is intended to be removed.

A: 1) was removed and is not part of the merged version of the patch.

Q #3: Uses native websocket module for read path, but has own
write path due to https://github.com/micropython/micropython/issues/3396

A: So far, so good.

Q #4: Requires https://github.com/micropython/micropython-lib/pull/227
due to https://github.com/micropython/micropython/issues/3394 .

A: The prerequisite was merged.
2018-02-02 01:14:47 +02:00
Paul Sokolovsky 0c45f9f666 upip: Release 1.2.3. 2018-01-27 13:22:59 +02:00
Paul Sokolovsky 559d51c0ee upip: Be sure to create socket with params returned by getaddrinfo().
To use address as returned by getaddrinfo(), we should create a socket
compatible with address family, etc., returned by the same call alongside
the address itself.
2018-01-27 13:22:37 +02:00
Paul Sokolovsky f2114d889d uasyncio: Release 1.4.1. 2018-01-23 23:23:19 +02:00
Paul Sokolovsky 147085d0f7 uasyncio: Be sure to create socket with params returned by getaddrinfo(). 2018-01-23 23:22:37 +02:00
Paul Sokolovsky 63b3d75af2 urllib.urequest: Release 0.6. 2018-01-23 00:27:06 +02:00
Paul Sokolovsky a2647e316e urllib.urequest: Be sure to create socket with params returned by getaddrinfo().
To use address as returned by getaddrinfo(), we should create a socket
compatible with address family, etc., returned by the same call alongside
the address itself.
2018-01-23 00:26:38 +02:00
Paul Sokolovsky 2e4a29defc urequests: Release 0.6. 2018-01-23 00:25:30 +02:00
Paul Sokolovsky 829f53dc9e urequests: Be sure to create socket with params returned by getaddrinfo().
To use address as returned by getaddrinfo(), we should create a socket
compatible with address family, etc., returned by the same call alongside
the address itself.
2018-01-23 00:24:53 +02:00
Paul Sokolovsky 8392bd8ea5 pickle: Release 0.1. 2018-01-21 14:51:45 +02:00
Paul Sokolovsky 1c30e28c40 pickle: test_pickle.py: Update for bytes being returned/consumed. 2018-01-21 14:50:37 +02:00
Paul Sokolovsky 22527a6ebd pickle: Module produces and consumes bytes.
So, dumps() should return bytes, dump() should be passed binary file, etc.
2018-01-21 14:49:24 +02:00
Paul Sokolovsky 66f147a761 pickle: test_pickle.py: Turn into real test, add more cases.
Including a test for arbitrary statement execution.
2018-01-21 14:45:12 +02:00
Paul Sokolovsky 4328dde8f8 pickle: Replace exec() with eval(), smaller surface for security issues. 2018-01-21 14:42:49 +02:00
Paul Sokolovsky 73bd871268 hashlib: Release 2.4.0-4. 2018-01-20 11:51:02 +02:00
Paul Sokolovsky 175634b3cd hashlib: Reuse classes available in ushashlib, extend tests. 2018-01-20 11:50:59 +02:00
Paul Sokolovsky f8ee045adb hashlib: Rename submodules to avoid naming conflicts.
Both submodules and classes are named like "sha256", this may lead to
issues when loading just specific items from modules.
2018-01-20 11:36:23 +02:00
Paul Sokolovsky c94c6e0d45 uaiohttpclient: Release 0.5.1. 2018-01-14 11:51:59 +02:00
Paul Sokolovsky f29477fea5 uaiohttpclient: Support HTTP reply lines without textual description.
E.g. "HTTP/1.1 500". RFC7230 seems to formally require at least a space
after the numeric code, but it was reported that some software sends
lines like above nonetheless.

Ref: https://github.com/micropython/micropython-lib/issues/247
2018-01-14 11:50:32 +02:00
Paul Sokolovsky 23ac9e5821 urllib.urequest: Release 0.5.1. 2018-01-14 11:41:14 +02:00
Paul Sokolovsky 469e029dd2 urllib.urequest: Support HTTP reply lines without textual description.
E.g. "HTTP/1.1 500". RFC7230 seems to formally require at least a space
after the numeric code, but it was reported that some software sends
lines like above nonetheless.

Ref: https://github.com/micropython/micropython-lib/issues/247
2018-01-14 11:40:11 +02:00
Paul Sokolovsky cdea2d94cc urequests: Release 0.5.2. 2018-01-14 11:34:44 +02:00
Paul Sokolovsky 4d46561a5b urequests: Support HTTP reply lines without textual description.
E.g. "HTTP/1.1 500". RFC7230 seems to formally require at least a space
after the numeric code, but it was reported that some software sends
lines like above nonetheless.

Ref: https://github.com/micropython/micropython-lib/issues/247
2018-01-14 11:21:23 +02:00
Paul Sokolovsky 4c2c940c13 ssl: Release 0.1. 2018-01-10 00:13:04 +02:00
Alex Robbins d76ecc4fb7 ssl: Wrap ussl.wrap_socket().
Arguments whose values are the default are not passed to ussl, because
many arguments are not accepted by current ussl implementations, even
if the desired behavior is the same as when they are omitted.
2018-01-10 00:11:37 +02:00
Alex Robbins a4a524e4ac ssl: Add more constants.
Beyond imported from ussl.
2018-01-10 00:11:17 +02:00
Paul Sokolovsky 157e3b5d61 make_metadata: Use more specific 'micropython-lib Developers'. 2018-01-07 16:27:47 +02:00
Paul Sokolovsky 94af1328c1 upip: Add copyright header. 2018-01-07 16:17:17 +02:00
Paul Sokolovsky f0ed97ad23 README: Mention that some modules may require pfalcon's fork. 2018-01-07 16:04:59 +02:00
Paul Sokolovsky 9ff3beabd1 uasyncio.core: Release 1.7.1. 2018-01-07 10:44:13 +02:00
Paul Sokolovsky 06a2abae56 uasyncio.core: Add test for cancel(coro) function. 2018-01-07 10:43:15 +02:00
Paul Sokolovsky 17a432c1a3 uasyncio.core: Add cancel(coro) function.
This also adds CancelledError exception and makes TimeoutError be a
subclass of it. As well as adds default exception handler for it in
the eventloop (which just skips re-adding this coro to the scheduling
queue, as expected).
2018-01-07 10:41:51 +02:00
Paul Sokolovsky c59c5c6ef8 datetime: Release 3.3.3-1. 2017-12-21 18:54:16 +02:00
Paul Sokolovsky 107c17591a datetime: test_datetime: Skip some tests for MicroPython.
Otherwise, runs completely (with object.__new__ patch).
2017-12-20 13:55:45 +02:00
Paul Sokolovsky 45fffed699 datetime: Replace '"%c" % char' with '"%s" % char'.
MicroPython may have issues with unicode chars.
2017-12-19 09:09:49 +02:00
Paul Sokolovsky fe2b6d473a datetime: Avoid float.as_integer_ratio().
MicroPython doesn't have it, so implement equivalent (+/- rounding errors)
arithmetics.
2017-12-18 00:39:01 +02:00
Paul Sokolovsky 1bde1058ce udnspkt: Release 0.1. 2017-12-17 20:56:13 +02:00
Paul Sokolovsky 1d1caa29c3 udnspkt: Add example. 2017-12-17 16:48:11 +02:00
Paul Sokolovsky 7e334411c2 udnspkt: A module to create/parse DNS packets to resolve hostnames.
This module implements "Sans I/O" approach, where packets are created/
parsed using BytesIO objects, and all networking happens outside the
module.

The module implements enough functionality to resolve a domain name
into IP address, for both IPv4 and IPv6.

Other DNS functionality is outside the scope of this module, that's
why it's called *u*dnspkt.

The API is experimental and subject to change.

This module requires .readbin()/.writebin() methods on a stream.
2017-12-17 16:27:46 +02:00
Paul Sokolovsky 7e643f6365 uasyncio.udp: Release 0.1. 2017-12-16 00:41:17 +02:00
Paul Sokolovsky eb7d34d127 uasyncio.udp: Add example interacting with dnsmasq DNS. 2017-12-16 00:40:35 +02:00
Paul Sokolovsky 916e15ed35 uasyncio.udp: New functional API, mimicking socket module.
Don't have any wrapper classes for UDP socket, instead just have top-level
coroutines, taking raw socket as an argument:

s.recv(1500) => await uasyncio.udp.recv(s, 1500)
2017-12-16 00:40:03 +02:00
Paul Sokolovsky 057b0ba4c4 uasyncio: Release 1.4. 2017-12-15 20:25:35 +02:00
Paul Sokolovsky fede052d48 uasyncio.core: Release 1.7. 2017-12-15 20:24:40 +02:00
Paul Sokolovsky ac1d0391d8 sdist_upip: Don't treat files at the toplevel dir as resources.
E.g. README. Resources should be inside a package.
2017-12-15 00:20:59 +02:00
Paul Sokolovsky 223d91dc82 sdist_upip: Need to override setuptools' "sdist" command, not distutils'.
Without setuptools, there will be no goodies like dependencies, etc.
2017-12-15 00:08:31 +02:00
Paul Sokolovsky f6c00613db uasyncio.core: Add test for wait_for() call. 2017-12-14 19:38:49 +02:00
Paul Sokolovsky f6555bae97 uasyncio: On scheduling ready coro, unmark it as I/O-waiting.
Coros which are passed to .add_reader()/.add_writer() are marked as
I/O-bound using .pend_throw(False). Before scheduling it for normal
execution again, we need to unmark it with .pend_throw(None).
2017-12-14 19:14:42 +02:00
Paul Sokolovsky 203cc489c6 uasyncio.core: wait_for: Add support for cancelling I/O-bound coros.
Coros which removed from normal scheduling queue (and possibly put into
another queue, like I/O queue here) are marked with .pend_throw(False).
If wait_for() cancels such a coro, it is explicitly scheduled for execution,
so they actually could process pending exception (coro's exception handler
should take care of removing it from another queue and related clean up).
2017-12-14 19:09:02 +02:00
Paul Sokolovsky 0137449f1f math: Add placeholder module. 2017-12-14 09:46:45 +02:00
Paul Sokolovsky c327850c3e sdist_upip.py: Replacement for optimize_upip.py.
Unlike optimize_upip, which instantiates a separate distutils/setuptools
command to run after "sdist", sdist_upip overrides "sdist" implementation,
so it simplifies publishing workflow (no need to run adhoc commands).

Besides what optimize_upip did (post-porocessing to remove superfluous
files and recompressing with gzip 4K dictionary), sdist_upip also
adds pre-processing step of generation resource module (R.py) from
resource files.

So, now there's a single (and standard) command to generate a distrubution
package for MicroPython.
2017-12-12 23:24:37 +02:00
Paul Sokolovsky 82bb7607f3 dis: Add placeholder module. 2017-12-12 12:17:00 +02:00
Paul Sokolovsky 86f1db5f2c uasyncio.synchro: Release 0.1.1. 2017-12-12 12:12:17 +02:00
Paul Sokolovsky 340b3772a7 uasyncio.synchro: Update for cur_coro -> cur_task rename in uasyncio.core. 2017-12-12 12:10:54 +02:00
Paul Sokolovsky c279a8195f dummy_threading: Add placeholder module. 2017-12-10 17:28:52 +02:00
Paul Sokolovsky 6add549fd0 array: Add placeholder module. 2017-12-10 17:27:59 +02:00
Paul Sokolovsky f1fa3a7ff1 uasyncio: Release 1.3. 2017-12-09 18:08:50 +02:00
Paul Sokolovsky 04c0110319 uasyncio: open_connection: Initial hackish SSL support.
It performs handshake in blocking manner, hopes that writes
work without short writes, and hopes that non-blocking read
is implemented properly by ussl module (there're known issues
with axTLS module for example).
2017-12-09 18:07:32 +02:00
Paul Sokolovsky a7f8eaa6ed uasyncio.core: Release 1.6. 2017-12-09 18:05:47 +02:00
Paul Sokolovsky d19253a222 uasyncio.core: Implement wait_for() function for CPU-bound coroutines.
This requires a new .pend_throw() generator method on MicroPython side.
Timing out of I/O-bound coroutines doesn't work yet.
2017-12-03 02:09:10 +02:00
Paul Sokolovsky afa6192501 uasyncio.core: Store currently executed task as an attribute of event loop.
Currently executed task is a top-level coroutine scheduled in the event
loop (note that sub-coroutines aren't scheduled in the event loop and
are executed implicitly by yield from/await, driven by top-level coro).
2017-12-03 00:22:17 +02:00
Paul Sokolovsky d87573b113 uasyncio.udp: Initial attempt of UDP support for uasyncio.
API is not stable and will guaranteedly change, likely completely.

Currently, this tries to folow the same idea as TCP open_connection()
call, but that doesn't make much sense, so that will likely change.
2017-12-03 00:07:12 +02:00
Paul Sokolovsky ec7a9a1f20 uasyncio: README: Mention .awrite() and .aclose() methods vs asyncio. 2017-12-02 12:59:33 +02:00
Paul Sokolovsky f8c403ef4f urequests: Release 0.5.1. 2017-12-02 12:57:06 +02:00
Manos Tsagkias 6c141990ac urequests: Set Content-Type to application/json when json param is used.
Otherwise, some servers don't recognize the payload as JSON.
2017-12-02 12:54:27 +02:00
Paul Sokolovsky f971582069 make_metadata.py: Support plain README files for long_desc. 2017-11-27 00:16:24 +02:00
Paul Sokolovsky 15dd925df9 uaiohttpclient: Release 0.5.
This module was imported from a standalone repository:
https://github.com/pfalcon/micropython-uaiohttpclient
2017-11-26 19:01:31 +02:00
Paul Sokolovsky 98eb9b8194 uaiohttpclient: Add User-Agent to request, some sites don't like lack of it. 2017-11-26 18:55:16 +02:00
Paul Sokolovsky 0976a44c57 uaiohttpclient: Switch to use StreamWriter.aclose(). 2017-11-26 18:55:11 +02:00
Paul Sokolovsky 2d23c7f125 uaiohttpclient: Only http: protocol is supported, fail predictably for others. 2017-11-26 18:55:06 +02:00
Paul Sokolovsky 16c57c50f4 uaiohttpclient: Add support for redirects. 2017-11-26 18:55:03 +02:00
Paul Sokolovsky 5e1af0f277 uaiohttpclient: Implement support for chunked transfer encoding.
Chunked T-E is mandatory for HTTP/1.1, and thus prerequisite for supporting
it.
2017-11-26 18:54:57 +02:00
Paul Sokolovsky 8c1e077fc0 uaiohttpclient: Use "Connection: close" as workaround for broken HTTP 1.0 servers. 2017-11-26 18:54:39 +02:00
Paul Sokolovsky 51cd47ae2f uaiohttpclient: Add README. 2017-11-26 18:54:36 +02:00
Paul Sokolovsky c2dce8f68a uaiohttpclient: Add usage example. 2017-11-26 18:54:33 +02:00
Paul Sokolovsky a9c6c296f0 uaiohttpclient: Initial implementation of the client.
Can do GET requests for URL, nothing more.
2017-11-26 18:53:57 +02:00
Paul Sokolovsky 5ef2821025 uasyncio.synchro: Release 0.1. 2017-11-26 10:10:39 +02:00
Paul Sokolovsky 5bebece527 random: Release 0.2. 2017-11-26 00:04:07 +02:00
Paul Sokolovsky 6568c0380e random: Add shuffle(). 2017-11-26 00:03:16 +02:00
Paul Sokolovsky 9edb4ec580 random: Add randint(). 2017-11-25 18:59:52 +02:00
Paul Sokolovsky 403d850cf7 random: Release 0.1. 2017-11-25 12:33:16 +02:00
Paul Sokolovsky 7c6e26bfcd random: Add test_randrange.py. 2017-11-25 12:32:32 +02:00
Paul Sokolovsky ac6fcb4729 random: Add randrange() implementation.
The idea behind this implementation is that getrandbits() is guaranteed
(required) to be equally distributed. Thus, we can just repeatedly
sample it until get a suitable value, there's no bias accumulated and
the process should be finite (and on average take few iterations).
2017-11-25 12:30:42 +02:00
Paul Sokolovsky 693b229f8d pickle: Very rough implementation of pickle loads from imported modules.
Allows to implement minimal pickling for datetime objects.
2017-11-12 00:34:04 +02:00
Paul Sokolovsky 96a6033715 test.support: Add dummy @requires_IEEE_754 decorator.
Used e.g. by datetime/test_datetime.py.
2017-11-12 00:32:46 +02:00
Paul Sokolovsky 62597352e4 datetime: Add test from CPython 3.3.3.
Originally named datetimetester.py .
2017-11-12 00:28:14 +02:00
Paul Sokolovsky 587596401c datatime: Add from CPython 3.3.3. 2017-11-12 00:27:22 +02:00
Paul Sokolovsky 97dbe6c8ca unicodedata: Release 0.0.3. 2017-11-09 19:15:47 +02:00
Riccardo Magliocchetti 8b3fbc0c7d unicodedata: add dummy normalize implementation 2017-11-09 19:15:15 +02:00
Paul Sokolovsky f704ac5817 uasyncio: StreamReader: Separate "poll socket" vs "I/O socket".
Poll socket is what's passed to uselect.poll(), while I/O socket is what's
used for .read(). This is a workaround of the issue that MicroPython doesn't
support proxying poll functionality for stream wrappers (like SSL, websocket,
etc.)
This issue is tracked as https://github.com/micropython/micropython/issues/3394

It may be that it's more efficient to apply such a workaround on uasyncio
level rather than implementing full solution of uPy side.
2017-11-05 18:01:21 +02:00
Paul Sokolovsky bd828087e1 uasyncio: Release 1.2.4. 2017-11-05 17:52:15 +02:00
Paul Sokolovsky 9c18d6f39b uasyncio: test_http_server_heavy: Close socket with "finally". 2017-11-05 17:46:50 +02:00
Paul Sokolovsky f81285ff4e uasyncio: Auto-unregister poll objects on POLLHUP/POLLERR.
POLLHUP/POLERR may be returned anytime (per POSIX, these flags aren't
even valid in input flags, they just appear in output flags). Subsequent
I/O operation on stream will lead to exception. If an application
doesn't do proper exception handling, the stream won't be closed, and
following calls will return POLLHUP/POLLERR status again (infinitely).
So, proactively unregister such a stream.

This change is questionable, because apps should handle errors properly
and close the stream in such case (or it will be leaked), and closing
will remove the stream from poller too.

But again, if that's not done, it may lead to cascade of adverse effects,
e.g. after eef054d98, benchmark/test_http_server_heavy.py regressed and
started and started to throw utimeq queue overflow exceptions. The story
behind it is: Boom benchmarker does an initial probe request to the app
under test which it apparently doen't handle properly, leading to
EPIPE/ECONNRESET on the side of the test app, the app didn't close the
socket, so each invocation to .wait() resulted in that socket being
returned with POLLHUP again and again. Given that after eef054d98, .wait()
is called on each even loop iteration, that create positive feedback in
the queue leading to it growing to overflow.
2017-11-05 17:12:12 +02:00
Paul Sokolovsky dd30302f4b gettext: Release 0.1. 2017-11-05 12:51:47 +02:00
Riccardo Magliocchetti 6b93948472 gettext: implement gettext and ngettext
By wrapping the C counterparts
2017-11-05 12:51:13 +02:00
Paul Sokolovsky 91d176d57a functools: Release 0.0.7. 2017-11-05 12:35:45 +02:00
Riccardo Magliocchetti 7945617727 functools: add missing arguments to update_wrapper and wraps
Still dummy though.
2017-11-05 10:58:01 +01:00
Paul Sokolovsky f08c8dfc9d venv: Add dummy module. 2017-11-04 23:52:16 +02:00
Paul Sokolovsky b7f0b1a451 zlib: Add dummy module. 2017-11-04 00:04:11 +02:00
Paul Sokolovsky 93da05d3da sys: Add placeholder module. 2017-11-04 00:02:55 +02:00
Paul Sokolovsky e268fd4543 uasyncio.synchro: Add Lock example. 2017-11-03 00:45:57 +02:00
Paul Sokolovsky 3c805874d7 uasyncio.synchro: New submodule for synchronization primitives, Lock added. 2017-11-03 00:40:28 +02:00
Paul Sokolovsky 2829d4adc9 threading: Release 0.1. 2017-11-01 01:41:54 +02:00
Paul Sokolovsky 429f73c4a3 threading: Add very bare implementation of Thread class. 2017-11-01 00:55:30 +02:00
Paul Sokolovsky da124acfdb uasyncio: Release 1.2.3, added initial README. 2017-10-30 01:23:19 +02:00
Paul Sokolovsky 04bd0855bb codeop: Release 0.0.0. 2017-10-29 10:42:30 +03:00
Paul Sokolovsky 5b9e19cf7c codeop: Add dummy module. 2017-10-29 10:41:39 +03:00
Reid Wagner b54987bd14 select: Convert float timeout to int with math.ceil.
In CPython, timeout is a float and the value rounded up to the
nearest millisecond.
2017-10-29 10:01:00 +03:00
Paul Sokolovsky 03c1e65e6e code: Release 0.0.0. 2017-10-29 00:15:10 +03:00
Paul Sokolovsky 8e59a50ceb code: Add dummy module. 2017-10-29 00:14:30 +03:00
Paul Sokolovsky e5da0ea7c9 importlib: Release 0.0.0. 2017-10-29 00:11:15 +03:00
Paul Sokolovsky 4f7ad186c8 importlib: Add dummy module. 2017-10-29 00:09:54 +03:00
Paul Sokolovsky 3169fe388a readline: Release 0.0.0. 2017-10-28 23:16:31 +03:00
Paul Sokolovsky 18c79dbaec readline: Add dummy module. 2017-10-28 23:16:13 +03:00
Paul Sokolovsky e046338ea2 uasyncio.core: Release 1.5.1, updated description. 2017-10-28 22:52:15 +03:00
Paul Sokolovsky a314da83f1 uasyncio.core: logging is not longer hard dependency, remove it.
If user is going to enable logging in particular app, they should depend
on it themselves.
2017-10-28 02:17:24 +03:00
Paul Sokolovsky 62fbfa9965 uasyncio.core: Add yield call to remove coro from scheduling.
yield False won't reschedule current coroutine to be run again. This is
useful when coro is put on some waiting queue (and is similar to what
yield IORead/yield IOWrite do).
2017-10-28 02:14:02 +03:00
Paul Sokolovsky 8f08257512 pickle: Add dummy HIGHEST_PROTOCOL, accept dummy proto in dump, dumps.
For compatibility with CPython.

These are probably not good for low-resource ports, but for them we may
need to create upickle.
2017-10-22 19:50:20 +03:00
Paul Sokolovsky 03bb3ad060 io: Release 0.1. 2017-10-21 21:36:44 +03:00
Paul Sokolovsky 72315593b3 io: Add SEEK_* symbolic constants. 2017-10-21 21:34:41 +03:00
Paul Sokolovsky 1bae9c92c4 select: Release 0.3. 2017-10-21 21:28:43 +03:00
Reid Wagner c09b364253 select: epoll: Recompute timeout after EINTR.
As detailed in PEP 475, timeout should be recomputed before retrying
the interrupted system call.
2017-10-21 21:27:57 +03:00
Paul Sokolovsky c8f9cf1dca select: epoll.poll() takes timeout in seconds.
That's inconsistent with poll.poll(), but that's how CPython has it.
2017-10-21 00:40:50 +03:00
Paul Sokolovsky 61f9dd8721 os.path: test_path.py: Use paths relative to module dir.
Allows to run via test aggregators.
2017-10-18 14:03:05 +03:00
Paul Sokolovsky e9b54606e9 os: test_filestat.py: Use paths relative to module dir.
Allows to run via test aggregators.
2017-10-13 20:24:35 +03:00
Paul Sokolovsky 54e466d650 upip: Makefile: Remove unused dependencies. 2017-10-12 20:04:29 +03:00
Paul Sokolovsky 98bf9edccc fnmatch: test_fnmatch: Disable tests for bytes arguments.
re-pcre doesn't work properly with bytes patterns so far, disable the test
until later.
2017-10-11 20:12:21 +03:00
Paul Sokolovsky 8cca4dffce glob: test_glob: Consistently disable tests for bytes arguments.
MicroPython doen't fully implement str vs bytes dichotomy on "os" module
level, so it doesn't work for glob either.
2017-10-10 17:30:41 +03:00
Paul Sokolovsky 56434974a7 select: Release 0.2. 2017-10-07 01:14:30 +03:00
Paul Sokolovsky f5bc4d8ea3 select: Re-export uselect module contents (poll() and related). 2017-10-07 01:13:28 +03:00
Reid Wagner 423e6c6a53 select: Add POLLPRI mask.
Value is per Linux.
2017-10-07 01:10:28 +03:00
Paul Sokolovsky 643b1d0fab os: Rename examples as such.
To not be mixed up with real tests.
2017-10-04 23:37:44 +03:00
Paul Sokolovsky f6a043e128 traceback: Release 0.3. 2017-10-03 22:24:13 +03:00
Riccardo Magliocchetti 151c671243 traceback: Add basic versions of format_exc() and format_exception(). 2017-10-03 22:22:30 +03:00
Riccardo Magliocchetti d040285fbd pwd: add basic implementation of pwd
The only function implemented is getpwnam
2017-10-03 22:18:27 +03:00
Paul Sokolovsky 83b6c02881 asyncio_slow: Rename examples as such.
To not be mixed up with real tests.
2017-09-30 18:40:23 +03:00
Paul Sokolovsky 027d8f6d7f upip: Release 1.2.2. 2017-09-29 18:21:32 -07:00
Paul Sokolovsky eaf9f91d39 upip: upip_utarfile: Update for str.rstrip() fixes.
Propagated from utarfile.
2017-09-29 18:20:52 -07:00
Paul Sokolovsky a015fca3fa utarfile: Update for str.rstrip() fixes.
rstrip() without args no longer strips "\0", we need to do that explicitly.
2017-09-29 18:19:44 -07:00
Paul Sokolovsky 2f5f428f7c utarfile: skip: Optimize for memory usage.
Propagated from upip_utarfile.py.
2017-09-29 18:19:07 -07:00
Paul Sokolovsky 417774d205 select: example_epoll.py: Rename from test_epoll.py. 2017-09-29 10:18:54 -07:00
Paul Sokolovsky c8a3bb6d0e operator: Add bunch of operator synonym functions.
As used by datetime test from CPython.
2017-09-28 09:33:16 -07:00
Paul Sokolovsky c9471276b3 http.client: Rename examples as such.
To not be mixed up with real tests.
2017-09-27 00:34:43 -07:00
Paul Sokolovsky 75651b465f test.support: Release 0.1.3. 2017-09-23 12:27:49 +03:00
Paul Sokolovsky 32060ab025 test.support: run_unittest: Accept string test module name as param.
This is used e.g. by datetimetester.py from CPython.
2017-09-22 22:21:24 +03:00
Paul Sokolovsky a953735f3d unittest: Release 0.3.1. 2017-09-22 22:20:14 +03:00
Paul Sokolovsky cfa1b9cce0 unittest: Show class name of test method.
Makes output more compatible with CPython.
2017-09-21 00:11:10 +03:00
Paul Sokolovsky b36f292822 unittest: Add skipIf decorator. 2017-09-20 20:24:21 +03:00
Paul Sokolovsky 49140d6c13 urequests: Release 0.5. 2017-09-13 18:46:04 +03:00
Paul Sokolovsky 2e834672aa urequests: content: Use finally to close socket regardless of possible error. 2017-09-13 15:17:28 +03:00
Paul Sokolovsky 586ae64cb0 urequests: If error happens while parsing response headers, close socket.
Because otherwise, user doesn't get any response object, so cannot close
socket, and it leaks.
2017-09-13 09:38:07 +03:00
Paul Sokolovsky 7a469b229e urllib.urequest: Release 0.5. 2017-09-12 08:44:09 +03:00
Paul Sokolovsky b715ee0cb8 urllib.urequest: If error happens while parsing response headers, close socket.
Because otherwise, user doesn't get any response object, so cannot close
socket, and it leaks.
2017-09-12 08:43:38 +03:00
Paul Sokolovsky cad77291d5 asyncio_slow: Rename "async()" to "ensure_future()".
"async()" was deprecated in CPython due to introduction of the similar
keyword, and causes SyntaxError in MicroPython.
2017-09-10 00:08:32 +03:00
Paul Sokolovsky 9a5f94b807 time: Release 0.5. 2017-09-09 14:02:20 +03:00
Paul Sokolovsky d69aaba546 time: Introduce "real" struct_time.
Implemented using namedtuple and lacks tm_zone, tm_gmtoff fields.
2017-09-09 14:01:00 +03:00
Paul Sokolovsky 2472ad4e0e time: Release 0.4. 2017-09-05 01:05:27 +03:00
Paul Sokolovsky c00210106b time: Add daylight and timezone vars. 2017-09-05 01:04:10 +03:00
Paul Sokolovsky 50ae5ef4aa time: Add dummy struct_time constructor.
CPython compatibility. As we don't have a proper struct_time, and use
tuple instead, the constructor is identity function.
2017-09-04 12:59:19 +03:00
Paul Sokolovsky f51d7ec0db time: time_t is at least long int, convert it as such.
Rumors even says that it may be long long on recent 32-bit Linux x86
systems.
2017-09-04 12:47:29 +03:00
Paul Sokolovsky c18ef60871 multiprocessing: Release 0.1.2. 2017-09-03 11:11:39 +03:00
Paul Sokolovsky 13a6f4955c multiprocessing: tests: Turn into proper tests, make CPython compatible. 2017-09-03 11:10:56 +03:00
Paul Sokolovsky 3e3c6fcaa6 multiprocessing: Fix from_bytes/to_bytes calls.
As they're used for internal communication, just use "little" for
endianness.
2017-09-03 11:09:05 +03:00
Paul Sokolovsky 1522d3eb15 test.support: Release 0.1.2. 2017-09-03 11:07:46 +03:00
Paul Sokolovsky 67bc4317a0 unittest: Release 0.3. 2017-09-03 11:06:37 +03:00
Paul Sokolovsky 61a85a1c2f test.support: Test stats are now printed by TestRunner.run(). 2017-09-03 07:17:45 +03:00
Paul Sokolovsky 82386e86ff unittest: Test stats are now printed by TestRunner.run().
Like done by CPython version.
2017-09-03 06:45:20 +03:00
Paul Sokolovsky 74140defb7 unittest: Run testcases more correctly, count failures.
Test methdos are now run wrapped in try/except/finally. failures are
counted, instead of aborting on the first.
2017-09-02 17:30:27 +03:00
Paul Sokolovsky ec67618df1 uasyncio.core: Release 1.5. 2017-09-01 15:14:32 +03:00
Paul Sokolovsky b2dd97cd6c xmltok: test_xmltok: Find data file relative to module dir.
Allows to run via test aggregators.
2017-08-30 00:19:13 +03:00
Paul Sokolovsky ba14d0ab70 sqlite3: Add test for CREATE TABLE/INSERT/lastrowid. 2017-08-30 00:11:51 +03:00
Paul Sokolovsky 5cb3fe10f0 sqlite3: test_sqlite3: Turn into a real test (with asserts). 2017-08-30 00:05:07 +03:00
Paul Sokolovsky d113ea4751 sqlite3: Release 0.2.4. 2017-08-29 00:32:16 +03:00
Paul Sokolovsky 2d4bc69975 sqlite3: Pass sys.byteorder to int.from_bytes().
Following it now being mandatory in MicroPython.
2017-08-29 00:31:44 +03:00
Paul Sokolovsky 4cae9a3fc0 time: Add test_strftime.py.
Based on test patterns prepared by @sschwartzcpu.
2017-08-27 12:34:47 +03:00
Paul Sokolovsky eaf7228ce6 time: Release 0.3.2. 2017-08-27 12:24:10 +03:00
sschwartzcpu ac66b1ca1a time: strftime: 2nd parameter must be a struct tm tuple.
As described in https://docs.python.org/3/library/time.html#time.strftime
2017-08-27 12:19:47 +03:00
Paul Sokolovsky e14d8532fd codecs: Add dummy module. 2017-08-26 10:28:41 +03:00
Paul Sokolovsky 935509ac4b ssl: Release 0.0.1. 2017-08-20 17:59:54 +03:00
Paul Sokolovsky ea60d9d71f ssl: Add dummy module, redirecting to ussl. 2017-08-20 17:59:01 +03:00
Paul Sokolovsky da9228c9b2 xmltok: Release 0.2. 2017-08-20 17:53:57 +03:00
ThunderEX fdf984d07d xmltok: Skip comment markup in XML.
This is provisional solution, at later time, comments may become tokenized
and fed to the caller, like other syntactic elements.
2017-08-20 17:52:28 +03:00
Paul Sokolovsky 79f13b6e4a uasyncio.core/test_full_wait: Update for .wait() called on each loop iter.
This fixes this mock test after the recent change to make I/O scheduling
fair.
2017-08-20 17:06:07 +03:00
Paul Sokolovsky eef054d98a uasyncio.core: Make I/O scheduling fair wrt to computational scheduling.
If there is a coroutine to run immediately (with wait delay <= 0),
uasyncio.core never called .wait() method, which is required to
process I/O events (and schedule coroutines waiting for them). So
now, call .wait(0) even if there's a coroutine to run immediately.
2017-08-20 17:04:31 +03:00
Peter Hinch 65605e3de8 uasyncio: Add test showing I/O scheduling starvation.
If there is a coroutine to run immediately (with wait delay <= 0),
uasyncio.core never calls .wait() method, which is required to
process I/O events (and schedule coroutines waiting for them).

This test demonstrates the problem.
2017-08-20 16:36:15 +03:00
Paul Sokolovsky c7b277ff7c binascii: Add test which exposes to_bytes() problem in the module. 2017-08-15 10:26:25 +03:00
Christopher Cooper 20d9cdbd5f binascii: Add required argument to <int>.to_bytes(...) call.
The <int>.to_bytes(...) function requires two arguments.  The first
specifies the number of bytes to return, and the second specifies the
endianness of those bytes.  By definition, Base64 encoding is big
endian.
2017-08-15 10:24:59 +03:00
Christopher Cooper 96c981b1ee hmac: Calculate correct digest when non-trivial key is used.
This incorrect behavior was a result of the function that performs
table-driven byte translation. The function first used the chr(...)
function to convert each resulting byte, represented as an integer,
to a string of length one. Then, the <str>.encode(...) function was
used to convert the string to a byte string with an intended length
of one. That didn't work well for bytes with high bit set, as they
were trated as UTF-8 chars. Instead, perform operations directly on
bytes.

This was an artifact of porting this to MicroPython, as the original
CPython module uses bytes.translate(...) method (not available in
uPy).
2017-08-13 14:52:52 +03:00
Paul Sokolovsky 6bf4207215 README: Update, more details about package sources. 2017-08-13 13:52:49 +03:00
Christopher Cooper c5ebfe1c72 base64: Add missing dependencies. 2017-08-12 08:46:38 +03:00
Paul Sokolovsky c265899cb7 re-pcre: Release 0.2.5. 2017-07-06 00:15:54 +03:00
Paul Sokolovsky b8718dc7cc re-pcre: Support .group() method without args.
Defaults to 0.
2017-07-06 00:15:17 +03:00
Paul Sokolovsky 607c62a813 umqtt.simple: Release 1.3.4. 2017-06-27 21:18:43 +03:00
puuu a09b3ec20a umqtt.simple: Do DNS lookup in connect() method. 2017-06-27 21:16:13 +03:00
Paul Sokolovsky f9f2264d99 typing: Add dummy module. 2017-06-23 15:41:15 +03:00
Paul Sokolovsky 24ba28a352 socket: Add INADDR_ANY. 2017-06-22 19:59:54 +03:00
Paul Sokolovsky 0636230639 upip: Release 1.2.1. 2017-06-16 02:47:52 +03:00
Anne Jan Brouwer e8053fb06a upip: Add server_hostname param to ussl.wrap_socket() call. 2017-06-15 16:04:58 +02:00
Paul Sokolovsky 7522c14183 urequests: Release 0.4.4. 2017-06-14 19:37:36 +03:00
Paul Sokolovsky 78ce2a8957 urequests: Add server_hostname param to ussl.wrap_socket() call. 2017-06-14 19:37:08 +03:00
Paul Sokolovsky efd7cd5ff9 urllib.urequest: Release 0.4.4. 2017-06-14 19:35:25 +03:00
Paul Sokolovsky 633f030d6f urllib.urequest: Add server_hostname param to ussl.wrap_socket() call. 2017-06-14 18:31:16 +03:00
Paul Sokolovsky 98502a223a pkg_resources: Release 0.2.1. 2017-06-10 16:16:29 +03:00
Paul Sokolovsky 154b8b02b9 pkg_resources: Don't try to make FS path absolute so far.
There's no uos.getcwd() on Unix - so far.
2017-06-10 16:15:09 +03:00
Paul Sokolovsky 7d9eb0716c uasyncio: Release 1.2.2. 2017-06-10 16:11:41 +03:00
Paul Sokolovsky a191626c2e uasyncio: Add awriteiter() method.
Write piecewise content from iterable (usually, a generator).
2017-06-10 16:10:27 +03:00
Paul Sokolovsky 1096940769 pkg_resources: Release 0.2. 2017-06-10 00:23:20 +03:00
Paul Sokolovsky 8a2958ee36 pkg_resources: Support "frozen" resources (in R.py module). 2017-06-10 00:22:50 +03:00
Paul Sokolovsky e1f75100cf uasyncio: Release 1.2.1. 2017-06-08 02:54:42 +03:00
Paul Sokolovsky a2097be138 uasyncio: Add own set_debug() function.
set_debug() from uasyncio.core doesn't have effect on the main uasyncio
package, so let them both have set_debug() function, and allow to enable
debug logging independently.
2017-06-08 02:51:29 +03:00
Paul Sokolovsky a4b75ab2bf uasyncio.core: Release 1.4.2. 2017-06-08 02:48:45 +03:00
Paul Sokolovsky b9540e4afe uasyncio.core: Use "uasyncio.core" logger. 2017-06-08 02:48:04 +03:00
Paul Sokolovsky 808e0bba0c umqtt.robust: Elaborate README.
Add intro section on complexities of achieving "robustness" and make
expicit that umqtt.robust requires an MQTT server with persistence
enabled.
2017-06-07 20:28:30 +03:00
Paul Sokolovsky 75e1474ddf uasyncio: awrite: Use 3-arg .write(), accept offset/size too.
Use MicroPython .write() extension of passing offset/size to efficiently
spool buffers larger than socket output buffer. Also, make awrite()
accept these params too.
2017-06-07 03:09:34 +03:00
Paul Sokolovsky 87e30182a1 uasyncio: test-ab-medium.sh: Run ab on http://127.0.0.1 .
On some hosts, http://localhost doesn't work, apparently ab resolve it
via IPv6 or something.
2017-06-06 21:37:55 +03:00
Paul Sokolovsky f5fe55aaef uasyncio: Release 1.2. 2017-06-06 21:27:50 +03:00
Paul Sokolovsky 16afc06b8c uasyncio: Switch to memory-efficient poll.ipoll() method.
As added in MicroPython 1.9.
2017-06-06 21:04:37 +03:00
Paul Sokolovsky 21d60a8b5f uasyncio.core: Release 1.4.1. 2017-05-23 01:27:33 +03:00
Paul Sokolovsky e13e139f51 uasyncio.core: Don't feed old send arguments into next coro invocation.
As all current syscalls don't return any value, there's nothing to feed
actually.
2017-05-23 01:26:08 +03:00
Paul Sokolovsky 191de78b16 uasyncio.core: Release 1.4. 2017-05-22 13:58:51 +03:00
Paul Sokolovsky c01004d71f uasyncio.core: Add test for callback args to call_soon(). 2017-05-22 13:57:57 +03:00
Paul Sokolovsky 241e7b1a3b uasyncio.core: Add stop() method for loop.
To allow to stop loop from a callback function.
2017-05-22 13:49:27 +03:00
Paul Sokolovsky bf327f755a uasyncio.core: Fix args handling for call_soon/call_later/call_later_ms. 2017-05-22 13:21:54 +03:00
Paul Sokolovsky 22cd93fb1a uasyncio.core: Release 1.3. 2017-05-16 23:01:03 +03:00
Paul Sokolovsky 9b5cbcdfce uasyncio.core: test_full_wait: Update for call_later_ms(). 2017-05-16 21:54:21 +03:00
Paul Sokolovsky 4fa29d867a uasyncio.core: Remove call_at() which takes absolute second time.
uasyncio uses different timebase than CPython's asyncio, so absolute
time scheduling compatible with it is impossible. Instead, there's
call_at_() which schedules using modular millisecond time.
2017-05-16 21:53:29 +03:00
Paul Sokolovsky ad73ee3043 uasyncio.core: Use finalized name for call_later_ms(). 2017-05-16 21:53:29 +03:00
Paul Sokolovsky 61392cb641 uasyncio.core: Remove unused Sleep syscall.
It's unused since since sleep() was switched to yield an integer for
delay.
2017-05-16 21:45:13 +03:00
Paul Sokolovsky 3ef991c115 uasyncio.core: Remove legacy commented code for add_reader/add_writer. 2017-05-14 16:38:32 +03:00
Paul Sokolovsky f30c784dcf pprint: Release 0.0.4. 2017-05-11 21:21:23 +03:00
Paul Sokolovsky d8c87f8153 pprint: Add dummy pprint() function. 2017-05-11 21:20:51 +03:00
Paul Sokolovsky d0c6ae0b31 urequests: Add example_xively.py as very basic example.
The main purpose is actually to show the need to call .close().
2017-05-05 20:47:08 +03:00
Paul Sokolovsky 577457dbdd upip: Release 1.2. 2017-05-05 13:10:06 +03:00
Paul Sokolovsky 04eb5b2e7f optimize_upip.py: Rework inclusion/exclusion logic.
We should include files by default, as a package may contain arbitrary
files, e.g. as resources. So, rework inclusion/exlusion logic to work
using incremental refinement.
2017-05-05 13:01:54 +03:00
Paul Sokolovsky e8e531b754 uasyncio: Release 1.1.2. 2017-05-05 11:35:24 +03:00
Paul Sokolovsky 9a72e29564 uasyncio: Consistently use "if DEBUG and __debug__:" stanza.
To make sure this module can work without logging module imported, just
like uasyncio.core was made to.
2017-05-05 11:33:39 +03:00
Paul Sokolovsky 91d9c168b8 upip: url_open: Reworking error handling to guaranteedly close socket. 2017-05-05 03:25:07 +03:00
Paul Sokolovsky 024d6bc2b1 upip: install_pkg: Use try-finally to ensure opened socket always closed. 2017-05-05 03:17:21 +03:00
Paul Sokolovsky 1bfd389a81 upip: url_open: If --debug, dump URL being opened. 2017-05-04 10:44:54 +03:00
Paul Sokolovsky c9337def58 upip: Treat PyPI redirects as "package not found".
PyPI has got too smart and redirects typos, etc. to a similarly-called
packages.
2017-05-04 10:17:27 +03:00
Paul Sokolovsky 823b743daf upip: get_pkg_metadata: Use ujson.load() to save memory. 2017-05-04 01:12:58 +03:00
Paul Sokolovsky 36744578e2 uasyncio.core: Release 1.2.1. 2017-05-01 16:10:51 +03:00
Paul Sokolovsky aea501add6 uasyncio.core: Import utime unconditionally, uasyncio depends on MicroPython. 2017-05-01 16:09:34 +03:00
Paul Sokolovsky b2f69eb23b uasyncio.core: Add set_debug() method, don't import logging if not called. 2017-05-01 16:04:28 +03:00
Paul Sokolovsky 0a02e2dfff urequests: Subscript getaddrinfo() result with -1. 2017-05-01 15:28:56 +03:00
Paul Sokolovsky 0496643afb upip: Release 1.1.6. 2017-05-01 00:02:51 +03:00
Paul Sokolovsky aa02e41056 upip: Allow to have commented packages in requirements.txt. 2017-05-01 00:02:33 +03:00
Paul Sokolovsky 9b1f0105a5 os: Release 0.6. 2017-04-29 19:43:00 +03:00
Paul Sokolovsky 43ce994fa6 os: listdir: Fix bytes vs str comparison warning. 2017-04-29 19:39:26 +03:00
Paul Sokolovsky 94f1584e48 umqtt.simple: Release 1.3.3. 2017-04-27 17:53:14 +03:00
Damien Mascord 2164c88483 umqtt.simple: Handle CONNECT messages longer than 127 bytes. 2017-04-27 17:52:00 +03:00
Paul Sokolovsky 30c2ac5601 itertools: Release 0.2.3. 2017-04-24 22:08:49 +03:00
stijn 45ff04ac75 itertools: Add accumulate function 2017-04-24 16:00:30 +02:00
Paul Sokolovsky 5cf6600e5e uasyncio.core: Release 1.2. 2017-04-20 21:32:07 +03:00
Paul Sokolovsky bb3057ffed uasyncio.core: Fix scheduling in the presense of I/O completion callbacks.
wait() may finish prematurely due to I/O completion, and schedule new,
earlier than before tasks to run. So, after call to wait(), we need to
check current time and time of head task, and continue to wait if needed.
Recently introduced provisional utimeq.peektime() is used to optimize
querying time of a head task.
2017-04-08 01:34:57 +03:00
Paul Sokolovsky c440f8466e urequests: Release 0.4.3. 2017-03-25 17:47:27 +03:00
jens persson 6ce081133c urequests: A Location-header with a 2XX status is not a redirect.
When using the POST method you get the Location of the new
object in a Location header but it's not a redirect.
For details see for example RFC2616 10.2.2 and 10.2.3
2017-03-25 17:45:51 +03:00
Paul Sokolovsky 53193ba2e7 uasyncio: benchmark: Modern browsers produce requests more than 256 bytes.
So, not all of the request was read, and a browser would report than
connection was reset.
2017-03-16 01:55:32 +03:00
Paul Sokolovsky a355801fb1 uasyncio: wait: Remove no longer needed "if", artifact of epoll impl. 2017-03-13 00:44:58 +03:00
Paul Sokolovsky 4fc72c6032 uasyncio: Remove "epoll" references from previous Linux-only implementation. 2017-03-12 16:42:02 +03:00
Paul Sokolovsky aa9bbe839e uasyncio.core: Add test for full wait for a time-scheduled coro.
Specifically, that a coroutine scheduled to run at some time (after some
delay) waits requested time before it's run and not run prematurely in
case an I/O completion happens before it.
2017-03-12 16:02:06 +03:00
Paul Sokolovsky 48ead94116 uasyncio.core: Add test for fair scheduling. 2017-03-06 12:16:34 +01:00
Paul Sokolovsky aba6935892 uasyncio: Release 1.1.1. 2017-02-16 00:04:39 +03:00
Paul Sokolovsky 853535802f uasyncio.core: Release 1.1.1. 2017-02-15 23:49:39 +03:00
Paul Sokolovsky 67445f3334 uasyncio: benchmark: Rename test runners to correspond to underlying tests. 2017-02-15 11:19:10 +03:00
Paul Sokolovsky 6a4973331a uasyncio: benchmark: Set higher queue length for "medium" test.
Following setting the default conservatively low in the module.
Surprisingly, heavy test appears to work with new default length
of 42.
2017-02-15 11:17:02 +03:00
Paul Sokolovsky e3dac1d693 uasyncio: Allow to override queue length, while setting low default.
The default queue length is set to take under 0.5K RAM on 32-bit system.
A queue length can be passed to get_event_loop() to override it. This
change follows similar change in uasyncio.core.
2017-02-15 11:14:53 +03:00
Paul Sokolovsky 55b4161512 uasyncio.core: Set lower default queue len and allow to override it.
The default is set to be under 0.5K on 32-bit system. A queue length
can be passed to get_event_loop() to override it.
2017-02-15 03:27:59 +03:00
Paul Sokolovsky 12da3a81a6 copy: Use standard metadata, release is 3.3.3-2. 2017-02-08 01:23:00 +03:00
Paul Sokolovsky d59af2da7b upip: Release 1.1.5. 2017-02-08 01:15:58 +03:00
Paul Sokolovsky 1f91189e04 upip: Be sure to close socket if we abort with error early.
Need to close properly in more places.
2017-02-08 01:14:56 +03:00
Paul Sokolovsky a86e7cf5a7 upip: Report host name resolve error in user friendly manner. 2017-02-08 01:12:45 +03:00
Paul Sokolovsky 068988085e upip: Report package not found and similar errors with less noise.
While still allow to get full backtrace with --debug.
2017-02-08 00:39:47 +03:00
Paul Sokolovsky f6668aae28 uasyncio: Release 1.1. 2017-01-28 01:58:05 +03:00
Paul Sokolovsky 1bf1c74ae5 uasyncio: Use builtin uerrno module. 2017-01-28 01:55:40 +03:00
Paul Sokolovsky 7043ee0702 uasyncio: Implement StreamReader.readexactly().
With a unit test.
2017-01-28 01:04:21 +03:00
Paul Sokolovsky ec7b4b948b uasyncio: StreamReader.readline: Handle partial reads.
Now it will return a complete line regardless if it may take several
partial reads to do that. Test included.
2017-01-27 01:09:19 +03:00
Paul Sokolovsky a8d85e28d0 uasyncio: Fix partial reads in StreamReader.read/readline() methods.
If None (no data, would block) is received, need to wait for more data,
not just read it again immediately.
2017-01-26 22:20:29 +03:00
Paul Sokolovsky f5fdebed34 collections.defaultdict: Release 0.3. 2017-01-26 01:35:10 +03:00
Paul Sokolovsky 69b65efd7e collections.defaultdict: Implement __contains__.
Otherwise, "in" operation uses list protocol (enumeration using
__getitem__, which adds a key/value pair to teh underlying dict)
and ends with memory overflow.
2017-01-26 01:26:40 +03:00
Paul Sokolovsky 56dd0f94e9 uasyncio: Rename examples as such. 2017-01-04 18:01:05 +03:00
Paul Sokolovsky 3e37bdda56 uasyncio: Move test_call_soon.py to uasyncio.core, as it needs only it.
Also, rename as example.
2017-01-04 18:01:05 +03:00
Daniel Mizyrycki 4bc5ab902b uasyncio: Add echo test 2017-01-01 19:06:54 -08:00
Daniel Mizyrycki 0f5d5cead7 uasyncio: Add minimum esp8266 support 2017-01-01 18:17:17 -08:00
Paul Sokolovsky 6256ad69c0 uasyncio: Release 1.0.1. 2016-12-30 22:32:26 +03:00
Paul Sokolovsky f7c5fe1aea uasyncio.core: Release 1.1. 2016-12-30 22:29:19 +03:00
Paul Sokolovsky 5403e0f710 uasyncio: Use DEBUG variable as imported from uasyncio.core.
Avoids heap allocation to render disabled debug logging strings.
2016-12-29 11:37:41 +03:00
Paul Sokolovsky f29be360c0 uasyncio: wait: Add workaround against heap alloc on empty iteration.
"for a in ():" unconditionally allocates heap so far, per
https://github.com/micropython/micropython/issues/2716 . So, test for
empty result before iterating over it.
2016-12-28 10:25:31 +03:00
Paul Sokolovsky 9d5919dd1c uasyncio.core: Implement sleep_ms as an awaitable object instead of coro.
This allows to await it without heap allocation.
2016-12-26 19:51:11 +03:00
Paul Sokolovsky 793bc05be5 uasyncio.core: Report unknown syscalls. 2016-12-26 19:11:38 +03:00
Paul Sokolovsky 24125191ce uasyncio.core: Convert Sleep syscall arg (seconds) to milliseconds. 2016-12-23 00:35:42 +03:00
Paul Sokolovsky 222758f0c2 uasyncio.core: Switch to dedicated utimeq class.
Allows zero-allocation scheduling of tasks. As long as tasks don't use
await/yield from with coroutines, and don't allocate memory themselves,
there will be no allocation and GC.
2016-12-22 13:04:09 +03:00
Paul Sokolovsky 845f8ebde0 os: Release 0.5. 2016-12-21 00:12:25 +03:00
Paul Sokolovsky d47419bb73 os: Implement popen(). 2016-12-21 00:11:23 +03:00
Paul Sokolovsky 92d32a6cd8 re-pcre: Release 0.2.4. 2016-12-19 23:07:34 +03:00
Paul Sokolovsky 7ccd2d87ed re-pcre: Actually fix compatibility with big-endian systems.
"big" argument to b"".from_bytes(..., "big") isn't really supported by
MicroPython, so use array as a buffer.
2016-12-19 23:05:38 +03:00
Paul Sokolovsky 6e0f020fcd umqtt.simple: Release 1.3.2. 2016-12-19 22:59:52 +03:00
Paul Sokolovsky de9fcc53d5 umqtt.simple: Update for to_bytes() parameters refactor. 2016-12-19 22:57:43 +03:00
Paul Sokolovsky 050c6cdb75 README: More info about naming and links to PyPI search results.
Also, typo fixes.
2016-12-11 15:35:10 +03:00
Paul Sokolovsky 88c9eae5e1 README: Update to the current state of affairs (pip-micropython -> upip, etc.) 2016-12-10 18:12:35 +03:00
Paul Sokolovsky fceed2b1bb README: Remove "highly experimental" status. 2016-12-10 18:00:39 +03:00
Paul Sokolovsky a968dd7856 urequests: Release 0.4.2. 2016-12-10 17:57:55 +03:00
Paul Sokolovsky f0b8d9b7ca urequests: Fix stale variable name (line -> l). 2016-12-10 17:56:44 +03:00
Paul Sokolovsky 0552589f9f uasyncio.queues: Release 0.1.2. 2016-12-08 14:45:55 +03:00
Paul Sokolovsky 614f5e61e9 uasyncio.queues: Fix queue full condition check in put(). 2016-12-08 14:44:59 +03:00
Paul Sokolovsky 1abe4fc8ed re-pcre: Release 0.2.3. 2016-12-08 14:36:35 +03:00
Paul Sokolovsky 444004be32 re-pcre: Fix compatibility with big-endian systems. 2016-12-08 14:35:48 +03:00
Paul Sokolovsky abddcd7893 urllib.urequest: Release 0.4.3. 2016-12-08 14:31:59 +03:00
Paul Sokolovsky cf591cf2c6 urllib.urequest: Fix stale variable name (line -> l). 2016-12-08 14:31:25 +03:00
Tobias Ammann 94be568a03 functools: Make partial wrapper pass on return value. 2016-11-15 19:24:05 +01:00
Paul Sokolovsky 23ff6305c3 uasyncio: Release 1.0. 2016-11-13 15:18:30 +03:00
Paul Sokolovsky 2e5c021515 uasyncio.core: Release 1.0. 2016-11-13 15:17:18 +03:00
Paul Sokolovsky f24493b1eb uasyncio.core: create_task: Fix scheduling.
Should start with zero delay, not at zero absolute time.
2016-11-13 15:01:51 +03:00
Paul Sokolovsky b3c2d0f51e uasyncio.core: Add additional debug output control.
__debug__ isn't flexible enough, if you don't disable it, there's huge
memory allocation.
2016-11-13 14:59:49 +03:00
Paul Sokolovsky 02a6625a00 uasyncio.core: Introduce "trailing _" functions which avoid arg un/packing.
They just take tuple of arguments instead of *args. In most cases, that
will be () singleton.
2016-11-13 14:59:49 +03:00
Paul Sokolovsky 67d8e55dea uasyncio: Update for switching to utime.ticks_ms() timesource. 2016-11-13 04:39:52 +03:00
Paul Sokolovsky f5ae66973d uasyncio.core: Remove heapq aggregate structure workaround. 2016-11-13 01:44:35 +03:00
Paul Sokolovsky d9e72f1d40 uasyncio.core: Switch to ticks_ms() as timing source.
This makes uasyncio.core compatible with baremetal/embedded ports.

Includes switching to "uheapq timeq" for task queue.
2016-11-13 01:32:32 +03:00
Paul Sokolovsky f81e979c56 machine: Release 0.2.1. 2016-11-11 00:18:05 +03:00
Paul Sokolovsky 44b29172ec machine: Be sure to import things from builtin umachine. 2016-11-11 00:16:58 +03:00
Paul Sokolovsky 9992d14ef8 machine: machine.Pin: Add pin reading support.
Also, optimize to use binary file mode.
2016-11-11 00:09:43 +03:00
Paul Sokolovsky 294d69693b machine: Release 0.2. 2016-11-09 22:38:58 +00:00
Paul Sokolovsky 7ac2cf662e machine: Add Pin class implementation for Linux.
Tested only for output so far.
2016-11-09 22:38:07 +00:00
Paul Sokolovsky 6ec58b6d97 pystone_lowmem: Release 3.4.2-4. 2016-11-08 01:53:53 +03:00
Paul Sokolovsky fb47cd8bc5 pystone_lowmem: Update for new signature of ticks_diff() (args swapped). 2016-11-08 01:52:59 +03:00
Paul Sokolovsky 4534075c37 umqtt.simple: Release 1.3. 2016-10-30 15:08:15 +03:00
Paul Sokolovsky b86a671f92 upip: Release 1.1.4. 2016-10-22 21:09:37 +03:00
Paul Sokolovsky 7e9eed98cb upip: Fix handling of non-existing absolute install paths.
The latest refactor of _makedirs() had a buf preventing to create them
properly.
2016-10-22 21:07:56 +03:00
Paul Sokolovsky d5d2395f0f curses: Add dummy module. 2016-10-21 00:08:08 +03:00
Paul Sokolovsky 42452a737e asyncio: Add dummy module. 2016-10-21 00:06:03 +03:00
Paul Sokolovsky 9146ebe9a7 upip: Release 1.1.3. 2016-10-12 18:15:29 +03:00
Paul Sokolovsky 2c83920f36 upip: Fix heap size to use for decreased gzip dictionary.
Original intended value is 64K of heap or smaller, 640K figure was a
testing one.
2016-10-12 18:14:07 +03:00
Paul Sokolovsky dfe4dee62a all: setup.py: New releases for gzip 4k conversion. 2016-10-11 06:47:01 +03:00
Paul Sokolovsky 65fb3707ba all: metadata.txt: Bump version for gzip 4k conversion. 2016-10-11 06:46:12 +03:00
Paul Sokolovsky b2ab9141c0 _markupbase: Release 3.3.3-1, gzip 4k. 2016-10-11 00:50:22 +03:00
Paul Sokolovsky e0a110efd8 _libc: Release 0.3.1, gzip 4k. 2016-10-11 00:43:05 +03:00
Paul Sokolovsky 12c046dc60 __future__: Release 0.0.3, gzip 4k. 2016-10-11 00:35:40 +03:00
Paul Sokolovsky 705f41cbde make_metadata.py: Update URL to point to micropython-lib github page. 2016-10-11 00:34:33 +03:00
Paul Sokolovsky f5d07759cf make_metadata.py: Include optimize_upip plugin into setup.py generated. 2016-10-11 00:24:18 +03:00
Paul Sokolovsky 96102e73a4 make_metadata.py: Clarify comment. 2016-10-11 00:15:44 +03:00
Paul Sokolovsky 6d2c0019e7 optimize_upip.py: Script to optimize archives for low-heap upip usage. 2016-10-11 00:12:51 +03:00
Paul Sokolovsky 89e7f262ed upip: Release 1.1.1. 2016-10-11 00:10:24 +03:00
Paul Sokolovsky 2ca1527321 upip: upip_utarfile.skip(): Optimize for memory usage. 2016-10-11 00:08:04 +03:00
Paul Sokolovsky 2696367cda upip: Add explicit gc.collect() calls for low-heap ports. 2016-10-11 00:07:39 +03:00
Paul Sokolovsky d1bc4918c5 upip: Release 1.1. 2016-10-09 12:29:50 +03:00
Paul Sokolovsky e25148e860 upip: Update utarfile from upstream. 2016-10-09 12:28:26 +03:00
Paul Sokolovsky 1401fa385a utarfile: Release 0.3.1. 2016-10-09 12:22:19 +03:00
Paul Sokolovsky 54a527582a utarfile: Remove unused function. 2016-10-09 12:21:18 +03:00
Paul Sokolovsky 8fa7dcc9c0 upip: Use gzip dictionary size depending on heap size available.
For systems with 64K of heap or less, use small dictionary size of 4KB.
Otherwise, use standard 32KB.
2016-10-09 02:19:53 +03:00
Paul Sokolovsky d804100c20 upip: Add import-based usage help. 2016-10-09 02:13:05 +03:00
Paul Sokolovsky 47a6633a31 upip: Don't parse MICROPYPATH, just use sys.path[1] as set by micropython.
Makes POSIX and baremetal behavior simpler and more consistent.
2016-10-09 02:12:31 +03:00
Paul Sokolovsky 1ca07881e3 upip: A bit better reporting of networking errors. 2016-10-08 14:56:09 +03:00
Paul Sokolovsky 29c90a6231 upip: Don't rely on presence of directory entries in tar.
Just create intermediate path components for every filename.
2016-10-08 14:41:41 +03:00
Paul Sokolovsky 69390da38f upip: _makedirs(): Make compatible with FatFs quirks.
Don't have trailing "/" in paths.
2016-10-08 01:17:20 +03:00
Paul Sokolovsky c06f693ac3 upip: expandhome(): Call uos.getenv() only if there's something to expand.
To work on baremetal targets without getenv().
2016-10-08 00:36:24 +03:00
Paul Sokolovsky f115b8c22f upip: install(): Accept single package name in addition to a list. 2016-10-08 00:25:29 +03:00
Paul Sokolovsky bf63593305 upip: Factor out deducing default installation path to a function.
Make this deducing friendly to baremetal systems by falling back to
sys.path if os.getenv() is not available (sys.path[1] is used as
an install path in this case).
2016-10-08 00:12:17 +03:00
Paul Sokolovsky c1bfa36dbf upip: Factor out install() function. 2016-10-07 01:41:19 +03:00
Paul Sokolovsky ce843f3ffc upip: Make importable as a module. 2016-10-07 01:27:50 +03:00
Paul Sokolovsky 542c8cf9ef upip: save_file(): Optimize, use inplace buffer. 2016-10-06 00:50:55 +03:00
Paul Sokolovsky 7bc041e620 upip: Release 1.0. 2016-10-05 00:32:33 +03:00
Paul Sokolovsky 7b3a2c0a42 upip: Update utarfile module, readinto() support. 2016-10-04 00:13:53 +03:00
Paul Sokolovsky 31c4957ec5 utarfile: Release 0.3. 2016-10-03 23:53:37 +03:00
Paul Sokolovsky 30e1a9dbbe utarfile: Add readinto() method. 2016-10-02 07:26:50 -04:00
Paul Sokolovsky ab714615c6 upip: Remove wget fallback. 2016-10-01 17:32:07 -07:00
Paul Sokolovsky cbc423ae41 upip: Remove unneed cruft.
upip now works only with MicroPython, and the only Py-level dependency is
upip_utarfile.
2016-09-30 00:28:29 -07:00
Paul Sokolovsky 62671a4795 upip: upip_gzip.py no longer used, remove. 2016-09-29 08:53:09 -07:00
Paul Sokolovsky 6764d27d78 upip: Switch to stream mode of operation using uzlib.DecompIO.
So, there's no longer requirement that uncompressed file fit into memory,
though for stream mode, max dictionary size of 32K is used so far.
2016-09-28 09:00:33 -07:00
Paul Sokolovsky b6bfd9963d upip: Update utarfile module (support reading an open stream). 2016-09-27 03:15:25 -07:00
Paul Sokolovsky 7315442c7b utarfile: Release 0.2. 2016-09-26 12:10:33 -07:00
Paul Sokolovsky 6b0dafde63 utarfile: Add "fileobj" constructor argument to use existing stream. 2016-09-26 12:09:45 -07:00
Paul Sokolovsky daa50c17d3 upip: Release 0.8. 2016-09-23 15:33:25 +03:00
Paul Sokolovsky d6a3434ebe umqtt.simple: Release 1.2. 2016-09-18 21:22:23 +03:00
Paul Sokolovsky b5f9cd2581 umqtt.simple: README: Mention set_last_will(). 2016-09-18 20:59:36 +03:00
candale a254329557 umqtt.simple: Added last will capability. 2016-09-18 20:59:36 +03:00
Paul Sokolovsky 709e2f04ce time: Release 0.3. 2016-09-18 20:21:03 +03:00
Renaud Guillon bd7c796043 time: Added the functions mktime localtime and gmtime 2016-09-18 20:19:21 +03:00
Michaël Schrijver 2903d599c7 upip: Initialize socket with protocol family as gotten from resolver.
Fixes working over IPv6.
2016-09-12 23:56:36 +03:00
Paul Sokolovsky 98c6fb9024 umqtt.simple: Allow to pass arbitrary params to ussl.wrap_socket(). 2016-08-24 01:04:32 +03:00
candale c9a9b48ebe umqtt.simple: Add keepalive connection parameter. 2016-08-24 01:01:17 +03:00
Nicolas Graziano fcec7f7c1d umqtt.simple: Add MQTT user/password authentication.
Limitation the total length of client id, user name and password must
be under 111 characters.
2016-08-15 17:12:56 +03:00
Paul Sokolovsky 1aaaf0dea4 umqtt.robust: Add README and metadata. 2016-08-15 17:06:49 +03:00
Paul Sokolovsky bfeaea56cd umqtt.simple: Release 1.1. 2016-08-15 17:01:36 +03:00
puuu b66c68ee4e umqtt.simple: Let subscribe() process incoming async PUBLISH messages.
Utilising retained messages and multiple subscribes, a message could
arrive before the SUBACK packet.  Therefore, wait_msg() must be called
in subscribe().
2016-08-10 22:22:22 +03:00
puuu a261f4b4d7 umqtt.simple: do not close the socket in ping() 2016-08-08 21:58:44 +09:00
Paul Sokolovsky 9f7b60bede umqtt.simple: publish(): Reuse existing bytearray. 2016-08-08 01:07:59 +03:00
Paul Sokolovsky 1e83b27b9d upysh: Release 0.6. 2016-08-06 15:11:28 +03:00
mad474 c5b01d18fd upysh: Mention "mv" command in help text 2016-08-06 13:50:34 +02:00
Paul Sokolovsky 208c7f0f17 umqtt.simple: Add SSL support. 2016-08-05 00:40:05 +03:00
Paul Sokolovsky 4a8ef9f99c umqtt.simple: Be sure to return socket to blocking state after check_msg(). 2016-07-31 15:59:24 +03:00
Paul Sokolovsky 08f7d09353 umqtt.simple/README: Describe return value of connect(). 2016-07-30 14:47:03 +03:00
puuu 20cd8e4651 umqtt.robust: publish(): Adapt signature to umqtt.simple.
umqtt.simple uses publish(self, topic, msg, retain=False, qos=0), so
make umqtt.robust use the same. Otherwise, retain and qos will not work.
2016-07-27 01:41:03 +03:00
Paul Sokolovsky 6190cec14a umqtt.robust: Add sub example which can survive server restart. 2016-07-25 00:09:01 +03:00
Paul Sokolovsky d43faf2d09 umqtt.robust: Make refactored module actually work for reconnects. 2016-07-24 22:24:08 +03:00
Paul Sokolovsky 2fecbd0312 umqtt.robust: Initial version of client with auto-reconnect on errors. 2016-07-24 03:26:52 +03:00
Paul Sokolovsky b5fb588144 upysh: Release 0.5. 2016-07-17 00:44:10 +03:00
Paul Sokolovsky a8311ab86c upysh: Add "clear" command to clear screen.
Based on patch by @robert-hh:
https://github.com/micropython/micropython-lib/pull/76 .
2016-07-17 00:42:30 +03:00
Paul Sokolovsky 4a5965bbe0 umqtt.simple: publish: Do proper varlen message size encoding.
Using 2 static bytes for encoding didn't work well with some brokers,
e.g. Amazon AWS.

Also, extend max message size to 2M.
2016-07-16 00:30:53 +03:00
951 zmienionych plików z 44070 dodań i 14989 usunięć

Wyświetl plik

@ -0,0 +1,29 @@
name: Build all packages
on: [push, pull_request]
env:
PACKAGE_INDEX_PATH: /tmp/micropython-lib-deploy
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- name: Setup environment
run: source tools/ci.sh && ci_build_packages_setup
- name: Check manifest files
run: source tools/ci.sh && ci_build_packages_check_manifest
- name: Compile package index
run: source tools/ci.sh && ci_build_packages_compile_index
- name: Compile package examples
run: source tools/ci.sh && ci_build_packages_examples
- name: Publish packages for branch
if: vars.MICROPY_PUBLISH_MIP_INDEX && github.event_name == 'push' && ! github.event.deleted
run: source tools/ci.sh && ci_push_package_index
- name: Upload packages as artifact
uses: actions/upload-artifact@v3
with:
name: packages-${{ github.sha }}
path: ${{ env.PACKAGE_INDEX_PATH }}

Wyświetl plik

@ -0,0 +1,12 @@
name: Cleanup published packages
on: delete
jobs:
cleanup:
runs-on: ubuntu-latest
if: vars.MICROPY_PUBLISH_MIP_INDEX
steps:
- uses: actions/checkout@v3
- name: Clean up published files
run: source tools/ci.sh && ci_cleanup_package_index ${{ github.event.ref }}

Wyświetl plik

@ -0,0 +1,18 @@
name: Check commit message formatting
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '100'
- uses: actions/setup-python@v4
- name: Check commit message formatting
run: source tools/ci.sh && ci_commit_formatting_run

11
.github/workflows/ruff.yml vendored 100644
Wyświetl plik

@ -0,0 +1,11 @@
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python code lint and formatting with ruff
on: [push, pull_request]
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pip install --user ruff==0.1.2
- run: ruff check --output-format=github .
- run: ruff format --diff .

Wyświetl plik

@ -0,0 +1,14 @@
repos:
- repo: local
hooks:
- id: verifygitlog
name: MicroPython git commit message format checker
entry: tools/verifygitlog.py --check-file --ignore-rebase
language: python
verbose: true
stages: [commit-msg]
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.1.2
hooks:
- id: ruff
id: ruff-format

1
CODEOFCONDUCT.md 100644
Wyświetl plik

@ -0,0 +1 @@
Please see the [MicroPython Code of Conduct](https://github.com/micropython/micropython/blob/master/CODEOFCONDUCT.md).

Wyświetl plik

@ -1,3 +1,127 @@
If you submit a pull request, please adhere to Contributor Guidelines:
## Contributor's Guidelines & Code Conventions
https://github.com/micropython/micropython-lib/wiki/ContributorGuidelines
micropython-lib follows the same general conventions as the [main MicroPython
repository](https://github.com/micropython/micropython). Please see
[micropython/CONTRIBUTING.md](https://github.com/micropython/micropython/blob/master/CONTRIBUTING.md)
and [micropython/CODECONVENTIONS.md](https://github.com/micropython/micropython/blob/master/CODECONVENTIONS.md).
### Raising issues
Please include enough information for someone to reproduce the issue you are
describing. This will typically include:
* The version of MicroPython you are using (e.g. the firmware filename, git
hash, or version info printed by the startup message).
* What board/device you are running MicroPython on.
* Which package you have installed, how you installed it, and what version.
When installed via `mip`, all packages will have a `__version__`
attribute.
* A simple code snippet that demonstrates the issue.
If you have a how-to question or are looking for help with using MicroPython
or packages from micropython-lib, please post at the
[discussion forum](https://github.com/orgs/micropython/discussions) instead.
### Pull requests
The same rules for commit messages, signing-off commits, and commit structure
apply [as for the main MicroPython repository](https://github.com/micropython/micropython/blob/master/CODECONVENTIONS.md).
All Python code is formatted using the [black](https://github.com/psf/black)
tool. You can run [`tools/codeformat.py`](tools/codeformat.py) to apply
`black` automatically before submitting a PR. The GitHub CI will also run the
[ruff](https://github.com/astral-sh/ruff) tool to apply further "linting"
checks.
Similar to the main repository, a configuration is provided for the
[pre-commit](https://pre-commit.com/) tool to apply `black` code formatting
rules and run `ruff` automatically. See the documentation for using pre-commit
in [the code conventions document](https://github.com/micropython/micropython/blob/master/CODECONVENTIONS.md#automatic-pre-commit-hooks)
In addition to the conventions from the main repository, there are some
specific conventions and guidelines for micropython-lib:
* The first line of the commit message should start with the name of the
package, followed by a short description of the commit. Package names are
globally unique in the micropython-lib directory structure.
For example: `shutil: Add disk_usage function.`
* Although we encourage keeping the code short and minimal, please still use
comments in your code. Typically, packages will be installed via
`mip` and so they will be compiled to bytecode where comments will
_not_ contribute to the installed size.
* All packages must include a `manifest.py`, including a `metadata()` line
with at least a description and a version.
* Prefer to break larger packages up into smaller chunks, so that just the
required functionality can be installed. The way to do this is to have a
base package, e.g. `mypackage` containing `mypackage/__init__.py`, and then
an "extension" package, e.g. `mypackage-ext` containing additional files
e.g. `mypackage/ext.py`. See
[`collections-defaultdict`](python-stdlib/collections-defaultdict) as an
example.
* If you think a package might be extended in this way in the future, prefer
to create a package directory with `package/__init__.py`, rather than a
single `module.py`.
* Packages in the python-stdlib directory should be CPython compatible and
implement a subset of the CPython equivalent. Avoid adding
MicroPython-specific extensions. Please include a link to the corresponding
CPython docs in the PR.
* Include tests (ideally using the `unittest` package) as `test_*.py`.
Otherwise, provide examples as `example_*.py`. When porting CPython
packages, prefer to use the existing tests rather than writing new ones
from scratch.
* When porting an existing third-party package, please ensure that the source
license is compatible.
* To make it easier for others to install packages directly from your PR before
it is merged, consider opting-in to automatic package publishing (see
[Publishing packages from forks](#publishing-packages-from-forks)). If you do
this, consider quoting the [commands to install
packages](README.md#installing-packages-from-forks) in your Pull Request
description.
### Publishing packages from forks
You can easily publish the packages from your micropython-lib
[fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/about-forks)
by opting in to a system based on [GitHub
Actions](https://docs.github.com/en/actions) and [GitHub
Pages](https://docs.github.com/en/pages):
1. Open your fork's repository in the GitHub web interface.
2. Navigate to "Settings" -> "Secrets and variables" -> "Actions" -> "Variables".
3. Click "New repository variable"
4. Create a variable named `MICROPY_PUBLISH_MIP_INDEX` with value `true` (or any
"truthy" value).
5. The settings for GitHub Actions and GitHub Pages features should not need to
be changed from the repository defaults, unless you've explicitly disabled
them.
The next time you push commits to a branch in your fork, GitHub Actions will run
an additional step in the "Build All Packages" workflow named "Publish Packages
for branch".
Anyone can then install these packages as described under [Installing packages
from forks](README.md#installing-packages-from-forks). The exact commands are also
quoted in the GitHub Actions log for the "Publish Packages for branch" step.
#### Opting Back Out
To opt-out again, delete the `MICROPY_PUBLISH_MIP_INDEX` variable and
(optionally) delete the `gh-pages` branch from your fork.
*Note*: While enabled, all micropython-lib packages will be published each time
a change is pushed to any branch in your fork. A commit is added to the
`gh-pages` branch each time. In a busy repository, the `gh-pages` branch may
become quite large. The actual `.git` directory size on disk should still be
quite small, as most of the content will be duplicated. If you're worried that
the `gh-pages` branch has become too large then you can always delete this
branch from GitHub. GitHub Actions will create a new `gh-pages` branch the next
time you push a change.

Wyświetl plik

@ -1,8 +1,8 @@
micropython-lib consists of multiple modules from different sources and
authors. Each module comes under its own licensing terms. Short name of
a license can be found in a file within a module directory (usually
metadata.txt or setup.py). Complete text of each license used is provided
below. Files not belonging to a particular module a provided under MIT
authors. Each module comes under its own licensing terms. The short name of
a license can be found in a file within the module directory (usually
metadata.txt or setup.py). The complete text of each license used is provided
below. Files not belonging to a particular module are provided under the MIT
license, unless explicitly stated otherwise.
=============== MIT License ===============

Wyświetl plik

@ -1,16 +0,0 @@
PREFIX = ~/.micropython/lib
all:
# Installs all modules to a lib location, for development testing
CMD="find . -maxdepth 1 -mindepth 1 \( -name '*.py' -not -name 'test_*' -not -name 'setup.py' \) -or \( -type d -not -name 'dist' -not -name '*.egg-info' -not -name '__pycache__' \)| xargs --no-run-if-empty cp -r -t $(PREFIX)"
install:
@mkdir -p $(PREFIX)
@if [ -n "$(MOD)" ]; then \
(cd $(MOD); sh -c $(CMD)); \
else \
for d in $$(find -maxdepth 1 -type d ! -name ".*"); do \
echo $$d; \
(cd $$d; sh -c $(CMD)); \
done \
fi

206
README.md
Wyświetl plik

@ -1,66 +1,172 @@
~~~~
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
micropython-lib is a highly experimental community project.
# micropython-lib
Please help to drive it to just "experimental" state by testing
provided packages with MicroPython.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
~~~~
This is a repository of packages designed to be useful for writing MicroPython
applications.
micropython-lib
===============
micropython-lib is a project to develop a non-monolothic standard library
for MicroPython. Each module or package is available as a separate
distribution package from PyPI. Each module is either written from scratch or
ported from CPython.
The packages here fall into categories corresponding to the four top-level
directories:
Note that the main target of micropython-lib is a "Unix" port of MicroPython
(additional ports to support are to be determined). Actual system requirements
vary per module. Though if a module is not related to I/O, the module should
work without problem on bare-metal ports too (e.g. pyboard).
* **python-stdlib**: Compatible versions of modules from [The Python Standard
Library](https://docs.python.org/3/library/). These should be drop-in
replacements for the corresponding Python modules, although many have
reduced functionality or missing methods or classes (which may not be an
issue for most cases).
* **python-ecosys**: Compatible, but reduced-functionality versions of
packages from the wider Python ecosystem. For example, a package that
might be found in the [Python Package Index](https://pypi.org/).
Usage
-----
micropython-lib packages are published on PyPI (Python Package Index),
the standard Python community package repository: http://pypi.python.org/ .
On PyPi, you can search for MicroPython related packages and read
additional package information.
* **micropython**: MicroPython-specific packages that do not have equivalents
in other Python environments. This includes drivers for hardware
(e.g. sensors, peripherals, or displays), libraries to work with
embedded functionality (e.g. bluetooth), or MicroPython-specific
packages that do not have equivalents in CPython.
To install packages from PyPI for usage on your local system, use the
`pip-micropython` tool, which is a simple wrapper around the standard
`pip` tool, which is used to install packages for CPython.
The `pip-micropython` tool can be found in `tools` subdirectory
of the main MicroPython repository (https://github.com/micropython/micropython).
Just install the `pip-micropython` script somewhere on your `PATH`.
* **unix-ffi**: These packages are specifically for the MicroPython Unix port
and provide access to operating-system and third-party libraries via FFI,
or functionality that is not useful for non-Unix ports.
Afterwards, just use `pip-micropython` in a way similar to `pip`:
## Usage
~~~~
$ pip-micropython install micropython-copy
$ micropython
>>> import copy
>>> copy.copy([1, 2, 3])
[1, 2, 3]
~~~~
To install a micropython-lib package, there are four main options. For more
information see the [Package management documentation](https://docs.micropython.org/en/latest/reference/packages.html)
documentation.
Review the `pip-micropython` source code for more info.
### On a network-enabled device
As of MicroPython v1.20 (and nightly builds since October 2022), boards
with WiFi and Ethernet support include the `mip` package manager.
Development
-----------
To install modules during development, use `make install`. By default, all
available packages will be installed. To install a specific module, add the
`MOD=<module>` parameter to the end of the `make install` command.
```py
>>> import mip
>>> mip.install("package-name")
```
### Using `mpremote` from your PC
Links
-----
More information is on GitHub and in the MicroPython forums:
`mpremote` is the officially-supported tool for interacting with a MicroPython
device and, since v0.4.0, support for installing micropython-lib packages is
provided by using the `mip` command.
* https://github.com/micropython/micropython/issues/405
* http://forum.micropython.org/viewtopic.php?f=5&t=70
```bash
$ mpremote connect /dev/ttyUSB0 mip install package-name
```
Guidelines for packaging MicroPython modules for PyPI:
See the [mpremote documentation](https://docs.micropython.org/en/latest/reference/mpremote.html).
### Freeze into your firmware
If you are building your own firmware, all packages in this repository include
a `manifest.py` that can be included into your board manifest via the
`require()` command. See [Manifest files](https://docs.micropython.org/en/latest/reference/manifest.html#require) for
more information.
### Copy the files manually
Many micropython-lib packages are just single-file modules, and you can
quickly get started by copying the relevant Python file to your device. For
example, to add the `base64` library, you can directly copy
`python-stdlib/base64/base64.py` to the `lib` directory on your device.
This can be done using `mpremote`, for example:
```bash
$ mpremote connect /dev/ttyUSB0 cp python-stdlib/base64/base64.py :/lib
```
For packages that are implemented as a package directory, you'll need to copy
the directory instead. For example, to add `collections.defaultdict`, copy
`collections/collections/__init__.py` and
`collections-defaultdict/collections/defaultdict.py` to a directory named
`lib/collections` on your device.
Note that unlike the other three approaches based on `mip` or `manifest.py`,
you will need to manually resolve dependencies. You can inspect the relevant
`manifest.py` file to view the list of dependencies for a given package.
## Installing packages from forks
It is possible to use the `mpremote mip install` or `mip.install()` methods to
install packages built from a
[fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/about-forks)
of micropython-lib, if the fork's owner has opted in.
This can be useful to install packages from a pending Pull Request, for example.
First, the owner of the fork must opt-in as described under
[Publishing packages from forks](CONTRIBUTING.md#publishing-packages-from-forks).
After this has happened, each time someone pushes to a branch in that fork then
GitHub Actions will automatically publish the packages to a GitHub Pages site.
To install these packages, use commands such as:
```bash
$ mpremote connect /dev/ttyUSB0 mip install --index https://USERNAME.github.io/micropython-lib/mip/BRANCH_NAME PACKAGE_NAME
```
Or from a networked device:
```py
import mip
mip.install(PACKAGE_NAME, index="https://USERNAME.github.io/micropython-lib/mip/BRANCH_NAME")
```
(Where `USERNAME`, `BRANCH_NAME` and `PACKAGE_NAME` are replaced with the owner
of the fork, the branch the packages were built from, and the package name.)
## Contributing
We use [GitHub Discussions](https://github.com/micropython/micropython/discussions)
as our forum, and [Discord](https://micropython.org/discord) for chat. These
are great places to ask questions and advice from the community or to discuss your
MicroPython-based projects.
The [MicroPython Wiki](https://github.com/micropython/micropython/wiki) is
also used for micropython-lib.
For bugs and feature requests, please [raise an issue](https://github.com/micropython/micropython-lib/issues/new).
We welcome pull requests to add new packages, fix bugs, or add features.
Please be sure to follow the
[Contributor's Guidelines & Code Conventions](CONTRIBUTING.md). Note that
MicroPython is licensed under the [MIT license](LICENSE) and all contributions
should follow this license.
### Future plans (and new contributor ideas)
* Develop a set of example programs using these packages.
* Develop more MicroPython packages for common tasks.
* Expand unit testing coverage.
* Add support for referencing remote/third-party repositories.
## Notes on terminology
The terms *library*, *package*, and *module* are overloaded and lead to some
confusion. The interpretation used in by the MicroPython project is that:
A *library* is a collection of installable packages, e.g. [The Python Standard
Library](https://docs.python.org/3/library/), or micropython-lib.
A *package* can refer to two things. The first meaning, "library package", is
something that can be installed from a library, e.g. via `mip` (or `pip` in
CPython/PyPI). Packages provide *modules* that can be imported. The ambiguity
here is that the module provided by the package does not necessarily have to
have the same name, e.g. the `pyjwt` package provides the `jwt` module. In
CPython, the `pyserial` package providing the `serial` module is another
common example.
A *module* is something that can be imported. For example, "the *os* module".
A module can be implemented either as a single file, typically also called
a *module* or "single-file module", or as a *package* (the second meaning),
which in this context means a directory containing multiple `.py` files
(usually at least an `__init__.py`).
In micropython-lib, we also have the concept of an *extension package* which
is a library package that extends the functionality of another package, by
adding additional files to the same package directory. These packages have
hyphenated names. For example, the `collections-defaultdict` package extends
the `collections` package to add the `defaultdict` class to the `collections`
module.
* https://github.com/micropython/micropython/issues/413

Wyświetl plik

@ -1,4 +0,0 @@
srctype=dummy
type=module
version=0.0.2
dist_name=future

Wyświetl plik

@ -1,18 +0,0 @@
import sys
# Remove current dir from sys.path, otherwise setuptools will peek up our
# module instead of system.
sys.path.pop(0)
from setuptools import setup
setup(name='micropython-future',
version='0.0.2',
description='Dummy __future__ module for MicroPython',
long_description='This is a dummy implementation of a module for MicroPython standard library.\nIt contains zero or very little functionality, and primarily intended to\navoid import errors (using idea that even if an application imports a\nmodule, it may be not using it onevery code path, so may work at least\npartially). It is expected that more complete implementation of the module\nwill be provided later. Please help with the development if you are\ninterested in this module.',
url='https://github.com/micropython/micropython/issues/405',
author='MicroPython Developers',
author_email='micro-python@googlegroups.com',
maintainer='MicroPython Developers',
maintainer_email='micro-python@googlegroups.com',
license='MIT',
py_modules=['__future__'])

Wyświetl plik

@ -1,7 +0,0 @@
dist_name = libc
srctype = micropython-lib
type = module
version = 0.3
author = Paul Sokolovsky
desc = MicroPython FFI helper module (deprecated)
long_desc = MicroPython FFI helper module (deprecated, replaced by micropython-ffilib).

Wyświetl plik

@ -1,18 +0,0 @@
import sys
# Remove current dir from sys.path, otherwise setuptools will peek up our
# module instead of system.
sys.path.pop(0)
from setuptools import setup
setup(name='micropython-libc',
version='0.3',
description='MicroPython FFI helper module (deprecated)',
long_description='MicroPython FFI helper module (deprecated, replaced by micropython-ffilib).',
url='https://github.com/micropython/micropython/issues/405',
author='Paul Sokolovsky',
author_email='micro-python@googlegroups.com',
maintainer='MicroPython Developers',
maintainer_email='micro-python@googlegroups.com',
license='MIT',
py_modules=['_libc'])

Wyświetl plik

@ -1,4 +0,0 @@
srctype = cpython
type = module
version = 3.3.3
depends = re-pcre

Wyświetl plik

@ -1,19 +0,0 @@
import sys
# Remove current dir from sys.path, otherwise setuptools will peek up our
# module instead of system.
sys.path.pop(0)
from setuptools import setup
setup(name='micropython-_markupbase',
version='3.3.3',
description='CPython _markupbase module ported to MicroPython',
long_description='This is a module ported from CPython standard library to be compatible with\nMicroPython interpreter. Usually, this means applying small patches for\nfeatures not supported (yet, or at all) in MicroPython. Sometimes, heavier\nchanges are required. Note that CPython modules are written with availability\nof vast resources in mind, and may not work for MicroPython ports with\nlimited heap. If you are affected by such a case, please help reimplement\nthe module from scratch.',
url='https://github.com/micropython/micropython/issues/405',
author='CPython Developers',
author_email='python-dev@python.org',
maintainer='MicroPython Developers',
maintainer_email='micro-python@googlegroups.com',
license='Python',
py_modules=['_markupbase'],
install_requires=['micropython-re-pcre'])

Wyświetl plik

@ -1,3 +0,0 @@
srctype=dummy
type=module
version=0.0.0

Wyświetl plik

@ -1,18 +0,0 @@
import sys
# Remove current dir from sys.path, otherwise setuptools will peek up our
# module instead of system.
sys.path.pop(0)
from setuptools import setup
setup(name='micropython-abc',
version='0.0.0',
description='Dummy abc module for MicroPython',
long_description='This is a dummy implementation of a module for MicroPython standard library.\nIt contains zero or very little functionality, and primarily intended to\navoid import errors (using idea that even if an application imports a\nmodule, it may be not using it onevery code path, so may work at least\npartially). It is expected that more complete implementation of the module\nwill be provided later. Please help with the development if you are\ninterested in this module.',
url='https://github.com/micropython/micropython/issues/405',
author='MicroPython Developers',
author_email='micro-python@googlegroups.com',
maintainer='MicroPython Developers',
maintainer_email='micro-python@googlegroups.com',
license='MIT',
py_modules=['abc'])

Wyświetl plik

@ -1,4 +0,0 @@
srctype = micropython-lib
type = module
version = 0.3.2
author = Damien George

Wyświetl plik

@ -1,18 +0,0 @@
import sys
# Remove current dir from sys.path, otherwise setuptools will peek up our
# module instead of system.
sys.path.pop(0)
from setuptools import setup
setup(name='micropython-argparse',
version='0.3.2',
description='argparse module for MicroPython',
long_description="This is a module reimplemented specifically for MicroPython standard library,\nwith efficient and lean design in mind. Note that this module is likely work\nin progress and likely supports just a subset of CPython's corresponding\nmodule. Please help with the development if you are interested in this\nmodule.",
url='https://github.com/micropython/micropython/issues/405',
author='Damien George',
author_email='micro-python@googlegroups.com',
maintainer='MicroPython Developers',
maintainer_email='micro-python@googlegroups.com',
license='MIT',
py_modules=['argparse'])

Wyświetl plik

@ -1,151 +0,0 @@
import time
import logging
log = logging.getLogger("asyncio")
# Workaround for not being able to subclass builtin types
class LoopStop(Exception):
pass
class InvalidStateError(Exception):
pass
# Object not matching any other object
_sentinel = []
class EventLoop:
def __init__(self):
self.q = []
def call_soon(self, c, *args):
self.q.append((c, args))
def call_later(self, delay, c, *args):
def _delayed(c, args, delay):
yield from sleep(delay)
self.call_soon(c, *args)
Task(_delayed(c, args, delay))
def run_forever(self):
while self.q:
c = self.q.pop(0)
try:
c[0](*c[1])
except LoopStop:
return
# I mean, forever
while True:
time.sleep(1)
def stop(self):
def _cb():
raise LoopStop
self.call_soon(_cb)
def run_until_complete(self, coro):
t = async(coro)
t.add_done_callback(lambda a: self.stop())
self.run_forever()
def close(self):
pass
_def_event_loop = EventLoop()
class Future:
def __init__(self, loop=_def_event_loop):
self.loop = loop
self.res = _sentinel
self.cbs = []
def result(self):
if self.res is _sentinel:
raise InvalidStateError
return self.res
def add_done_callback(self, fn):
if self.res is _sentinel:
self.cbs.append(fn)
else:
self.loop.call_soon(fn, self)
def set_result(self, val):
self.res = val
for f in self.cbs:
f(self)
class Task(Future):
def __init__(self, coro, loop=_def_event_loop):
super().__init__()
self.loop = loop
self.c = coro
# upstream asyncio forces task to be scheduled on instantiation
self.loop.call_soon(self)
def __call__(self):
try:
next(self.c)
self.loop.call_soon(self)
except StopIteration as e:
log.debug("Coro finished: %s", self.c)
self.set_result(None)
def get_event_loop():
return _def_event_loop
# Decorator
def coroutine(f):
return f
def async(coro):
if isinstance(coro, Future):
return coro
return Task(coro)
class _Wait(Future):
def __init__(self, n):
Future.__init__(self)
self.n = n
def _done(self):
self.n -= 1
log.debug("Wait: remaining tasks: %d", self.n)
if not self.n:
self.set_result(None)
def __call__(self):
pass
def wait(coro_list, loop=_def_event_loop):
w = _Wait(len(coro_list))
for c in coro_list:
t = async(c)
t.add_done_callback(lambda val: w._done())
return w
def sleep(secs):
t = time.time()
log.debug("Started sleep at: %s, targetting: %s", t, t + secs)
while time.time() < t + secs:
time.sleep(0.01)
yield
log.debug("Finished sleeping %ss", secs)

Wyświetl plik

@ -1,18 +0,0 @@
#https://docs.python.org/3.4/library/asyncio-task.html#example-chain-coroutines
#import asyncio
import asyncio_slow as asyncio
@asyncio.coroutine
def compute(x, y):
print("Compute %s + %s ..." % (x, y))
yield from asyncio.sleep(1.0)
return x + y
@asyncio.coroutine
def print_sum(x, y):
result = yield from compute(x, y)
print("%s + %s = %s" % (x, y, result))
loop = asyncio.get_event_loop()
loop.run_until_complete(print_sum(1, 2))
loop.close()

Wyświetl plik

@ -1,15 +0,0 @@
#https://docs.python.org/3.4/library/asyncio-task.html#example-chain-coroutines
#import asyncio
import asyncio_slow as asyncio
@asyncio.coroutine
def slow_operation(future):
yield from asyncio.sleep(1)
future.set_result('Future is done!')
loop = asyncio.get_event_loop()
future = asyncio.Future()
asyncio.Task(slow_operation(future))
loop.run_until_complete(future)
print(future.result())
loop.close()

Wyświetl plik

@ -1,21 +0,0 @@
#https://docs.python.org/3.4/library/asyncio-task.html#example-future-with-run-forever
#import asyncio
import asyncio_slow as asyncio
@asyncio.coroutine
def slow_operation(future):
yield from asyncio.sleep(1)
future.set_result('Future is done!')
def got_result(future):
print(future.result())
loop.stop()
loop = asyncio.get_event_loop()
future = asyncio.Future()
asyncio.Task(slow_operation(future))
future.add_done_callback(got_result)
try:
loop.run_forever()
finally:
loop.close()

Wyświetl plik

@ -1,12 +0,0 @@
#https://docs.python.org/3.4/library/asyncio-task.html#example-hello-world-coroutine
#import asyncio
import asyncio_slow as asyncio
@asyncio.coroutine
def greet_every_two_seconds():
while True:
print('Hello World')
yield from asyncio.sleep(2)
loop = asyncio.get_event_loop()
loop.run_until_complete(greet_every_two_seconds())

Wyświetl plik

@ -1,12 +0,0 @@
#import asyncio
import asyncio_slow as asyncio
@asyncio.coroutine
def greet_every_two_seconds():
while True:
print('Hello World')
yield from asyncio.sleep(2)
loop = asyncio.get_event_loop()
asyncio.Task(greet_every_two_seconds())
loop.run_forever()

Wyświetl plik

@ -1,11 +0,0 @@
# https://docs.python.org/3.4/library/asyncio-eventloop.html#example-hello-world-callback
#import asyncio
import asyncio_slow as asyncio
def print_and_repeat(loop):
print('Hello World')
loop.call_later(2, print_and_repeat, loop)
loop = asyncio.get_event_loop()
loop.call_soon(print_and_repeat, loop)
loop.run_forever()

Wyświetl plik

@ -1,21 +0,0 @@
#https://docs.python.org/3.4/library/asyncio-task.html#example-parallel-execution-of-tasks
#import asyncio
import asyncio_slow as asyncio
@asyncio.coroutine
def factorial(name, number):
f = 1
for i in range(2, number+1):
print("Task %s: Compute factorial(%s)..." % (name, i))
yield from asyncio.sleep(1)
f *= i
print("Task %s: factorial(%s) = %s" % (name, number, f))
tasks = [
asyncio.Task(factorial("A", 2)),
asyncio.Task(factorial("B", 3)),
asyncio.Task(factorial("C", 4))]
loop = asyncio.get_event_loop()
loop.run_until_complete(asyncio.wait(tasks))
loop.close()

Wyświetl plik

@ -1,4 +0,0 @@
srctype=cpython
type=module
version=3.3.3-2
depends = struct

Wyświetl plik

@ -1,19 +0,0 @@
import sys
# Remove current dir from sys.path, otherwise setuptools will peek up our
# module instead of system.
sys.path.pop(0)
from setuptools import setup
setup(name='micropython-base64',
version='3.3.3-2',
description='CPython base64 module ported to MicroPython',
long_description='This is a module ported from CPython standard library to be compatible with\nMicroPython interpreter. Usually, this means applying small patches for\nfeatures not supported (yet, or at all) in MicroPython. Sometimes, heavier\nchanges are required. Note that CPython modules are written with availability\nof vast resources in mind, and may not work for MicroPython ports with\nlimited heap. If you are affected by such a case, please help reimplement\nthe module from scratch.',
url='https://github.com/micropython/micropython/issues/405',
author='CPython Developers',
author_email='python-dev@python.org',
maintainer='MicroPython Developers',
maintainer_email='micro-python@googlegroups.com',
license='Python',
py_modules=['base64'],
install_requires=['micropython-struct'])

Wyświetl plik

@ -1,113 +0,0 @@
from ubinascii import *
if not "unhexlify" in globals():
def unhexlify(data):
if len(data) % 2 != 0:
raise ValueError("Odd-length string")
return bytes([ int(data[i:i+2], 16) for i in range(0, len(data), 2) ])
b2a_hex = hexlify
a2b_hex = unhexlify
# ____________________________________________________________
PAD = '='
table_a2b_base64 = [
-1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
-1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
-1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,62, -1,-1,-1,63,
52,53,54,55, 56,57,58,59, 60,61,-1,-1, -1,-1,-1,-1, # Note PAD->-1 here
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11,12,13,14,
15,16,17,18, 19,20,21,22, 23,24,25,-1, -1,-1,-1,-1,
-1,26,27,28, 29,30,31,32, 33,34,35,36, 37,38,39,40,
41,42,43,44, 45,46,47,48, 49,50,51,-1, -1,-1,-1,-1,
-1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
-1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
-1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
-1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
-1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
-1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
-1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
-1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
]
def _transform(n):
if n == -1:
return '\xff'
else:
return chr(n)
table_a2b_base64 = ''.join(map(_transform, table_a2b_base64))
assert len(table_a2b_base64) == 256
def a2b_base64(ascii):
"Decode a line of base64 data."
res = []
quad_pos = 0
leftchar = 0
leftbits = 0
last_char_was_a_pad = False
for c in ascii:
c = chr(c)
if c == PAD:
if quad_pos > 2 or (quad_pos == 2 and last_char_was_a_pad):
break # stop on 'xxx=' or on 'xx=='
last_char_was_a_pad = True
else:
n = ord(table_a2b_base64[ord(c)])
if n == 0xff:
continue # ignore strange characters
#
# Shift it in on the low end, and see if there's
# a byte ready for output.
quad_pos = (quad_pos + 1) & 3
leftchar = (leftchar << 6) | n
leftbits += 6
#
if leftbits >= 8:
leftbits -= 8
res.append((leftchar >> leftbits).to_bytes(1))
leftchar &= ((1 << leftbits) - 1)
#
last_char_was_a_pad = False
else:
if leftbits != 0:
raise Exception("Incorrect padding")
return b''.join(res)
# ____________________________________________________________
table_b2a_base64 = (
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")
def b2a_base64(bin):
"Base64-code line of data."
newlength = (len(bin) + 2) // 3
newlength = newlength * 4 + 1
res = []
leftchar = 0
leftbits = 0
for c in bin:
# Shift into our buffer, and output any 6bits ready
leftchar = (leftchar << 8) | c
leftbits += 8
res.append(table_b2a_base64[(leftchar >> (leftbits-6)) & 0x3f])
leftbits -= 6
if leftbits >= 6:
res.append(table_b2a_base64[(leftchar >> (leftbits-6)) & 0x3f])
leftbits -= 6
#
if leftbits == 2:
res.append(table_b2a_base64[(leftchar & 3) << 4])
res.append(PAD)
res.append(PAD)
elif leftbits == 4:
res.append(table_b2a_base64[(leftchar & 0xf) << 2])
res.append(PAD)
res.append('\n')
return ''.join(res).encode('ascii')

Wyświetl plik

@ -1,3 +0,0 @@
srctype=pypy
type=module
version=2.4.0-3

Wyświetl plik

@ -1,18 +0,0 @@
import sys
# Remove current dir from sys.path, otherwise setuptools will peek up our
# module instead of system.
sys.path.pop(0)
from setuptools import setup
setup(name='micropython-binascii',
version='2.4.0-3',
description='PyPy binascii module ported to MicroPython',
long_description='This is a module ported from PyPy standard library to be compatible with\nMicroPython interpreter. Usually, this means applying small patches for\nfeatures not supported (yet, or at all) in MicroPython. Sometimes, heavier\nchanges are required. Note that CPython modules are written with availability\nof vast resources in mind, and may not work for MicroPython ports with\nlimited heap. If you are affected by such a case, please help reimplement\nthe module from scratch.',
url='https://github.com/micropython/micropython/issues/405',
author='PyPy Developers',
author_email='pypy-dev@python.org',
maintainer='MicroPython Developers',
maintainer_email='micro-python@googlegroups.com',
license='MIT',
py_modules=['binascii'])

Wyświetl plik

Wyświetl plik

@ -1,3 +0,0 @@
srctype=dummy
type=module
version=0.0.1

Wyświetl plik

@ -1,18 +0,0 @@
import sys
# Remove current dir from sys.path, otherwise setuptools will peek up our
# module instead of system.
sys.path.pop(0)
from setuptools import setup
setup(name='micropython-binhex',
version='0.0.1',
description='Dummy binhex module for MicroPython',
long_description='This is a dummy implementation of a module for MicroPython standard library.\nIt contains zero or very little functionality, and primarily intended to\navoid import errors (using idea that even if an application imports a\nmodule, it may be not using it onevery code path, so may work at least\npartially). It is expected that more complete implementation of the module\nwill be provided later. Please help with the development if you are\ninterested in this module.',
url='https://github.com/micropython/micropython/issues/405',
author='MicroPython Developers',
author_email='micro-python@googlegroups.com',
maintainer='MicroPython Developers',
maintainer_email='micro-python@googlegroups.com',
license='MIT',
py_modules=['binhex'])

Wyświetl plik

@ -1,23 +0,0 @@
import sys
# Remove current dir from sys.path, otherwise distutils will peek up our
# module instead of system.
sys.path.pop(0)
from setuptools import setup
def desc_dummy(name):
return 'Dummy %s module to MicroPython' % name
def desc_cpython(name):
return 'CPython %s module ported to MicroPython' % name
NAME = 'bisect'
setup(name='micropython-' + NAME,
version='0.5',
description=desc_cpython(NAME),
url='https://github.com/micropython/micropython/issues/405',
author='CPython Developers',
maintainer='MicroPython Developers',
maintainer_email='micro-python@googlegroups.com',
license='Python',
py_modules=[NAME])

Wyświetl plik

@ -1,3 +0,0 @@
srctype=dummy
type=module
version=0.0.0

Wyświetl plik

@ -1,18 +0,0 @@
import sys
# Remove current dir from sys.path, otherwise setuptools will peek up our
# module instead of system.
sys.path.pop(0)
from setuptools import setup
setup(name='micropython-calendar',
version='0.0.0',
description='Dummy calendar module for MicroPython',
long_description='This is a dummy implementation of a module for MicroPython standard library.\nIt contains zero or very little functionality, and primarily intended to\navoid import errors (using idea that even if an application imports a\nmodule, it may be not using it onevery code path, so may work at least\npartially). It is expected that more complete implementation of the module\nwill be provided later. Please help with the development if you are\ninterested in this module.',
url='https://github.com/micropython/micropython/issues/405',
author='MicroPython Developers',
author_email='micro-python@googlegroups.com',
maintainer='MicroPython Developers',
maintainer_email='micro-python@googlegroups.com',
license='MIT',
py_modules=['calendar'])

Wyświetl plik

@ -1,3 +0,0 @@
srctype=cpython
type=module
version=3.3.3-1

Wyświetl plik

@ -1,18 +0,0 @@
import sys
# Remove current dir from sys.path, otherwise setuptools will peek up our
# module instead of system.
sys.path.pop(0)
from setuptools import setup
setup(name='micropython-cgi',
version='3.3.3-1',
description='CPython cgi module ported to MicroPython',
long_description='This is a module ported from CPython standard library to be compatible with\nMicroPython interpreter. Usually, this means applying small patches for\nfeatures not supported (yet, or at all) in MicroPython. Sometimes, heavier\nchanges are required. Note that CPython modules are written with availability\nof vast resources in mind, and may not work for MicroPython ports with\nlimited heap. If you are affected by such a case, please help reimplement\nthe module from scratch.',
url='https://github.com/micropython/micropython/issues/405',
author='CPython Developers',
author_email='python-dev@python.org',
maintainer='MicroPython Developers',
maintainer_email='micro-python@googlegroups.com',
license='Python',
py_modules=['cgi'])

Wyświetl plik

@ -1,3 +0,0 @@
srctype = cpython
type = module
version = 3.4.0-1

Wyświetl plik

@ -1,18 +0,0 @@
import sys
# Remove current dir from sys.path, otherwise setuptools will peek up our
# module instead of system.
sys.path.pop(0)
from setuptools import setup
setup(name='micropython-cmd',
version='3.4.0-1',
description='CPython cmd module ported to MicroPython',
long_description='This is a module ported from CPython standard library to be compatible with\nMicroPython interpreter. Usually, this means applying small patches for\nfeatures not supported (yet, or at all) in MicroPython. Sometimes, heavier\nchanges are required. Note that CPython modules are written with availability\nof vast resources in mind, and may not work for MicroPython ports with\nlimited heap. If you are affected by such a case, please help reimplement\nthe module from scratch.',
url='https://github.com/micropython/micropython/issues/405',
author='CPython Developers',
author_email='python-dev@python.org',
maintainer='MicroPython Developers',
maintainer_email='micro-python@googlegroups.com',
license='Python',
py_modules=['cmd'])

Wyświetl plik

@ -1,4 +0,0 @@
srctype = micropython-lib
type = package
version = 0.2.1
author = Paul Sokolovsky

Wyświetl plik

@ -1,18 +0,0 @@
import sys
# Remove current dir from sys.path, otherwise setuptools will peek up our
# module instead of system.
sys.path.pop(0)
from setuptools import setup
setup(name='micropython-collections.defaultdict',
version='0.2.1',
description='collections.defaultdict module for MicroPython',
long_description="This is a module reimplemented specifically for MicroPython standard library,\nwith efficient and lean design in mind. Note that this module is likely work\nin progress and likely supports just a subset of CPython's corresponding\nmodule. Please help with the development if you are interested in this\nmodule.",
url='https://github.com/micropython/micropython/issues/405',
author='Paul Sokolovsky',
author_email='micro-python@googlegroups.com',
maintainer='MicroPython Developers',
maintainer_email='micro-python@googlegroups.com',
license='MIT',
packages=['collections'])

Wyświetl plik

@ -1,37 +0,0 @@
class deque:
def __init__(self, iterable=None):
if iterable is None:
self.q = []
else:
self.q = list(iterable)
def popleft(self):
return self.q.pop(0)
def popright(self):
return self.q.pop()
def pop(self):
return self.q.pop()
def append(self, a):
self.q.append(a)
def appendleft(self, a):
self.q.insert(0, a)
def extend(self, a):
self.q.extend(a)
def __len__(self):
return len(self.q)
def __bool__(self):
return bool(self.q)
def __iter__(self):
yield from self.q
def __str__(self):
return 'deque({})'.format(self.q)

Wyświetl plik

@ -1,3 +0,0 @@
srctype = micropython-lib
type = package
version = 0.1.2

Wyświetl plik

@ -1,18 +0,0 @@
import sys
# Remove current dir from sys.path, otherwise setuptools will peek up our
# module instead of system.
sys.path.pop(0)
from setuptools import setup
setup(name='micropython-collections.deque',
version='0.1.2',
description='collections.deque module for MicroPython',
long_description="This is a module reimplemented specifically for MicroPython standard library,\nwith efficient and lean design in mind. Note that this module is likely work\nin progress and likely supports just a subset of CPython's corresponding\nmodule. Please help with the development if you are interested in this\nmodule.",
url='https://github.com/micropython/micropython/issues/405',
author='MicroPython Developers',
author_email='micro-python@googlegroups.com',
maintainer='MicroPython Developers',
maintainer_email='micro-python@googlegroups.com',
license='MIT',
packages=['collections'])

Wyświetl plik

@ -1,16 +0,0 @@
# Should be reimplemented for MicroPython
# Reason:
# CPython implementation brings in metaclasses and other bloat.
# This is going to be just import-all for other modules in a namespace package
from ucollections import *
try:
from .defaultdict import defaultdict
except ImportError:
pass
try:
from .deque import deque
except ImportError:
pass
class MutableMapping:
pass

Wyświetl plik

@ -1,3 +0,0 @@
srctype = micropython-lib
type = package
version = 0.1.1

Wyświetl plik

@ -1,18 +0,0 @@
import sys
# Remove current dir from sys.path, otherwise setuptools will peek up our
# module instead of system.
sys.path.pop(0)
from setuptools import setup
setup(name='micropython-collections',
version='0.1.1',
description='collections module for MicroPython',
long_description="This is a module reimplemented specifically for MicroPython standard library,\nwith efficient and lean design in mind. Note that this module is likely work\nin progress and likely supports just a subset of CPython's corresponding\nmodule. Please help with the development if you are interested in this\nmodule.",
url='https://github.com/micropython/micropython/issues/405',
author='MicroPython Developers',
author_email='micro-python@googlegroups.com',
maintainer='MicroPython Developers',
maintainer_email='micro-python@googlegroups.com',
license='MIT',
packages=['collections'])

Wyświetl plik

@ -1,3 +0,0 @@
srctype=dummy
type=package
version=0.0.0

Wyświetl plik

@ -1,18 +0,0 @@
import sys
# Remove current dir from sys.path, otherwise setuptools will peek up our
# module instead of system.
sys.path.pop(0)
from setuptools import setup
setup(name='micropython-concurrent.futures',
version='0.0.0',
description='Dummy concurrent.futures module for MicroPython',
long_description='This is a dummy implementation of a module for MicroPython standard library.\nIt contains zero or very little functionality, and primarily intended to\navoid import errors (using idea that even if an application imports a\nmodule, it may be not using it onevery code path, so may work at least\npartially). It is expected that more complete implementation of the module\nwill be provided later. Please help with the development if you are\ninterested in this module.',
url='https://github.com/micropython/micropython/issues/405',
author='MicroPython Developers',
author_email='micro-python@googlegroups.com',
maintainer='MicroPython Developers',
maintainer_email='micro-python@googlegroups.com',
license='MIT',
packages=['concurrent'])

Wyświetl plik

@ -1,5 +0,0 @@
srctype = cpython
type = module
version = 3.4.2-3
long_desc = Port of contextlib for micropython
depends = ucontextlib, collections

Wyświetl plik

@ -1,19 +0,0 @@
import sys
# Remove current dir from sys.path, otherwise setuptools will peek up our
# module instead of system.
sys.path.pop(0)
from setuptools import setup
setup(name='micropython-contextlib',
version='3.4.2-3',
description='CPython contextlib module ported to MicroPython',
long_description='This is a module ported from CPython standard library to be compatible with\nMicroPython interpreter. Usually, this means applying small patches for\nfeatures not supported (yet, or at all) in MicroPython. Sometimes, heavier\nchanges are required. Note that CPython modules are written with availability\nof vast resources in mind, and may not work for MicroPython ports with\nlimited heap. If you are affected by such a case, please help reimplement\nthe module from scratch.',
url='https://github.com/micropython/micropython/issues/405',
author='CPython Developers',
author_email='python-dev@python.org',
maintainer='MicroPython Developers',
maintainer_email='micro-python@googlegroups.com',
license='Python',
py_modules=['contextlib'],
install_requires=['micropython-ucontextlib', 'micropython-collections'])

Wyświetl plik

@ -1,16 +0,0 @@
import sys
# Remove current dir from sys.path, otherwise distutils will peek up our
# copy module instead of system.
sys.path.pop(0)
from setuptools import setup
setup(name='micropython-copy',
version='0.0.2',
description='CPython copy module ported to MicroPython',
url='https://github.com/micropython/micropython/issues/405',
author='CPython Developers',
maintainer='MicroPython Developers',
maintainer_email='micro-python@googlegroups.com',
license='Python',
install_requires=['micropython-types'],
py_modules=['copy'])

Wyświetl plik

@ -1,21 +0,0 @@
import uasyncio as asyncio
def run1():
for i in range(1):
print('Hello World')
yield from asyncio.sleep(2)
print("run1 finished")
def run2():
for i in range(3):
print('bar')
yield run1()
yield from asyncio.sleep(1)
import logging
logging.basicConfig(level=logging.INFO)
loop = asyncio.get_event_loop()
loop.create_task(run2())
loop.run_forever()

Wyświetl plik

@ -1,3 +0,0 @@
srctype = cpython-backport
type = module
version = 0.2

Wyświetl plik

@ -1,27 +0,0 @@
This patch shows changes done to asyncio.tasks.Task._step() from CPython 3.4.2.
--- tasks.py 2015-01-01 10:51:40.707114866 +0200
+++ uasyncio.py 2015-01-01 10:54:20.172402890 +0200
@@ -46,13 +55,16 @@
# Bare yield relinquishes control for one event loop iteration.
self._loop.call_soon(self._step)
elif inspect.isgenerator(result):
+ #print("Scheduling", result)
+ self._loop.create_task(result)
+ self._loop.call_soon(self._step)
# Yielding a generator is just wrong.
- self._loop.call_soon(
- self._step, None,
- RuntimeError(
- 'yield was used instead of yield from for '
- 'generator in task {!r} with {}'.format(
- self, result)))
+# self._loop.call_soon(
+# self._step, None,
+# RuntimeError(
+# 'yield was used instead of yield from for '
+# 'generator in task {!r} with {}'.format(
+# self, result)))
else:
# Yielding something else is an error.
self._loop.call_soon(

Wyświetl plik

@ -1,18 +0,0 @@
import sys
# Remove current dir from sys.path, otherwise setuptools will peek up our
# module instead of system.
sys.path.pop(0)
from setuptools import setup
setup(name='micropython-cpython-uasyncio',
version='0.2',
description='MicroPython module uasyncio ported to CPython',
long_description='This is MicroPython compatibility module, allowing applications using\nMicroPython-specific features to run on CPython.\n',
url='https://github.com/micropython/micropython/issues/405',
author='MicroPython Developers',
author_email='micro-python@googlegroups.com',
maintainer='MicroPython Developers',
maintainer_email='micro-python@googlegroups.com',
license='Python',
py_modules=['uasyncio'])

Wyświetl plik

@ -1,99 +0,0 @@
import inspect
import asyncio
import asyncio.futures as futures
from asyncio import *
OrgTask = Task
class Task(OrgTask):
def _step(self, value=None, exc=None):
assert not self.done(), \
'_step(): already done: {!r}, {!r}, {!r}'.format(self, value, exc)
if self._must_cancel:
if not isinstance(exc, futures.CancelledError):
exc = futures.CancelledError()
self._must_cancel = False
coro = self._coro
self._fut_waiter = None
self.__class__._current_tasks[self._loop] = self
# Call either coro.throw(exc) or coro.send(value).
try:
if exc is not None:
result = coro.throw(exc)
elif value is not None:
result = coro.send(value)
else:
result = next(coro)
except StopIteration as exc:
self.set_result(exc.value)
except futures.CancelledError as exc:
super().cancel() # I.e., Future.cancel(self).
except Exception as exc:
self.set_exception(exc)
except BaseException as exc:
self.set_exception(exc)
raise
else:
if isinstance(result, futures.Future):
# Yielded Future must come from Future.__iter__().
if result._blocking:
result._blocking = False
result.add_done_callback(self._wakeup)
self._fut_waiter = result
if self._must_cancel:
if self._fut_waiter.cancel():
self._must_cancel = False
else:
self._loop.call_soon(
self._step, None,
RuntimeError(
'yield was used instead of yield from '
'in task {!r} with {!r}'.format(self, result)))
elif result is None:
# Bare yield relinquishes control for one event loop iteration.
self._loop.call_soon(self._step)
elif inspect.isgenerator(result):
#print("Scheduling", result)
self._loop.create_task(result)
self._loop.call_soon(self._step)
# Yielding a generator is just wrong.
# self._loop.call_soon(
# self._step, None,
# RuntimeError(
# 'yield was used instead of yield from for '
# 'generator in task {!r} with {}'.format(
# self, result)))
else:
# Yielding something else is an error.
self._loop.call_soon(
self._step, None,
RuntimeError(
'Task got bad yield: {!r}'.format(result)))
finally:
self.__class__._current_tasks.pop(self._loop)
self = None # Needed to break cycles when an exception occurs.
asyncio.tasks.Task = Task
OrgStreamWriter = StreamWriter
class StreamWriter(OrgStreamWriter):
def awrite(self, data):
if isinstance(data, str):
data = data.encode("utf-8")
self.write(data)
yield from self.drain()
def aclose(self):
self.close()
return
yield
asyncio.streams.StreamWriter = StreamWriter

Wyświetl plik

Wyświetl plik

@ -1,3 +0,0 @@
srctype = dummy
type = module
version = 0.0.0

Wyświetl plik

@ -1,18 +0,0 @@
import sys
# Remove current dir from sys.path, otherwise setuptools will peek up our
# module instead of system.
sys.path.pop(0)
from setuptools import setup
setup(name='micropython-csv',
version='0.0.0',
description='Dummy csv module for MicroPython',
long_description='This is a dummy implementation of a module for MicroPython standard library.\nIt contains zero or very little functionality, and primarily intended to\navoid import errors (using idea that even if an application imports a\nmodule, it may be not using it onevery code path, so may work at least\npartially). It is expected that more complete implementation of the module\nwill be provided later. Please help with the development if you are\ninterested in this module.',
url='https://github.com/micropython/micropython/issues/405',
author='MicroPython Developers',
author_email='micro-python@googlegroups.com',
maintainer='MicroPython Developers',
maintainer_email='micro-python@googlegroups.com',
license='MIT',
py_modules=['csv'])

Wyświetl plik

@ -1,99 +0,0 @@
"""Constants and membership tests for ASCII characters"""
NUL = 0x00 # ^@
SOH = 0x01 # ^A
STX = 0x02 # ^B
ETX = 0x03 # ^C
EOT = 0x04 # ^D
ENQ = 0x05 # ^E
ACK = 0x06 # ^F
BEL = 0x07 # ^G
BS = 0x08 # ^H
TAB = 0x09 # ^I
HT = 0x09 # ^I
LF = 0x0a # ^J
NL = 0x0a # ^J
VT = 0x0b # ^K
FF = 0x0c # ^L
CR = 0x0d # ^M
SO = 0x0e # ^N
SI = 0x0f # ^O
DLE = 0x10 # ^P
DC1 = 0x11 # ^Q
DC2 = 0x12 # ^R
DC3 = 0x13 # ^S
DC4 = 0x14 # ^T
NAK = 0x15 # ^U
SYN = 0x16 # ^V
ETB = 0x17 # ^W
CAN = 0x18 # ^X
EM = 0x19 # ^Y
SUB = 0x1a # ^Z
ESC = 0x1b # ^[
FS = 0x1c # ^\
GS = 0x1d # ^]
RS = 0x1e # ^^
US = 0x1f # ^_
SP = 0x20 # space
DEL = 0x7f # delete
controlnames = [
"NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL",
"BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI",
"DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB",
"CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US",
"SP"
]
def _ctoi(c):
if type(c) == type(""):
return ord(c)
else:
return c
def isalnum(c): return isalpha(c) or isdigit(c)
def isalpha(c): return isupper(c) or islower(c)
def isascii(c): return _ctoi(c) <= 127 # ?
def isblank(c): return _ctoi(c) in (8,32)
def iscntrl(c): return _ctoi(c) <= 31
def isdigit(c): return _ctoi(c) >= 48 and _ctoi(c) <= 57
def isgraph(c): return _ctoi(c) >= 33 and _ctoi(c) <= 126
def islower(c): return _ctoi(c) >= 97 and _ctoi(c) <= 122
def isprint(c): return _ctoi(c) >= 32 and _ctoi(c) <= 126
def ispunct(c): return _ctoi(c) != 32 and not isalnum(c)
def isspace(c): return _ctoi(c) in (9, 10, 11, 12, 13, 32)
def isupper(c): return _ctoi(c) >= 65 and _ctoi(c) <= 90
def isxdigit(c): return isdigit(c) or \
(_ctoi(c) >= 65 and _ctoi(c) <= 70) or (_ctoi(c) >= 97 and _ctoi(c) <= 102)
def isctrl(c): return _ctoi(c) < 32
def ismeta(c): return _ctoi(c) > 127
def ascii(c):
if type(c) == type(""):
return chr(_ctoi(c) & 0x7f)
else:
return _ctoi(c) & 0x7f
def ctrl(c):
if type(c) == type(""):
return chr(_ctoi(c) & 0x1f)
else:
return _ctoi(c) & 0x1f
def alt(c):
if type(c) == type(""):
return chr(_ctoi(c) | 0x80)
else:
return _ctoi(c) | 0x80
def unctrl(c):
bits = _ctoi(c)
if bits == 0x7f:
rep = "^?"
elif isprint(bits & 0x7f):
rep = chr(bits & 0x7f)
else:
rep = "^" + chr(((bits & 0x7f) | 0x20) + 0x20)
if bits & 0x80:
return "!" + rep
return rep

Wyświetl plik

@ -1,3 +0,0 @@
srctype = cpython
type = package
version = 3.4.2

Wyświetl plik

@ -1,18 +0,0 @@
import sys
# Remove current dir from sys.path, otherwise setuptools will peek up our
# module instead of system.
sys.path.pop(0)
from setuptools import setup
setup(name='micropython-curses.ascii',
version='3.4.2',
description='CPython curses.ascii module ported to MicroPython',
long_description='This is a module ported from CPython standard library to be compatible with\nMicroPython interpreter. Usually, this means applying small patches for\nfeatures not supported (yet, or at all) in MicroPython. Sometimes, heavier\nchanges are required. Note that CPython modules are written with availability\nof vast resources in mind, and may not work for MicroPython ports with\nlimited heap. If you are affected by such a case, please help reimplement\nthe module from scratch.',
url='https://github.com/micropython/micropython/issues/405',
author='CPython Developers',
author_email='python-dev@python.org',
maintainer='MicroPython Developers',
maintainer_email='micro-python@googlegroups.com',
license='Python',
packages=['curses'])

Wyświetl plik

@ -1,3 +0,0 @@
srctype=dummy
type=module
version=0.0.1

Wyświetl plik

@ -1,18 +0,0 @@
import sys
# Remove current dir from sys.path, otherwise setuptools will peek up our
# module instead of system.
sys.path.pop(0)
from setuptools import setup
setup(name='micropython-datetime',
version='0.0.1',
description='Dummy datetime module for MicroPython',
long_description='This is a dummy implementation of a module for MicroPython standard library.\nIt contains zero or very little functionality, and primarily intended to\navoid import errors (using idea that even if an application imports a\nmodule, it may be not using it onevery code path, so may work at least\npartially). It is expected that more complete implementation of the module\nwill be provided later. Please help with the development if you are\ninterested in this module.',
url='https://github.com/micropython/micropython/issues/405',
author='MicroPython Developers',
author_email='micro-python@googlegroups.com',
maintainer='MicroPython Developers',
maintainer_email='micro-python@googlegroups.com',
license='MIT',
py_modules=['datetime'])

Wyświetl plik

Wyświetl plik

@ -1,3 +0,0 @@
srctype=dummy
type=module
version=0.0.1

Wyświetl plik

@ -1,18 +0,0 @@
import sys
# Remove current dir from sys.path, otherwise setuptools will peek up our
# module instead of system.
sys.path.pop(0)
from setuptools import setup
setup(name='micropython-dbm',
version='0.0.1',
description='Dummy dbm module for MicroPython',
long_description='This is a dummy implementation of a module for MicroPython standard library.\nIt contains zero or very little functionality, and primarily intended to\navoid import errors (using idea that even if an application imports a\nmodule, it may be not using it onevery code path, so may work at least\npartially). It is expected that more complete implementation of the module\nwill be provided later. Please help with the development if you are\ninterested in this module.',
url='https://github.com/micropython/micropython/issues/405',
author='MicroPython Developers',
author_email='micro-python@googlegroups.com',
maintainer='MicroPython Developers',
maintainer_email='micro-python@googlegroups.com',
license='MIT',
py_modules=['dbm'])

Wyświetl plik

@ -1,3 +0,0 @@
srctype=dummy
type=module
version=0.0.1

Wyświetl plik

@ -1,18 +0,0 @@
import sys
# Remove current dir from sys.path, otherwise setuptools will peek up our
# module instead of system.
sys.path.pop(0)
from setuptools import setup
setup(name='micropython-decimal',
version='0.0.1',
description='Dummy decimal module for MicroPython',
long_description='This is a dummy implementation of a module for MicroPython standard library.\nIt contains zero or very little functionality, and primarily intended to\navoid import errors (using idea that even if an application imports a\nmodule, it may be not using it onevery code path, so may work at least\npartially). It is expected that more complete implementation of the module\nwill be provided later. Please help with the development if you are\ninterested in this module.',
url='https://github.com/micropython/micropython/issues/405',
author='MicroPython Developers',
author_email='micro-python@googlegroups.com',
maintainer='MicroPython Developers',
maintainer_email='micro-python@googlegroups.com',
license='MIT',
py_modules=['decimal'])

Wyświetl plik

@ -1,3 +0,0 @@
srctype=dummy
type=module
version=0.0.1

Wyświetl plik

@ -1,18 +0,0 @@
import sys
# Remove current dir from sys.path, otherwise setuptools will peek up our
# module instead of system.
sys.path.pop(0)
from setuptools import setup
setup(name='micropython-difflib',
version='0.0.1',
description='Dummy difflib module for MicroPython',
long_description='This is a dummy implementation of a module for MicroPython standard library.\nIt contains zero or very little functionality, and primarily intended to\navoid import errors (using idea that even if an application imports a\nmodule, it may be not using it onevery code path, so may work at least\npartially). It is expected that more complete implementation of the module\nwill be provided later. Please help with the development if you are\ninterested in this module.',
url='https://github.com/micropython/micropython/issues/405',
author='MicroPython Developers',
author_email='micro-python@googlegroups.com',
maintainer='MicroPython Developers',
maintainer_email='micro-python@googlegroups.com',
license='MIT',
py_modules=['difflib'])

Wyświetl plik

@ -1,4 +0,0 @@
srctype = cpython
type = package
version = 0.5
depends = functools, email.encoders, email.errors

Wyświetl plik

@ -1,19 +0,0 @@
import sys
# Remove current dir from sys.path, otherwise setuptools will peek up our
# module instead of system.
sys.path.pop(0)
from setuptools import setup
setup(name='micropython-email.charset',
version='0.5',
description='CPython email.charset module ported to MicroPython',
long_description='This is a module ported from CPython standard library to be compatible with\nMicroPython interpreter. Usually, this means applying small patches for\nfeatures not supported (yet, or at all) in MicroPython. Sometimes, heavier\nchanges are required. Note that CPython modules are written with availability\nof vast resources in mind, and may not work for MicroPython ports with\nlimited heap. If you are affected by such a case, please help reimplement\nthe module from scratch.',
url='https://github.com/micropython/micropython/issues/405',
author='CPython Developers',
author_email='python-dev@python.org',
maintainer='MicroPython Developers',
maintainer_email='micro-python@googlegroups.com',
license='Python',
packages=['email'],
install_requires=['micropython-functools', 'micropython-email.encoders', 'micropython-email.errors'])

Wyświetl plik

@ -1,4 +0,0 @@
srctype = cpython
type = package
version = 0.5
depends = base64, binascii, quopri, re-pcre, string

Wyświetl plik

@ -1,19 +0,0 @@
import sys
# Remove current dir from sys.path, otherwise setuptools will peek up our
# module instead of system.
sys.path.pop(0)
from setuptools import setup
setup(name='micropython-email.encoders',
version='0.5',
description='CPython email.encoders module ported to MicroPython',
long_description='This is a module ported from CPython standard library to be compatible with\nMicroPython interpreter. Usually, this means applying small patches for\nfeatures not supported (yet, or at all) in MicroPython. Sometimes, heavier\nchanges are required. Note that CPython modules are written with availability\nof vast resources in mind, and may not work for MicroPython ports with\nlimited heap. If you are affected by such a case, please help reimplement\nthe module from scratch.',
url='https://github.com/micropython/micropython/issues/405',
author='CPython Developers',
author_email='python-dev@python.org',
maintainer='MicroPython Developers',
maintainer_email='micro-python@googlegroups.com',
license='Python',
packages=['email'],
install_requires=['micropython-base64', 'micropython-binascii', 'micropython-quopri', 'micropython-re-pcre', 'micropython-string'])

Wyświetl plik

@ -1,3 +0,0 @@
srctype = cpython
type = package
version = 0.5

Wyświetl plik

@ -1,18 +0,0 @@
import sys
# Remove current dir from sys.path, otherwise setuptools will peek up our
# module instead of system.
sys.path.pop(0)
from setuptools import setup
setup(name='micropython-email.errors',
version='0.5',
description='CPython email.errors module ported to MicroPython',
long_description='This is a module ported from CPython standard library to be compatible with\nMicroPython interpreter. Usually, this means applying small patches for\nfeatures not supported (yet, or at all) in MicroPython. Sometimes, heavier\nchanges are required. Note that CPython modules are written with availability\nof vast resources in mind, and may not work for MicroPython ports with\nlimited heap. If you are affected by such a case, please help reimplement\nthe module from scratch.',
url='https://github.com/micropython/micropython/issues/405',
author='CPython Developers',
author_email='python-dev@python.org',
maintainer='MicroPython Developers',
maintainer_email='micro-python@googlegroups.com',
license='Python',
packages=['email'])

Wyświetl plik

@ -1,4 +0,0 @@
srctype = cpython
type = package
version = 0.5
depends = re-pcre, email.errors, email.message, email.internal

Wyświetl plik

@ -1,19 +0,0 @@
import sys
# Remove current dir from sys.path, otherwise setuptools will peek up our
# module instead of system.
sys.path.pop(0)
from setuptools import setup
setup(name='micropython-email.feedparser',
version='0.5',
description='CPython email.feedparser module ported to MicroPython',
long_description='This is a module ported from CPython standard library to be compatible with\nMicroPython interpreter. Usually, this means applying small patches for\nfeatures not supported (yet, or at all) in MicroPython. Sometimes, heavier\nchanges are required. Note that CPython modules are written with availability\nof vast resources in mind, and may not work for MicroPython ports with\nlimited heap. If you are affected by such a case, please help reimplement\nthe module from scratch.',
url='https://github.com/micropython/micropython/issues/405',
author='CPython Developers',
author_email='python-dev@python.org',
maintainer='MicroPython Developers',
maintainer_email='micro-python@googlegroups.com',
license='Python',
packages=['email'],
install_requires=['micropython-re-pcre', 'micropython-email.errors', 'micropython-email.message', 'micropython-email.internal'])

Wyświetl plik

@ -1,4 +0,0 @@
srctype = cpython
type = package
version = 0.5.1
depends = re-pcre, binascii, email.encoders, email.errors, email.charset

Wyświetl plik

@ -1,19 +0,0 @@
import sys
# Remove current dir from sys.path, otherwise setuptools will peek up our
# module instead of system.
sys.path.pop(0)
from setuptools import setup
setup(name='micropython-email.header',
version='0.5.1',
description='CPython email.header module ported to MicroPython',
long_description='This is a module ported from CPython standard library to be compatible with\nMicroPython interpreter. Usually, this means applying small patches for\nfeatures not supported (yet, or at all) in MicroPython. Sometimes, heavier\nchanges are required. Note that CPython modules are written with availability\nof vast resources in mind, and may not work for MicroPython ports with\nlimited heap. If you are affected by such a case, please help reimplement\nthe module from scratch.',
url='https://github.com/micropython/micropython/issues/405',
author='CPython Developers',
author_email='python-dev@python.org',
maintainer='MicroPython Developers',
maintainer_email='micro-python@googlegroups.com',
license='Python',
packages=['email'],
install_requires=['micropython-re-pcre', 'micropython-binascii', 'micropython-email.encoders', 'micropython-email.errors', 'micropython-email.charset'])

Wyświetl plik

@ -1,4 +0,0 @@
srctype = cpython
type = package
version = 0.5
depends = re-pcre, base64, binascii, functools, string, calendar, abc, email.errors, email.header, email.charset, email.utils

Wyświetl plik

@ -1,19 +0,0 @@
import sys
# Remove current dir from sys.path, otherwise setuptools will peek up our
# module instead of system.
sys.path.pop(0)
from setuptools import setup
setup(name='micropython-email.internal',
version='0.5',
description='CPython email.internal module ported to MicroPython',
long_description='This is a module ported from CPython standard library to be compatible with\nMicroPython interpreter. Usually, this means applying small patches for\nfeatures not supported (yet, or at all) in MicroPython. Sometimes, heavier\nchanges are required. Note that CPython modules are written with availability\nof vast resources in mind, and may not work for MicroPython ports with\nlimited heap. If you are affected by such a case, please help reimplement\nthe module from scratch.',
url='https://github.com/micropython/micropython/issues/405',
author='CPython Developers',
author_email='python-dev@python.org',
maintainer='MicroPython Developers',
maintainer_email='micro-python@googlegroups.com',
license='Python',
packages=['email'],
install_requires=['micropython-re-pcre', 'micropython-base64', 'micropython-binascii', 'micropython-functools', 'micropython-string', 'micropython-calendar', 'micropython-abc', 'micropython-email.errors', 'micropython-email.header', 'micropython-email.charset', 'micropython-email.utils'])

Wyświetl plik

@ -1,4 +0,0 @@
srctype = cpython
type = package
version = 0.5.2
depends = re-pcre, uu, base64, binascii, email.utils, email.errors, email.charset

Wyświetl plik

@ -1,19 +0,0 @@
import sys
# Remove current dir from sys.path, otherwise setuptools will peek up our
# module instead of system.
sys.path.pop(0)
from setuptools import setup
setup(name='micropython-email.message',
version='0.5.2',
description='CPython email.message module ported to MicroPython',
long_description='This is a module ported from CPython standard library to be compatible with\nMicroPython interpreter. Usually, this means applying small patches for\nfeatures not supported (yet, or at all) in MicroPython. Sometimes, heavier\nchanges are required. Note that CPython modules are written with availability\nof vast resources in mind, and may not work for MicroPython ports with\nlimited heap. If you are affected by such a case, please help reimplement\nthe module from scratch.',
url='https://github.com/micropython/micropython/issues/405',
author='CPython Developers',
author_email='python-dev@python.org',
maintainer='MicroPython Developers',
maintainer_email='micro-python@googlegroups.com',
license='Python',
packages=['email'],
install_requires=['micropython-re-pcre', 'micropython-uu', 'micropython-base64', 'micropython-binascii', 'micropython-email.utils', 'micropython-email.errors', 'micropython-email.charset'])

Wyświetl plik

@ -1,4 +0,0 @@
srctype = cpython
type = package
version = 0.5
depends = warnings, email.feedparser, email.message, email.internal

Wyświetl plik

@ -1,19 +0,0 @@
import sys
# Remove current dir from sys.path, otherwise setuptools will peek up our
# module instead of system.
sys.path.pop(0)
from setuptools import setup
setup(name='micropython-email.parser',
version='0.5',
description='CPython email.parser module ported to MicroPython',
long_description='This is a module ported from CPython standard library to be compatible with\nMicroPython interpreter. Usually, this means applying small patches for\nfeatures not supported (yet, or at all) in MicroPython. Sometimes, heavier\nchanges are required. Note that CPython modules are written with availability\nof vast resources in mind, and may not work for MicroPython ports with\nlimited heap. If you are affected by such a case, please help reimplement\nthe module from scratch.',
url='https://github.com/micropython/micropython/issues/405',
author='CPython Developers',
author_email='python-dev@python.org',
maintainer='MicroPython Developers',
maintainer_email='micro-python@googlegroups.com',
license='Python',
packages=['email'],
install_requires=['micropython-warnings', 'micropython-email.feedparser', 'micropython-email.message', 'micropython-email.internal'])

Wyświetl plik

@ -1,4 +0,0 @@
srctype = cpython
type = package
version = 3.3.3-1
depends = os, re-pcre, base64, random, datetime, urllib.parse, warnings, quopri, email.charset

Wyświetl plik

@ -1,19 +0,0 @@
import sys
# Remove current dir from sys.path, otherwise setuptools will peek up our
# module instead of system.
sys.path.pop(0)
from setuptools import setup
setup(name='micropython-email.utils',
version='3.3.3-1',
description='CPython email.utils module ported to MicroPython',
long_description='This is a module ported from CPython standard library to be compatible with\nMicroPython interpreter. Usually, this means applying small patches for\nfeatures not supported (yet, or at all) in MicroPython. Sometimes, heavier\nchanges are required. Note that CPython modules are written with availability\nof vast resources in mind, and may not work for MicroPython ports with\nlimited heap. If you are affected by such a case, please help reimplement\nthe module from scratch.',
url='https://github.com/micropython/micropython/issues/405',
author='CPython Developers',
author_email='python-dev@python.org',
maintainer='MicroPython Developers',
maintainer_email='micro-python@googlegroups.com',
license='Python',
packages=['email'],
install_requires=['micropython-os', 'micropython-re-pcre', 'micropython-base64', 'micropython-random', 'micropython-datetime', 'micropython-urllib.parse', 'micropython-warnings', 'micropython-quopri', 'micropython-email.charset'])

Wyświetl plik

@ -1,38 +0,0 @@
EPERM = 1 # Operation not permitted
ENOENT = 2 # No such file or directory
ESRCH = 3 # No such process
EINTR = 4 # Interrupted system call
EIO = 5 # I/O error
ENXIO = 6 # No such device or address
E2BIG = 7 # Argument list too long
ENOEXEC = 8 # Exec format error
EBADF = 9 # Bad file number
ECHILD = 10 # No child processes
EAGAIN = 11 # Try again
ENOMEM = 12 # Out of memory
EACCES = 13 # Permission denied
EFAULT = 14 # Bad address
ENOTBLK = 15 # Block device required
EBUSY = 16 # Device or resource busy
EEXIST = 17 # File exists
EXDEV = 18 # Cross-device link
ENODEV = 19 # No such device
ENOTDIR = 20 # Not a directory
EISDIR = 21 # Is a directory
EINVAL = 22 # Invalid argument
ENFILE = 23 # File table overflow
EMFILE = 24 # Too many open files
ENOTTY = 25 # Not a typewriter
ETXTBSY = 26 # Text file busy
EFBIG = 27 # File too large
ENOSPC = 28 # No space left on device
ESPIPE = 29 # Illegal seek
EROFS = 30 # Read-only file system
EMLINK = 31 # Too many links
EPIPE = 32 # Broken pipe
EDOM = 33 # Math argument out of domain of func
ERANGE = 34 # Math result not representable
EAFNOSUPPORT = 97 # Address family not supported by protocol
ECONNRESET = 104 # Connection timed out
ETIMEDOUT = 110 # Connection timed out
EINPROGRESS = 115 # Operation now in progress

Some files were not shown because too many files have changed in this diff Show More