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

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.23.0.post2-py2.py3-none-win_amd64.whl (999.2 kB view details)

Uploaded Python 2Python 3Windows x86-64

mpy_cross-1.23.0.post2-py2.py3-none-win32.whl (927.2 kB view details)

Uploaded Python 2Python 3Windows x86

mpy_cross-1.23.0.post2-py2.py3-none-manylinux2014_armv7l.whl (899.4 kB view details)

Uploaded Python 2Python 3

mpy_cross-1.23.0.post2-py2.py3-none-manylinux2014_aarch64.whl (965.6 kB view details)

Uploaded Python 2Python 3

mpy_cross-1.23.0.post2-py2.py3-none-manylinux1_x86_64.whl (899.6 kB view details)

Uploaded Python 2Python 3

mpy_cross-1.23.0.post2-py2.py3-none-manylinux1_i686.whl (894.5 kB view details)

Uploaded Python 2Python 3

mpy_cross-1.23.0.post2-py2.py3-none-macosx_11_0_universal2.whl (1.4 MB view details)

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

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.23.0.post2-py2.py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 a3c8a542013943f6a9f570b46fdce0d84efd0c30eea73699b389451bad9bd53a
MD5 cfa67e94265a069c9e5d7750498b9698
BLAKE2b-256 3b9f80636bb7f2453b1df4a94d853c1689f611f6acb388036813dfce6209711b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.23.0.post2-py2.py3-none-win32.whl
Algorithm Hash digest
SHA256 63d211fc31e086e953ff9d0a83e097346e24787bf3c984fe345047e30e76da3d
MD5 cacbdd7bfaec56e43972d377bf88fb98
BLAKE2b-256 00115224e8fd5104409c96fcec22d13637e10136282a0dc1c25d39dd6015253d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.23.0.post2-py2.py3-none-manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 0bc132de4f5736c9796522a0ab4beefa5e01f0b328d76198a492a46427f602e2
MD5 f6df97c9070cedffc8678b7f6a7a1599
BLAKE2b-256 c78536213207d40bb338ef232d95a6f06757b27aa85c88a713a3b46242ad3c6a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.23.0.post2-py2.py3-none-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 42e5b5f455370dd4d57f3000376c1d22ef6c3b5d7115f90ecefc251b5f64c590
MD5 c7958db6c4fc777b742d6db2ba888e58
BLAKE2b-256 984314cf6bc672286e65ab1974ceb130f365c4d25d8910929c7c628a3221cb81

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.23.0.post2-py2.py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 98667192865efc63a1e4aba5858873b5f0f1908f1318f16fe792866187855075
MD5 6e746591f7f54d2d36882bea852217fe
BLAKE2b-256 0705fc63fbbcbeacbe5858d0bf962e812bea547d65ee2850957339c02b2e91e8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.23.0.post2-py2.py3-none-manylinux1_i686.whl
Algorithm Hash digest
SHA256 d159fb014de046b2081be692daa1ebdf2ff568a9c19a562db082ce523bbd0fd5
MD5 8b2963f449fddd6b31c502be3a85ce40
BLAKE2b-256 e79a42ab29d9a37816531ec93677973a4d9b3ec23ba9c81bb2f1c7ddfff25087

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.23.0.post2-py2.py3-none-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 88e3cb401e4e59e70ccdb15ae1a462e9c1e4f157086c098ed0ce0b4b36254257
MD5 4e8ebec88f58a3c9b825d7cdad22a90a
BLAKE2b-256 b8bbcf34b587413449a0ffde92be3ef5943dd44a5bf13b65a074e26b3afeab20

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