MicroPython port for FreeDOS / i386 — built end-to-end through the uc386 C23 compiler
Project description
freedos_micro_python
MicroPython port for
FreeDOS / i386, built end-to-end through the
uc386 C23 compiler. Produces a
runnable flat-binary or PMODE/W .exe with a fully-functional
Python REPL — arithmetic, control flow, classes, list comprehensions,
exception handling, and ~25 named builtins all work.
MicroPython uc386-triage on 2026-05-01; uc386-dos with i386
Type "help()" for more information.
>>> def fib(n):
... if n < 2: return n
... return fib(n-1) + fib(n-2)
...
>>> print([fib(i) for i in range(10)])
[0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
Status
- ~444 KB binary at the EXTRA_FEATURES + axtls TLS configuration
- ~70 smoke tests pin REPL banner, builtins, comprehensions, exceptions,
module imports (
os,time,re,json,hashlib,ssl, ...), and the long-int / float code paths - See
NOTES.mdfor the full per-slice development log
Install
pip install freedos_micro_python
This pulls in uc386 (the compiler) automatically. You also need:
- a Unix-y shell to drive the
build_port.shscript (macOS / Linux) git(for fetching the upstream MicroPython sources)makeis not required
Quick start
mkdir mp-build && cd mp-build
freedos-micropython fetch # clones upstream MicroPython into ./upstream
freedos-micropython build # per-TU triage build (generates qstrdefs)
freedos-micropython port # multi-TU build → ./build/micropython.bin
Wall-clock for the port step is ~14 minutes on a recent Mac. The
output is ./build/micropython.bin, a flat i386 DOS binary runnable
under uc386's emulator:
from uc386.dos_emu import run
res = run("build/micropython.bin", timeout_seconds=10.0,
instruction_limit=2_000_000_000)
print(res.stdout) # → "MicroPython uc386-triage on ...\n..."
To produce a real DOS .exe (PMODE/W bound, ~12 KB stub overhead):
use uc386's addons/harness/exe.py.
Testing
After a successful port build:
pytest --pyargs freedos_micro_python # parametric: tests live in tests/
# or, against a checkout:
pytest tests/
The smoke tests skip cleanly if build/micropython.bin doesn't exist.
Layout
src/freedos_micro_python/scripts/— the three shell scripts (fetch.sh,build.sh,build_port.sh); invoked via the CLI wrapper, which setsUC386_LIB_INCLUDEfrom the installeduc386src/freedos_micro_python/port/— the FreeDOS port files (mpconfigport.h,*_uc386dos.c, lwIP + axtls glue)src/freedos_micro_python/gen_qstrdefs.py— qstr table generator (mirrors upstream'stools/makeqstrdata.py)src/freedos_micro_python/cli.py— thefreedos-micropythonCLItests/— pytest smoke tests + qstr unit testsrigs/dosbox-x-rig/— DOSBox-X regression rig (network packet driver)rigs/tls-rig/— axtls TLS regression rig
License
MIT, matching upstream MicroPython. The integration glue
(scripts, port files, CLI, tests) is what's covered here; the
upstream MicroPython sources fetched by build_port.sh retain their
own MIT license.
Related projects
- uc386 — the C23 compiler that
builds this port. Hosts the
dos_emutest harness. - uc_core — shared C23 frontend used by uc386 (and the Z80 sibling, uc80).
- MicroPython — upstream.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file freedos_micro_python-0.1.0.tar.gz.
File metadata
- Download URL: freedos_micro_python-0.1.0.tar.gz
- Upload date:
- Size: 106.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25985fcdf9fc77f2312a289e1f701a82878804d4c88a8f40af801e3e59ed7742
|
|
| MD5 |
5d6e3811bd6268d3cd03055aa57710c6
|
|
| BLAKE2b-256 |
e9cb6afb53c8e30901e2b8c1a2f513346a4b8a42bc166bd55bc2b487e3e58d8e
|
Provenance
The following attestation bundles were made for freedos_micro_python-0.1.0.tar.gz:
Publisher:
publish.yml on avwohl/freedos_micro_python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
freedos_micro_python-0.1.0.tar.gz -
Subject digest:
25985fcdf9fc77f2312a289e1f701a82878804d4c88a8f40af801e3e59ed7742 - Sigstore transparency entry: 1486056510
- Sigstore integration time:
-
Permalink:
avwohl/freedos_micro_python@23dcd07d51ce371e904aa9c6beff10b50c39a878 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/avwohl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@23dcd07d51ce371e904aa9c6beff10b50c39a878 -
Trigger Event:
release
-
Statement type:
File details
Details for the file freedos_micro_python-0.1.0-py3-none-any.whl.
File metadata
- Download URL: freedos_micro_python-0.1.0-py3-none-any.whl
- Upload date:
- Size: 88.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9dc5bc685410f8c8390b1e0a17583f7fb5b1eb8429aad5345b54ab2d2c98424b
|
|
| MD5 |
ce1438d3072a7e46ef7a80bd51ac358f
|
|
| BLAKE2b-256 |
bf8cce97ebd16f2d2229a431c0f846375cfc355cffc812fd3aa1abb0ff367d24
|
Provenance
The following attestation bundles were made for freedos_micro_python-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on avwohl/freedos_micro_python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
freedos_micro_python-0.1.0-py3-none-any.whl -
Subject digest:
9dc5bc685410f8c8390b1e0a17583f7fb5b1eb8429aad5345b54ab2d2c98424b - Sigstore transparency entry: 1486056516
- Sigstore integration time:
-
Permalink:
avwohl/freedos_micro_python@23dcd07d51ce371e904aa9c6beff10b50c39a878 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/avwohl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@23dcd07d51ce371e904aa9c6beff10b50c39a878 -
Trigger Event:
release
-
Statement type: