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

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

Uploaded Python 2 Python 3 Windows x86-64

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

Uploaded Python 2 Python 3 Windows x86

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

Uploaded Python 2 Python 3

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

Uploaded Python 2 Python 3

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

Uploaded Python 2 Python 3

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

Uploaded Python 2 Python 3

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

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

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.24.1.post2-py2.py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 44b7329185ead4e823c851877724d8636a813435688e3e0f290055e4b6542cfc
MD5 a84f9c596dde538ba8e69a50ed056e77
BLAKE2b-256 d14fd17d2857de7f9f4ef3d18ae894a59723c029cc4481f2027af303f127335b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.24.1.post2-py2.py3-none-win32.whl
Algorithm Hash digest
SHA256 74e656aad69adf94cdfe718e59443724edfd57049c59e3eda7b3e6e44375d9c9
MD5 402c80cba082209e86e13ae3f5caa15d
BLAKE2b-256 595e2aebd51956b4e710a84eac8c20e6cf4779dea51ec68a2a1986a04d84c418

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.24.1.post2-py2.py3-none-manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 3ba4de919efa0c4e94377d2a1dc3b87d8e4822318a17772a0c7e5f030a0061e1
MD5 46e5316bffeee0576d518256f6b79c01
BLAKE2b-256 20c747015140b6a582c77d4acdbca898ecf40c84df5c22f1e63ff6976a6f1cfa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.24.1.post2-py2.py3-none-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 cdca65612bc5e3e14930620c782ffae931b746c38660fcffd15e8025ce77c281
MD5 05705fdcfacb23862d080803b613b22e
BLAKE2b-256 65d4997519ff7759e0df30533d86bc245e1c293975e3a36fda8c3263f7dcba80

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.24.1.post2-py2.py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 85f6638b25f704b8076537046e15126f98903034f4a9c3b9d15315b460032ef8
MD5 073848d4581020c817cb44ae85e9da00
BLAKE2b-256 db2bb2b52019f5890ca967ef295f59420ec18192fd7ec4d94e26542335aa6414

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.24.1.post2-py2.py3-none-manylinux1_i686.whl
Algorithm Hash digest
SHA256 477cedb855bce1d7e15ec36fa455dce4c5622d3f5a6a3510d0b2ca67403dae0f
MD5 ff04cda010657e8913fcf1ffa496a8bd
BLAKE2b-256 734b3549b2231b83e46dc3682892f1500f02b8f0fdf81cc2e5c1038e4b5901a7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.24.1.post2-py2.py3-none-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 a76cf31a844e0f80a78947fbdf2c34e851b157afc002f9640573791a55bb8746
MD5 460d3bcf0c3c615c97fc49dba6491471
BLAKE2b-256 68a0586599c73898ba28f4e8ccbd2b951eaaa5fa126e2f4081ef396d0a5cdb4d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page