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

Uploaded Python 2 Python 3 Windows x86-64

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

Uploaded Python 2 Python 3 Windows x86

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

Uploaded Python 2 Python 3

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

File metadata

File hashes

Hashes for mpy_cross-1.25.0rc0.post2-py2.py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 d760375bf560fb369509088a2b2cf418a2a378b65dc9b7da62b8f64df1e4d7da
MD5 83859dd340ece0a27d7cbf88e5921766
BLAKE2b-256 6692966510ee9f209f1b8d44bbd22661b54a1652c6b2cfd62a52ee340544a8ec

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.25.0rc0.post2-py2.py3-none-win32.whl
Algorithm Hash digest
SHA256 77906a4839953f57ecd67dff5fe6a82ef91253f9002702d0777f3c920482f219
MD5 9abc64c2a0bb82b313dd555609f96d05
BLAKE2b-256 74bcb73783496ac13341cabe9a961ddff4452fdb5b7dc9933ef0aba2bb60a3c5

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.25.0rc0.post2-py2.py3-none-manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 69080a317ef1fc9344fe52e03e47aabe70ca08ae537319840d0954bc52e3bbe9
MD5 1f6ae0d3e1d23bf3e9239bbeb2e9cda5
BLAKE2b-256 799389311a0a0189f9f7daf26187500cc6830347e4c7e29b2c4c5d669348ed00

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.25.0rc0.post2-py2.py3-none-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 05b52162023c04e5ad600a44d2cdd4070f4e8e8fea571a350a36784e9b320f2c
MD5 66779a350200f17eb1f8d790099f3d5f
BLAKE2b-256 612a4be0da3343192de2ae85b92a34dbffb85c3454ed465d566f395623e95c6c

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.25.0rc0.post2-py2.py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 6cceb32546de97fee848ddf64a5faa1f49e40ad3f9a9d81eb8e7cb8832d16507
MD5 e8b86a5aeee317831bfb7ebb7484b771
BLAKE2b-256 0b0dc4bdf1fd122d96ec5cf8f975438a0c91042db9bb70524ed7a54bf05c6bb9

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.25.0rc0.post2-py2.py3-none-manylinux1_i686.whl
Algorithm Hash digest
SHA256 6162c9a8523886bd959ae274cf40a892ae79a50cc3794158a6ec31f3f392b318
MD5 b194ba79f160e74c606d00883a7f4f29
BLAKE2b-256 548f4937e60b638189e19f65f1c8d26e73c20061710756f6309164e75fdd2b36

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for mpy_cross-1.25.0rc0.post2-py2.py3-none-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 8afe3350879c4adffeae32f8468b7c821962dbb27a39c24b41db485c1ca33f2d
MD5 829f284dfb8f4f40812434b4e4927a00
BLAKE2b-256 8e32f29a2afc5d533de6b60a57d941e255fd268d81e874431777d60f911354bc

See more details on using hashes here.

Provenance

Supported by

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