![]() 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 '**'. |
||
---|---|---|
.github/workflows | ||
micropython | ||
python-ecosys | ||
python-stdlib | ||
tools | ||
unix-ffi | ||
.gitignore | ||
CONTRIBUTING.md | ||
LICENSE | ||
README.md |
README.md
micropython-lib
This is a repository of libraries designed to be useful for writing MicroPython applications.
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. 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).
-
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.
-
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.
Usage
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.
Future plans (and new contributor ideas)
- 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.