Skip to content

top: Reorganise micropython-lib #376

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
May 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 4 additions & 4 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -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 ===============
Expand Down
16 changes: 0 additions & 16 deletions Makefile

This file was deleted.

80 changes: 20 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,73 +1,33 @@
micropython-lib
===============
micropython-lib is a project to develop a non-monolothic standard library
for "advanced" MicroPython fork (https://github.com/pfalcon/micropython).
Each module or package is available as a separate distribution package from
PyPI. Each module comes from one of the following sources (and thus each
module has its own licensing terms):

* written from scratch specifically for MicroPython
* ported from CPython
* ported from some other Python implementation, e.g. PyPy
* some modules actually aren't implemented yet and are dummy
This is a repository of libraries designed to be useful for writing
MicroPython applications.

Note that the main target of micropython-lib is a "Unix" port of the
aforementioned fork of MicroPython. Actual system requirements vary per
module. Majority of modules are compatible with the upstream MicroPython,
though some may require additional functionality/optimizations present in
the "advanced" fork. Modules not related to I/O may also work without
problems on bare-metal ports, not just on "Unix" port (e.g. pyboard).
The libraries here fall into four categories corresponding to the four top-level directories:

* **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).

Usage
-----
micropython-lib packages are published on PyPI (Python Package Index),
the standard Python community package repository: https://pypi.org/ .
On PyPI, you can search for MicroPython related packages and read
additional package information. By convention, all micropython-lib package
names are prefixed with "micropython-" (the reverse is not true - some
package starting with "micropython-" aren't part of micropython-lib and
were released by 3rd parties).

Browse available packages [via this
URL](https://pypi.org/search/?q=&o=&c=Programming+Language+%3A%3A+Python+%3A%3A+Implementation+%3A%3A+MicroPython).

To install packages from PyPI for usage on your local system, use the
`upip` tool, which is MicroPython's native package manager, similar to
`pip`, which is used to install packages for CPython. `upip` is bundled
with MicroPython "Unix" port (i.e. if you build "Unix" port, you
automatically have `upip` tool). Following examples assume that
`micropython` binary is available on your `PATH`:

~~~~
$ micropython -m upip install micropython-pystone
...
$ micropython
>>> import pystone
>>> pystone.main()
Pystone(1.2) time for 50000 passes = 0.534
This machine benchmarks at 93633 pystones/second
~~~~
* **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/).

Run `micropython -m upip --help` for more information about `upip`.
* **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.

* **unix-ffi**: These modules are specifically for the MicroPython Unix port and provide access to operating-system and third-party libraries via FFI.

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.


Links
Usage
-----
If you would like to trace evolution of MicroPython packaging support,
you may find following links useful (note that they may contain outdated
information):

* https://github.com/micropython/micropython/issues/405
* http://forum.micropython.org/viewtopic.php?f=5&t=70
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
`base64` library, you can directly copy `python-stdlib/base64/base64.py` to the `lib`
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.

Guidelines for packaging MicroPython modules for PyPI:
Future plans (and new contributor ideas)
----------------------------------------

* https://github.com/micropython/micropython/issues/413
* Provide compiled .mpy distributions.
* Develop a set of example programs using these libraries.
* Develop more MicroPython libraries for common tasks.
* Provide a replacement for the previous `upip` tool.
20 changes: 0 additions & 20 deletions __future__/setup.py

This file was deleted.

20 changes: 0 additions & 20 deletions _libc/setup.py

This file was deleted.

21 changes: 0 additions & 21 deletions _markupbase/setup.py

This file was deleted.

20 changes: 0 additions & 20 deletions abc/setup.py

This file was deleted.

20 changes: 0 additions & 20 deletions argparse/setup.py

This file was deleted.

3 changes: 0 additions & 3 deletions array/metadata.txt

This file was deleted.

20 changes: 0 additions & 20 deletions array/setup.py

This file was deleted.

3 changes: 0 additions & 3 deletions asyncio/metadata.txt

This file was deleted.

20 changes: 0 additions & 20 deletions asyncio/setup.py

This file was deleted.

Loading