Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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, rv64imc, host, debug
-march-flags=<flags> : set architecture-specific flags (can be either a dec/hex/bin value or a comma-separated flags string)
                       supported flags for rv32imc: zba, zcmp

Implementation specific options:
  emit={bytecode,native,viper} -- set the default code emitter
  heapsize=<n> -- set the heap size for the GC (default 2097152)
  source-lines    -- include source line numbers (default)
  no-source-lines -- exclude source line numbers

Release files for mpy-cross 1.30.0rc0.post2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for mpy-cross 1.30.0rc0.post2
File
mpy_cross-1.30.0rc0.post2-py2.py3-none-win_amd64.whl Python 2, Python 3 none Windows x86-64 Details
mpy_cross-1.30.0rc0.post2-py2.py3-none-win32.whl Python 2, Python 3 none Windows x86-32 Details
mpy_cross-1.30.0rc0.post2-py2.py3-none-manylinux2014_armv7l.whl Python 2, Python 3 none Linux glibc 2.17+ ARMv7l Details
mpy_cross-1.30.0rc0.post2-py2.py3-none-manylinux2014_aarch64.whl Python 3, Python 2 none Linux glibc 2.17+ ARM64 Details
mpy_cross-1.30.0rc0.post2-py2.py3-none-manylinux1_x86_64.whl Python 2, Python 3 none Linux glibc 2.5+ x86-64 Details
mpy_cross-1.30.0rc0.post2-py2.py3-none-manylinux1_i686.whl Python 2, Python 3 none Linux glibc 2.5+ x86-32 Details
mpy_cross-1.30.0rc0.post2-py2.py3-none-macosx_11_0_universal2.whl Python 3, Python 2 none macOS 11.0+ universal2 (ARM64, x86-64) Details

Total release size: 8.4 MB

Release files / mpy_cross-1.30.0rc0.post2-py2.py3-none-win_amd64.whl

Download URL mpy_cross-1.30.0rc0.post2-py2.py3-none-win_amd64.whl
Size 1.2 MB
Tags Python 2 Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
a86e96696bd5d3cfd320e06257094a8fdd850341e7c0e27bdc33498fa487c8f1
BLAKE2b-256 checksum
How to use checksums
47f5a6c66a7c7aa6865135e1580b260f00382478b09de149a91f7b521e722c90
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / mpy_cross-1.30.0rc0.post2-py2.py3-none-win32.whl

Download URL mpy_cross-1.30.0rc0.post2-py2.py3-none-win32.whl
Size 1.1 MB
Tags Python 2 Python 3 Windows x86-32
SHA-256 checksum
How to use checksums
dfba94821e12a21b5128a8c1d6518e0c474d548a23910c44fa5f1852ec3fbac2
BLAKE2b-256 checksum
How to use checksums
c6631bc5728fc87be7bf02853d235d7cb4a3059fc792dbd7834befa553e2c065
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / mpy_cross-1.30.0rc0.post2-py2.py3-none-manylinux2014_armv7l.whl

Download URL mpy_cross-1.30.0rc0.post2-py2.py3-none-manylinux2014_armv7l.whl
Size 1.1 MB
Tags Linux glibc 2.17+ ARMv7l Python 2 Python 3
SHA-256 checksum
How to use checksums
5cb64d5e1e1bf97ae76d58e22046ac8beead7fc0abb447d503e918b3dbe6807e
BLAKE2b-256 checksum
How to use checksums
be6b6090fc409d9d84868874d2c73f613ff1024f9a34a134dbbcc08895a0f7e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / mpy_cross-1.30.0rc0.post2-py2.py3-none-manylinux2014_aarch64.whl

Download URL mpy_cross-1.30.0rc0.post2-py2.py3-none-manylinux2014_aarch64.whl
Size 1.2 MB
Tags Linux glibc 2.17+ ARM64 Python 2 Python 3
SHA-256 checksum
How to use checksums
6759424e179cf6b4c02b42aace732d50cba2fabd2920b4ecb61bf87b1757916a
BLAKE2b-256 checksum
How to use checksums
a43abb22e4357ebac3e270d0e71b7f2c4e0b560553cce8357af0d0308fe7460f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / mpy_cross-1.30.0rc0.post2-py2.py3-none-manylinux1_x86_64.whl

Download URL mpy_cross-1.30.0rc0.post2-py2.py3-none-manylinux1_x86_64.whl
Size 1.1 MB
Tags Linux glibc 2.5+ x86-64 Python 2 Python 3
SHA-256 checksum
How to use checksums
d728c3146629bd8768186f8248a51887356e8d7cc52a97a336e52ef5ce1fcad5
BLAKE2b-256 checksum
How to use checksums
d4356af1410ef4da3b3c881ec0dc8d0ae4644f85020c3d58d93a7006a517b2ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / mpy_cross-1.30.0rc0.post2-py2.py3-none-manylinux1_i686.whl

Download URL mpy_cross-1.30.0rc0.post2-py2.py3-none-manylinux1_i686.whl
Size 1.1 MB
Tags Linux glibc 2.5+ x86-32 Python 2 Python 3
SHA-256 checksum
How to use checksums
f3c24ece5407d8c84b85c8cb1d255b0f6fa06fac7865033ace6723d71511d90c
BLAKE2b-256 checksum
How to use checksums
17dae204e01a603195ed565570f7093e15776dc49a330fdfd6fd39dc389fa076
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / mpy_cross-1.30.0rc0.post2-py2.py3-none-macosx_11_0_universal2.whl

Download URL mpy_cross-1.30.0rc0.post2-py2.py3-none-macosx_11_0_universal2.whl
Size 1.8 MB
Tags Python 2 Python 3 macOS 11.0+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
2551181b521c2cf2d762c742bb2fb23a469f97572e4af5ee8b01b553929d37c2
BLAKE2b-256 checksum
How to use checksums
be2b601057fd5ed677956d8beafc0a84161a694c9c6762c2ea6b73e0a2affe31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

This release

1.22.2

7 release files

1.22.0

8 release files

1.19.1

8 release files

1.19

8 release files

1.18

7 release files

1.17

7 release files

1.16

6 release files

1.15

6 release files

1.14

7 release files

1.13

7 release files

1.12

8 release files

1.11

7 release files

1.10

5 release files

1.9.4

5 release files

1.9.3

7 release files

1.9.2

5 release files

1.9.1

5 release files

1.9

6 release files

1.8.7

3 release files

1.8.6

3 release files

1.8.5

3 release files

1.8.4

2 release files

1.8.3

2 release files

1.8.2

2 release files

1.8.1

2 release files

1.8

2 release files

1.7

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page