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

Uploaded Python 2Python 3Windows x86-64

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

Uploaded Python 2Python 3Windows x86

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

Uploaded Python 2Python 3

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

Uploaded Python 2Python 3

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

Uploaded Python 2Python 3

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

Uploaded Python 2Python 3

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

File metadata

File hashes

Hashes for mpy_cross-1.25.0.post2-py2.py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 7a6ff4d7db33edf89b411dd676d19d089d572faaa1bb778e4fc6fd2cbd72d85b
MD5 81aad36036778208f2cf6a0dbfc40e16
BLAKE2b-256 1d5c848694b9fbaa75ebe01cf13636983b7c5a061c400b56ce053549a3266549

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.25.0.post2-py2.py3-none-win32.whl
Algorithm Hash digest
SHA256 e08b24a05ea04fcac28bb8788d5adbc0fa90863f094fb09b99409112d81ab712
MD5 52a0a4343e077734576a86c0d3b74c89
BLAKE2b-256 528e0f8a093fd23b2884dec2570b6168a49a6d05d9820a924edc9684da8e24b5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.25.0.post2-py2.py3-none-manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 a8908a95f540e1a6c062b5affcd43018f9c1c7c1cf52ed0ce88080fec559e9da
MD5 d642cd28618748e0fba50a90d6881ea9
BLAKE2b-256 13559acf36f56d411860834d11bfcb2067a90d7c9614e076a3b46e57624b05cc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.25.0.post2-py2.py3-none-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0a9dbb7fb87f73af0282f233a66c79a6e408cbdfa86c94f0da532243614abbb0
MD5 e91d44e5755a60c7d7cb00bfd40245e2
BLAKE2b-256 f2736060eb6b5df36a05b86266e8c17f50792ae70e2e822c204994d44a79b5ea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.25.0.post2-py2.py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 77235a2b63c3e96dba8681e3b7026418053688a46c57df5702b77c07d5b83c23
MD5 4f6e5b8450bce163a1b51ae351421aab
BLAKE2b-256 c6a3174991726b2700ec92fd0f599c9404142736bbbb29cf197dbf5db50ce1de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.25.0.post2-py2.py3-none-manylinux1_i686.whl
Algorithm Hash digest
SHA256 167c8d8e18cde654103e8b268c06e8e025e3d2ed51dfcf3a1517eda0a709a927
MD5 15bfd4437520e4c376f662b10ba0427e
BLAKE2b-256 28464830367c63ccb35ff244391d982a30bc7b26319f1e5c36eaf31430258e76

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.25.0.post2-py2.py3-none-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 42c9e570b414cf2bc011bf7ba0cce1fa58c288132886311d92e44ace0f4bc3ae
MD5 ada730b8780c7ccd0f93ffd1a3bed787
BLAKE2b-256 309493863dfa4114876f63955b5861a79ad9c19d8cf47dfef6027218c3ea66b8

See more details on using hashes here.

Supported by

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