User Tools

Site Tools


micropython

MicroPython

MicroPython is a small implementation of a subset of Python 3 intended for use in microcontrollers. MicroPython can also be embedded as a scripting engine in other applications. See the MicroPython Website.

Packages

femm-qt's implementation of MicroPython supports the following packages:

1. Compiled into femm-qt (22)

No files, always present:

  • femm
  • numpy
  • scipy
  • ulab
  • math
  • cmath
  • array
  • struct
  • collections
  • io
  • os
  • sys
  • gc
  • time
  • json
  • random
  • binascii
  • hashlib
  • errno
  • builtins
  • micropython

numpy and scipy here are ulab, not the real packages — a deliberate subset. In-process numpy exposes 122 names including linalg, fft and random; scipy gives integrate, linalg, optimize, signal, special. Enough for ordinary array work and the linear algebra femm-qt added on top (complex eig/qr/svd/solve, an int32 dtype), but not the full API.

2. Pure Python, shipped and on sys.path (30)

  • abc
  • argparse
  • base64
  • bisect
  • contextlib
  • copy
  • csv
  • datetime
  • fnmatch
  • functools
  • glob
  • heapq
  • inspect
  • itertools
  • logging
  • operator
  • pathlib
  • pickle
  • pprint
  • re
  • shutil
  • stat
  • string
  • tempfile
  • textwrap
  • traceback
  • types
  • ucontextlib

sys.path is '' | <app>/bin/python | %APPDATA%\FEMM\python — that last one is yours, for your own modules.

3. Bridged to CPython (3+)

The packages:

  • matplotlib
  • xlsxwriter
  • zipfile
  • pandas

are bridged to the local CPython install, but they are shimmed in such a way that they appeared to be installed locally. For example,
import matplotlib works.

Other packages that do not have shims are still available through pybridge.import_module(), which takes any module name. For example:

import pybridge
np = pybridge.import_module(“numpy”) # the real one, not ulab
opt = pybridge.import_module(“scipy.optimize”)

micropython.txt · Last modified: by admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki