Skip to main content

micropython mpy-cross distribution

Project description

mpy-cross is the micropython cross compiler utility, used to pre-compile python files into bytecode (mpy files) suitable for running on your target.

For more details about mpy file / format see https://docs.micropython.org/en/latest/reference/mpyfiles.html

This project compiles mpy-cross for windows, linux and macos and distributes them in python wheels for easy installation on development pc’s:

pip install mpy-cross

Version

The release version of this package directly corresponds to the micropython release it’s built against.

If a wrapper update is needed for a particular release version, it will be updloaded with a .postN version

Weekly releases build against master should be available at: https://gitlab.com/alelec/mpy_cross/pipelines These will have version numbers that reflect the previous release and the current git hash built against.

Usage

mpy-cross package can be run in various different ways

  • As per normal mpy-cross app

    mpy-cross my_app.py
    mpy-cross --help
  • From python command line

    python -m mpy_cross <args>
    python -m mpy_cross --help
  • From python code

    import mpy_cross
    
    mpy_cross.run(*args, **kwargs)
    
    import subprocess
    proc = mpy_cross.run('--version', stdout=subprocess.PIPE)

where *args are arguments passed to mpy-cross, **kwargs are arguments to pass to subprocess.Popen() internally

  • Standalone

    # Print out path to actual mpy-cross binary
    python -c "import mpy_cross; print(mpy_cross.mpy_cross)"
    > /home/andrew/.local/share/virtualenvs/mpy_cross-gSGkki0d/lib/python3.5/site-packages/mpy_cross/mpy-cross
    /home/corona/.local/share/virtualenvs/mpy_cross-gSGkki0d/lib/python3.5/site-packages/mpy_cross/mpy-cross --version

Older Version Support

This package also supports running mpy-cross in compatibility mode to generage mpy files for older releases of micropython. Compatibility mode can be specified either by micropython version, eg.:

mpy-cross --compat 1.19 my_app.py

Or by specifying the bytecode version, eg:

mpy-cross --bytecode 6 my_app.py

mpy-cross options

usage: mpy-cross [<opts>] [-X <implopt>] [--] <input filename>
Options:
-c <version> : --compat <version> : Run mpy-cross in compatibility mode for given micropython version.
-b <version> : --bytecode <version> : Output specific bytecode version for use with older micropython versions.
--version : show version information
-o : output file for compiled bytecode (defaults to input filename with .mpy extension, or stdout if input is stdin)
-s : source filename to embed in the compiled bytecode (defaults to input file)
-v : verbose (trace various operations); can be multiple
-O[N] : apply bytecode optimizations of level N

Target specific options:
-msmall-int-bits=number : set the maximum bits used to encode a small-int
-march=<arch> : set architecture for native emitter;
                x86, x64, armv6, armv6m, armv7m, armv7em, armv7emsp, armv7emdp, xtensa, xtensawin, rv32imc, host, debug

Implementation specific options:
  emit={bytecode,native,viper} -- set the default code emitter
  heapsize=<n> -- set the heap size for the GC (default 2097152)

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

mpy_cross-1.26.0.post2-py2.py3-none-win_amd64.whl (1.2 MB view details)

Uploaded Python 2Python 3Windows x86-64

mpy_cross-1.26.0.post2-py2.py3-none-win32.whl (1.1 MB view details)

Uploaded Python 2Python 3Windows x86

mpy_cross-1.26.0.post2-py2.py3-none-manylinux2014_armv7l.whl (1.1 MB view details)

Uploaded Python 2Python 3

mpy_cross-1.26.0.post2-py2.py3-none-manylinux2014_aarch64.whl (1.2 MB view details)

Uploaded Python 2Python 3

mpy_cross-1.26.0.post2-py2.py3-none-manylinux1_x86_64.whl (1.1 MB view details)

Uploaded Python 2Python 3

mpy_cross-1.26.0.post2-py2.py3-none-manylinux1_i686.whl (1.0 MB view details)

Uploaded Python 2Python 3

mpy_cross-1.26.0.post2-py2.py3-none-macosx_11_0_universal2.whl (1.8 MB view details)

Uploaded Python 2Python 3macOS 11.0+ universal2 (ARM64, x86-64)

File details

Details for the file mpy_cross-1.26.0.post2-py2.py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for mpy_cross-1.26.0.post2-py2.py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 8a7934eacd1e836842d84b1767f66c4a5cf3e726257e8bfce88b77521e7de129
MD5 e540d9fdebd93d7000b46e6f69513f22
BLAKE2b-256 a1ffccc3bb6ecc2c541b758d6ddec0fa46dc0c90eefa0c3d5f7e06e95a3e239f

See more details on using hashes here.

File details

Details for the file mpy_cross-1.26.0.post2-py2.py3-none-win32.whl.

File metadata

File hashes

Hashes for mpy_cross-1.26.0.post2-py2.py3-none-win32.whl
Algorithm Hash digest
SHA256 ceb46497b62afb035d64cc6467260d947ebd5574d8bc2360903c3fa3f6a1249b
MD5 dcb834c6a19f42c3ffa9f551b504322f
BLAKE2b-256 6488de2e2922dd1429b9b1c6b9f58869caf8559f8a8ec26c76349483781ae57b

See more details on using hashes here.

File details

Details for the file mpy_cross-1.26.0.post2-py2.py3-none-manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for mpy_cross-1.26.0.post2-py2.py3-none-manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 a4c4eede3483be43ed9195300f0f7c413b5100f26e0eb276566695e8c9cda5f8
MD5 7f734ddd621beeefc8a48aafbeecdc0f
BLAKE2b-256 3aa58baef3ac6fe08b6f8f89a627859f41b9e3aeafe214f1c8dbae90d1de4c09

See more details on using hashes here.

File details

Details for the file mpy_cross-1.26.0.post2-py2.py3-none-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for mpy_cross-1.26.0.post2-py2.py3-none-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 35785ac7aa236d810b13e89c24dd161cf844e9b73d7cb6f803822e4a2e794e4e
MD5 630879b18460137249c643153d1f3b51
BLAKE2b-256 642659eaa10bd108e029825ec35163742cfb37268ac8815ea096e9debb811f68

See more details on using hashes here.

File details

Details for the file mpy_cross-1.26.0.post2-py2.py3-none-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for mpy_cross-1.26.0.post2-py2.py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 7b264766c8435c867c398bf4790b2491ea19ea87149c928d31c4c605cec1791d
MD5 8c53c873375d573d9d35265fe20b8a01
BLAKE2b-256 fcb1d6fdcc66e49dba3c2c1941fd95b41136a2301a0317ad46095fe52710416f

See more details on using hashes here.

File details

Details for the file mpy_cross-1.26.0.post2-py2.py3-none-manylinux1_i686.whl.

File metadata

File hashes

Hashes for mpy_cross-1.26.0.post2-py2.py3-none-manylinux1_i686.whl
Algorithm Hash digest
SHA256 d6ac23317895d81f6dddf7176e5d9c0edc22f0c374f2e8b4cc983559b65eecf5
MD5 6b1e0ac4259c0c2706085d23a4afab03
BLAKE2b-256 cfaf878432ccf58ac35579fbb9cba7d104441dff2404a24da757f06b76e6c0a8

See more details on using hashes here.

File details

Details for the file mpy_cross-1.26.0.post2-py2.py3-none-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for mpy_cross-1.26.0.post2-py2.py3-none-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 117e2ef7aa14fbdc391f6bb13e0f84adbbf2f81746d5808cbb28f8c0e99b7bd4
MD5 9c692a34325e5312c4b65c15539691ff
BLAKE2b-256 0aa679f35ef572e900aaed5e0314f7c14b53f742d90b9ee6480f4eaa07247291

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