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, rv64imc, host, debug
-march-flags=<flags> : set architecture-specific flags (can be either a dec/hex/bin value or a string)
                       supported flags for rv32imc: zba

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.27.0.post2-py2.py3-none-win_amd64.whl (1.2 MB view details)

Uploaded Python 2Python 3Windows x86-64

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

Uploaded Python 2Python 3Windows x86

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

Uploaded Python 2Python 3

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

Uploaded Python 2Python 3

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

Uploaded Python 2Python 3

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

Uploaded Python 2Python 3

mpy_cross-1.27.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.27.0.post2-py2.py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for mpy_cross-1.27.0.post2-py2.py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 c2a4060b256c0946a51630511507678a4cca3ad071b4f60583c34742e3a692d5
MD5 a36536c1c0d1ca055d6c2b007f3e0c3a
BLAKE2b-256 30ad3bcdc53142c0058a44b5b9036142896af882ccf406982f29c259c7b8136c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.27.0.post2-py2.py3-none-win32.whl
Algorithm Hash digest
SHA256 1379497695e1a75087e43ce06c4044a6385f5fc28ed9073921d98b49322caad6
MD5 e7d352a9308af11aa3377dfc310203ae
BLAKE2b-256 324e6f18221bd52df032914aa489ce78cd8dc353c8f7b8f03a9cd585563f1c7e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.27.0.post2-py2.py3-none-manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 d66d2b265cc1ec65f223019e721a9a66d8a999ad656cea31e3e0145e406e4d0b
MD5 a05e0bdac8983dcb4a2ae9ef29b51954
BLAKE2b-256 7ca5feac9c5a51e5fca35c9ee5069819721949de6cdbf79f6e270e705a48e835

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.27.0.post2-py2.py3-none-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d0454bf49ce6a4cd4b67a51c3ff43cc1040d12bec05adbcb20209e2983d75d83
MD5 d2c8739eebdd48c13de0472c2de660b6
BLAKE2b-256 889e7b21955c32d286ae2ee0b13a4b9909445931ec326442141f4aed63323a7f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.27.0.post2-py2.py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 28821aeaac4e2b1e365605afc0c0767505be4f4acded4f652c07d8f76b9409a6
MD5 c29b80a3ddb8eba936d93d54d6bde185
BLAKE2b-256 ea9622553824dad4f7b3a9dc1fb437b0edf37bb09d17ce0ecb6bc7a209326477

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.27.0.post2-py2.py3-none-manylinux1_i686.whl
Algorithm Hash digest
SHA256 d264ab8fef6c21cd7d842c8d3e9bea59694fefadd8f529bf93a168e25c201c0a
MD5 9a10dd89e5d0b34b5d32c0ce094e3f6c
BLAKE2b-256 ed54098d4c292c555be8746e53bbadd5a0060550d7694518771a1da0a7cf06f3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.27.0.post2-py2.py3-none-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 9a7a7027d58c336a98f4d78eb43da42f5a23d81be268e113e8f0b863ec7849fc
MD5 9defc210c9457da5b5a1750d8f480c72
BLAKE2b-256 e58248b9dd1ed5fe739ca94a122a5d957150c661ffc8e274d4541fada83eda1f

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