Package: lbutils-mp
LBUtilsBackgroundThis library is designed to install all of the common drivers, library code, and
helper code used within modules at Leeds Beckett University. It is principally
targeted at MicroPython on the Pico H/W micro-controllers: but compatibility is
also maintained with CPython 3.10 where possible (or relevant).Examples for how to use the library can be found in the 'examples' folder: orin the documentation. Otherwise the library is
organised as followsdrivers: Classes aimed at low-level support of I2C, SPI and other devices requiring board-level support.graphics: Classes providing support for drawing and text output on display devices.helpers: Functions and classes which help replace boiler-plate code for tasks such as setting up network access.pmod: Drivers and support for theDigilent peripheral modules.InstallationA package of this library is provided on PyPi aslbutils. This can be installed with the
normal Python tools, and should also install to boards running MicroPython underThonny.For manual installation, everything under thelbutilsdirectory should be
copied to the appropriate directory on the MicroPython board, usually/lib.
The library, or individual drivers, can then be imported as normal: see the
documentation for theexamplesfor more detailed
guidance on the use of the library. This code is also available in thelbutils/examplesfolder, or as the librarylbutils.exampleswhen the package
is installed.ContributionsReleases are pulled from thetrunk, and development should be undertaken in
branches to ensure that the code intrunkremains in working order. This
library is principally a teaching library, so theDocumentationshould be at least as important
as the 'code'. Where possible all algorithms and implementation techniques
should also be explained as fully as possible, or at least linked to reference
standards/implementations.For consistencyAll code should also be in the format standardised by theBlacklibrary. This makes it easier to
co-ordinate external code and documentation with the implementation documented
here.Note:The'future' styleofblackbreaks the current (3.4) parser for MicroPython. Until this changes, only the'current' styleshould be used.Code should passruffcleanly, with exceptions
documented in thepyproject.tomlfile. Modern (Python > 3.10) conventions
should be respected where possible: except where these conflict with thesyntax accepted by MicroPython.
In particular all libraries, functions and methods should have a type signature;
dummy libraries should be used to support this where possible (seetyping.pyin
thelbutilsdirectory).Code is documented according to theNumPydocumentation
standard, and should be provided as standard Python docstrings. The docstrings
are considered to be authoritative, and will be used to automatically document
the class/method/etc.Docstrings should bein NumPy
format, and should be
checked bydocformatterfor
correctness. Code documentation is generated byMkDocs, using the embedded docstrings in the code.All documentation, including documentation strings, should be in the [Markdown
format accepted byMkDocs,
and will be automatically rebuilt on commit. A basic check for documentation
sanity can be done viadocformatter --in-place --config ./pyproject.tomlAll documentation should be organised according to theDiátaxisframework: ideally with examples that do not
require specific board set-ups. Where specific set-up are required, platforms
such asWokWishould be used where possible to illustrate
code and example set-ups.Tools such asdarglintmight also
be useful (and are installed with the defaultrequirements.txt). However
currentlydarglinthas minimal support for the NumPy documentation standard,
and so the output ofdarglintshould be used with caution.Where possible the above should be/is enforced by the use of apre-commit
hookforgit. The scripthook.shin thebindirectory is provided for this purpose, and can be installed ascd .git/hooks; ln -s ../../bin/hook.sh pre-commitfrom the project directory.Known ImplementationsRaspberry Pi Pico H/W (MicroPython 3.4)CPython (3.10)