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

Uploaded Python 2Python 3Windows x86-64

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

Uploaded Python 2Python 3Windows x86

mpy_cross-1.24.0.post2-py2.py3-none-manylinux2014_armv7l.whl (1.0 MB view details)

Uploaded Python 2Python 3

mpy_cross-1.24.0.post2-py2.py3-none-manylinux2014_aarch64.whl (1.1 MB view details)

Uploaded Python 2Python 3

mpy_cross-1.24.0.post2-py2.py3-none-manylinux1_x86_64.whl (1.0 MB view details)

Uploaded Python 2Python 3

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

Uploaded Python 2Python 3

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

File metadata

File hashes

Hashes for mpy_cross-1.24.0.post2-py2.py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 a2899ee7ad84e9995ae22c5dbb2ba1fbc0b3bf1870ea479879dabd3e69f4d237
MD5 183ae15bf4b067bdd24d250b41b38000
BLAKE2b-256 5d6f20fd56a6b9ace29be9bc55daed8e6765d59b80736cb340722402adaf0e23

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.24.0.post2-py2.py3-none-win32.whl
Algorithm Hash digest
SHA256 3f3cd2ad64be913a568e827629101a23bb9605b5d9fbab47e0fbf5b54683dd14
MD5 790e1144e6f35f7b66c63db577795d11
BLAKE2b-256 29716363bc26b54d271dc23847d4c1d003cafcce0e19162a0ee091a6493771cb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.24.0.post2-py2.py3-none-manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 dc0f59a837e1b25cbcd8b190ab3d12f4e4812f0ede8e05039cb4c561e54225b8
MD5 570a24a39157e3562e63d7beb5e46900
BLAKE2b-256 0d1e37c14e50b8e6ba09c651888a2e75235cb413eb57f830d3adc170c72c709f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.24.0.post2-py2.py3-none-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b40c6eb6ebe465eed50edacb0fccf7a762878f3837243ab58eca4ac997e3a8de
MD5 37f86eaa7bf3ae96b7d4e8c08ef2fe2c
BLAKE2b-256 ed5ca5ff5b02573a721b8d2842a74240fb813464ccda8f68c2590bb178ea2f50

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.24.0.post2-py2.py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 3fc70c6f9fa44aedc9a252891ceb9a84bb16c7a61fb2c2bcb3b583a9b665a42b
MD5 3e38e1f10bf9b4235271c2392bc7057d
BLAKE2b-256 44b0920915f4ab964a753182aa123cff5685839c46ed21fffd8702a091687374

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.24.0.post2-py2.py3-none-manylinux1_i686.whl
Algorithm Hash digest
SHA256 885e833c8afddf92d64b54f94608db3f3030a49c2829cdb55c6fdf0ec21edebb
MD5 aa20d065f312c00a48a5eda0b07e1c65
BLAKE2b-256 cefb5a51832394576de01d65b6e3152eec7f866467bc481eed2059d2cf477f46

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.24.0.post2-py2.py3-none-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 31b94bfb692c11bf35acd10ec438e2fc812b530e3c9d655e757d0e34ed00abec
MD5 fd33da644cf6593ff10201bf333ad2d1
BLAKE2b-256 02cdb6c021bffba8c7c55f26daf0eca9baaf051d41e8dd25b2facce88d795c35

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