Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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 comma-separated flags string)
                       supported flags for rv32imc: zba, zcmp

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

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

Uploaded Python 2Python 3Windows x86-64

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

Uploaded Python 2Python 3Windows x86

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

Uploaded Python 2Python 3

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

Uploaded Python 2Python 3

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

Uploaded Python 2Python 3

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

Uploaded Python 2Python 3

mpy_cross-1.29.0rc0.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.29.0rc0.post2-py2.py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for mpy_cross-1.29.0rc0.post2-py2.py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 b859af762252a6bf00d148d9dc05b3feffec49685ef2e07a7973f70b4925b305
MD5 c3a60a44f04bb5d7d44ff4459e0a212b
BLAKE2b-256 d19dcb064158a66384901a1d242f50192d8811e7aa7b590dfe259d857d1bab86

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.29.0rc0.post2-py2.py3-none-win32.whl
Algorithm Hash digest
SHA256 474933f10da072316e176265a6f850062d20befff85bc7fe04378661f2f17fdf
MD5 1d14df1cce69857dcd2136905916e656
BLAKE2b-256 cada3e4027b95d5d04fa47fdf847ffd520e8980bf14629bbb9c012ccd9c4f2b9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.29.0rc0.post2-py2.py3-none-manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 c08b3d0894d67b6840d4b492260e261c4211f8e78e7663e32616a2d90da30af5
MD5 94a1afe2c1291d21fe25d2f2f1a1ab3a
BLAKE2b-256 b680433796babcd83822354d0db7a7fb29ef8dd90dbfcbf1ad7ff5c60d298fbd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.29.0rc0.post2-py2.py3-none-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 936c8e27c32cc2e48383d7fe1a5ac89768ddd19e00c73e610308cbe1bb5b8d09
MD5 6d9dd9c21b7411597bd7f23dc507f0b5
BLAKE2b-256 29eff96675022fd331654d8186404db7ac10689f4a115e971b22067f8a515eb1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.29.0rc0.post2-py2.py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 f6519206c517c07283aa9e0899299e3047f8a3a57bff5cf7c051d6719c1aa15b
MD5 b4d3b5f8175fb9745278bd83bd2db90c
BLAKE2b-256 5c8f1f72f3d723575f267462797f6d0d117e6272930e2d4f3f0d80aa51cb588c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.29.0rc0.post2-py2.py3-none-manylinux1_i686.whl
Algorithm Hash digest
SHA256 2a08d6e1985071ce6ea3d8c64f92ce36014fb84a729bc9a92371e7a5d630a570
MD5 9da513b26a90979a2834b365af1f4e0c
BLAKE2b-256 1ad132da427865bfadf8496bf6a07eeed11c917a1c5f9eb2c9495fc82ebab4c2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.29.0rc0.post2-py2.py3-none-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 85052c551ecb8373bcba5bb7118481bd93bcf76df910f965401fa288e8e68c05
MD5 853f66e32a202473e74e9c3e77bdc1aa
BLAKE2b-256 cbf46a2c34acfb024136b36edc7467be99acaa59d528c8512a452cf89485a121

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