python-ecosys: Move urequests to python-ecosys.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
pull/376/head
Jim Mussared 2021-05-27 16:53:02 +10:00
rodzic bc2b6b0b7f
commit 35e3c9e4ff
6 zmienionych plików z 8 dodań i 31 usunięć

Wyświetl plik

@ -4,45 +4,30 @@ micropython-lib
This is a repository of libraries designed to be useful for writing This is a repository of libraries designed to be useful for writing
MicroPython applications. MicroPython applications.
The libraries here fall into roughly four categories: The libraries here fall into four categories corresponding to the four top-level directories:
* Compatible ports of CPython standard libraries. These should be drop-in replacements for the CPython libraries, although many have reduced functionality or missing methods or classes (which may not be an issue for many use cases). * **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 Python libraries, although many have reduced functionality or missing methods or classes (which may not be an issue for many most cases).
* "Micro" versions of CPython standard libraries with limited compatibility. These can often provide the same functionality, but might require some code changes compared to the CPython version. * **python-ecosys**: Compatible, but reduced-functionality versions of modules from the larger Python ecosystem, for example that might be found in the [Python Package Index](https://pypi.org/).
* MicroPython-specific libraries. These include drivers and other libraries targeted at running Python on hardware or embedded systems. * **micropython**: MicroPython-specific modules that do not have equivalents in other Python environments. These are typically hardware drivers or highly-optimised alternative implementations of functionality available in other Python modules.
* MicroPython-on-Unix-specific libraries. These extend the functionality of the Unix port to allow access to operating-system level functionality (which allows more CPython compatibility). * **unix-ffi**: These modules are specifically for the MicroPython Unix port and provide access to operating-system and third-party libraries via FFI.
Usage Usage
----- -----
Many libraries are self contained modules, and you can quickly get started by Many libraries are self contained modules, and you can quickly get started by
copying the relevant Python file to your device. For example, to add the copying the relevant Python file to your device. For example, to add the
`base64` library, you can directly copy `base64/base64.py` to the `lib` `base64` library, you can directly copy `python-stdlib/base64/base64.py` to the `lib`
directory on your device. directory on your device.
Other libraries are packages, in which case 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. Other libraries are packages, in which case 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.
For devices that have network connectivity (e.g. PYBD, ESP8266, ESP32), they
will have the `upip` module installed.
```
>>> import upip
>>> upip.install('micropython-base64')
>>> upip.install('micropython-collections.defaultdict')
...
>>> import base64
>>> base64.b64decode('aGVsbG8sIG1pY3JvcHl0aG9u')
b'hello, micropython'
>>> from collections import defaultdict
>>> d = defaultdict(int)
>>> d[a] += 1
```
Future plans (and new contributor ideas) Future plans (and new contributor ideas)
---------------------------------------- ----------------------------------------
* Provide compiled .mpy distributions. * Provide compiled .mpy distributions.
* Develop a set of example programs using these libraries. * Develop a set of example programs using these libraries.
* Develop more MicroPython libraries for common tasks. * Develop more MicroPython libraries for common tasks.
* Provide a replacement for the previous `upip` tool.

Wyświetl plik

@ -5,14 +5,6 @@ The libraries in this directory aim to provide compatible implementations of
standard libraries to allow existing Python code to run un-modified on standard libraries to allow existing Python code to run un-modified on
MicroPython. MicroPython.
Compatibility ranges from:
* Many commonly-used methods and classes are provided with identical runtime semantics.
* A subset of methods and classes, with identical semantics for most use cases.
* Additional constants not provided in the main firmware (to keep size down).
* Stub methods and classes required to make code load without error, but may lead to runtime errors.
Implementation Implementation
-------------- --------------
@ -21,7 +13,7 @@ CPython implementation. (e.g. `collections.defaultdict`)
Some libraries are based on or extend from the built-in "micro" modules in the Some libraries are based on or extend from the built-in "micro" modules in the
MicroPython firmware, providing additional functionality that didn't need to MicroPython firmware, providing additional functionality that didn't need to
be written in C. (e.g. `socket`, `struct`) be written in C (e.g. `collections`, `socket`, `struct`).
Future plans (ideas for contributors): Future plans (ideas for contributors):