Skip to main content

MicroPython distribution package for pysm

Project description

upysm

upysm is the MicroPython publishing wrapper for pysm. It does not maintain a fork of the library source. A release build fetches the selected pysm source distribution, copies the MicroPython package files into a temporary staging tree, and publishes matching upip and mip artifacts with the same version number.

Build

Install the release tools:

python3 -m pip install -r requirements.txt

Build the latest published pysm release:

python3 -m scripts.build_upysm --pysm-version latest --check --smoke

Build a selected version:

python3 -m scripts.build_upysm --pysm-version 0.4.0 --check --smoke

The default core package profile copies only pysm/__init__.py, pysm/pysm.py, and pysm/version.py, which keeps the device package aligned with the small MicroPython runtime. Use --package-profile all to copy every Python module from the selected pysm package.

The build writes two install shapes:

dist/upysm-<version>.tar.gz  # PyPI/upip source distribution
site/                        # static mip package tree for GitHub Pages

Publish

Publishing is handled by the Publish GitHub Actions workflow. Run it manually, select latest or an explicit pysm version, and the workflow will build, check, smoke test, publish the matching upysm sdist to PyPI using trusted publishing, and publish the mip package tree to the gh-pages branch.

Configure GitHub Pages once to serve the gh-pages branch from /.

For a local upload:

python3 -m scripts.build_upysm --pysm-version 0.4.0 --check
python3 -m twine upload dist/upysm-0.4.0.tar.gz

Install on MicroPython

Modern mip/mpremote install:

mpremote mip install https://pgularski.github.io/upysm/
mpremote mip install https://pgularski.github.io/upysm/0.4.0/

From the REPL:

import mip
mip.install('https://pgularski.github.io/upysm/')

Legacy upip install:

import upip
upip.install('upysm')

Smoke Example

from pysm import Event, State, StateMachine

on = State('on')
off = State('off')

sm = StateMachine('sm')
sm.add_state(on, initial=True)
sm.add_state(off)
sm.add_transition(on, off, events=['off'])
sm.add_transition(off, on, events=['on'])
sm.initialize()

assert sm.state == on
sm.dispatch(Event('off'))
assert sm.state == off
sm.dispatch(Event('on'))
assert sm.state == on

For full API docs, see the pysm documentation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

upysm-0.4.0.tar.gz (13.6 kB view details)

Uploaded Source

File details

Details for the file upysm-0.4.0.tar.gz.

File metadata

  • Download URL: upysm-0.4.0.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for upysm-0.4.0.tar.gz
Algorithm Hash digest
SHA256 8fc8fe2adbd099ba0b70f9431726841ae6135aceacb75956df76167e309d3247
MD5 02a34b7b2d12766c484b9ec55aa52312
BLAKE2b-256 814b8e18afbb746d7514b799db13c161dfb439d483b51ca2e1c61fbaa15dffe0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page