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.1.post3-py2.py3-none-win_amd64.whl (162.9 kB view details)

Uploaded Python 2Python 3Windows x86-64

mpy_cross-1.24.1.post3-py2.py3-none-win32.whl (151.1 kB view details)

Uploaded Python 2Python 3Windows x86

mpy_cross-1.24.1.post3-py2.py3-none-manylinux2014_armv7l.whl (150.6 kB view details)

Uploaded Python 2Python 3

mpy_cross-1.24.1.post3-py2.py3-none-manylinux2014_aarch64.whl (175.7 kB view details)

Uploaded Python 2Python 3

mpy_cross-1.24.1.post3-py2.py3-none-manylinux1_x86_64.whl (149.3 kB view details)

Uploaded Python 2Python 3

mpy_cross-1.24.1.post3-py2.py3-none-manylinux1_i686.whl (148.4 kB view details)

Uploaded Python 2Python 3

mpy_cross-1.24.1.post3-py2.py3-none-macosx_11_0_universal2.whl (369.9 kB view details)

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

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.24.1.post3-py2.py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 c45cf5367cf5d60fd81d6271496b5caaa138913ea9358a641bc5ded49338c12f
MD5 3488ceeb2305606bfce784039fd77fa3
BLAKE2b-256 f453b22b6d484c46d3a0e7c52d6123dc3a651f3e27fcbf5ab0600eef10d3116c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.24.1.post3-py2.py3-none-win32.whl
Algorithm Hash digest
SHA256 d957c11467fc9689a4ea4063e10077445f9c9f906393cbbae3fd36c5980d63cd
MD5 c9e594fd502387d4a7d06baed990aaa2
BLAKE2b-256 aba5ed117d035bc1fe0cd7fda35a23b5e1eee33542fa41cfb2b64dd52deea874

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.24.1.post3-py2.py3-none-manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 c8372825342f01f7d473d1bbda0817eea1993319e5d8d308f85e7a2053121e6a
MD5 28a0dab57f15c8f39cad6c350488d920
BLAKE2b-256 e0d0116dcce338499bb31306140569c0f260f7fdead74b98705e17a9c8a9cc13

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.24.1.post3-py2.py3-none-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 83bcf6bf80d20426e7561477427e6aa4f2f5589c4d4433d2c28fe368b0c56a95
MD5 c5db2a43763f4e4539216909625cbf30
BLAKE2b-256 48fa133f807e8f38751befef2201cecc773aa68f6ffc6cac437e91901c305ec5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.24.1.post3-py2.py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 032e3f810f011aef58876d02e0e405e9ef03a24b8a3f893f47c1c95b55fe8b9a
MD5 2dea96bba32c8046a12d840a583a2fba
BLAKE2b-256 305bc8f765f24e7410c859f528ff55959e435cc4ff06403bf8bafb85b615d36d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.24.1.post3-py2.py3-none-manylinux1_i686.whl
Algorithm Hash digest
SHA256 8ff92218bafe7625702f891069063169c240d29f57e51e409fdfe7af3b30560a
MD5 ef287c9a9b87a2ae7d52d144b76a6dc7
BLAKE2b-256 d21117b4e9f4925d8efc96d39d670939ed9c2241f6b3b8b0b13e97ba0344a4b6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.24.1.post3-py2.py3-none-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 c7e2fc06dfb1f79bef9acf96215b987f4efe0696f706dcb2909a9648ab2fd07b
MD5 a733fb8de5d18c2a4ddcf0a831874ecb
BLAKE2b-256 0bbe04419eb0ff38f8af3e31e140e8c49c3a8c83ee3e7790119360908d2e0f5f

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