@tigerpython/robotics-libraries
v1.4.2
Published
TigerJython robotics modules (micro:bit, Calliope mini) with minified and raw Python sources, plus a typed JS/TS API for easy integration.
Maintainers
Readme
TigerJython Robotics Libraries
This repository contains all TigerJython robotics modules (for micro:bit and Calliope mini boards), along with a minification script. Minification keeps memory usage low on the microcontrollers themselves. The package ships both the minified and the original, human-readable source for every library, plus a small typed JS/TS API, so it can be dropped into other applications without vendoring the repo as a git submodule.
Install
From the npm registry:
npm install @tigerpython/robotics-librariesDirectly from this git repository (e.g. to track main or pin a specific commit/tag/branch instead of a published version). This requires Python 3 with python-minifier available, since installing from git triggers a full rebuild (see Development):
npm install git+ssh://[email protected]/public-dkomm/webtp/robotics_libraries.git
# or pinned to a tag/branch/commit:
npm install git+ssh://[email protected]/public-dkomm/webtp/robotics_libraries.git#v1.4.0(github.com/Tiger-Jython/Robotics-Libraries is a read-only mirror of this repository; GitLab is the canonical source.)
Usage
Typed API
import { getLibrary, getRawLibrary, listLibraries, listDevices } from "@tigerpython/robotics-libraries";
listDevices(); // ["calliope", "microbit"]
listLibraries("calliope"); // ["callibot", "callibotmot", ..., "cputils"]
getLibrary("microbit", "mbrobot"); // minified source
getRawLibrary("microbit", "mbrobot"); // original, unminified sourceThe full library maps are also exported directly if you'd rather work with the plain objects:
import {
calliopeLibraries, calliopeRawLibraries,
microbitLibraries, microbitRawLibraries,
} from "@tigerpython/robotics-libraries";Raw .py files
Every device's original .py sources are published as part of the package and reachable via subpath exports, so bundlers that support raw/text imports (e.g. Vite) can import them directly instead of going through the JS API:
import cpglowSource from "@tigerpython/robotics-libraries/calliope/cpglow.py?raw";Attribution
The following files are taken from the APLU Libraries
- callibot.py
- callibotmot.py
- cbalarm.py
- cpglow.py
- cpmike.py
- cprover.py
- cputils.py
- mbalarm.py
- mbglow.py
- mbled
- mbrobot_plus.py
- mbrobot_plusV2
- mbrobotmot
Development
Regenerating the minified/raw JSON bundles requires Python 3 with python-minifier installed:
pip install python-minifier
npm run build # regenerates calliope/ and microbit/ JSON + minified .py, then builds dist/dist/, libraries.json, and libraries.raw.json are all build artifacts, not checked into git — npm install regenerates them automatically (via the prepare script), and npm publish regenerates them again just before packing (via prepublishOnly).
A pre-commit hook (via husky) runs the Python minification step automatically and stages the regenerated min/*.py files.
Releasing
Releases are published manually — there's no CI automation for this. npm's Trusted Publishing (tokenless OIDC) currently only supports GitLab.com's shared runners, not self-hosted instances like this one, so a stored publish token isn't worth the added risk for now.
# update CHANGELOG first, then:
npm version patch # or: minor / major
git push --follow-tags
npm run build
npm publish