Skip to content

Commit ec83da5

Browse files
committed
mpy-cross/pyproject.toml: Add pyproject.toml.
This will generate a wheel using the WASM binary. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <[email protected]>
1 parent 76699a8 commit ec83da5

File tree

3 files changed

+73
-0
lines changed

3 files changed

+73
-0
lines changed

mpy-cross/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist/

mpy-cross/pyproject.toml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
[build-system]
2+
requires = [
3+
"hatchling",
4+
"hatch-requirements-txt",
5+
"hatch-vcs",
6+
]
7+
build-backend = "hatchling.build"
8+
9+
[project]
10+
name = "mpy_cross"
11+
description = "MicroPython cross-compiler"
12+
readme = "README.md"
13+
authors = [
14+
{name = "Damien George", email = "[email protected]"},
15+
]
16+
urls = {Homepage = "https://github.com/micropython/micropython"}
17+
keywords = [
18+
"hardware",
19+
"micropython",
20+
]
21+
license = {text = "MIT"}
22+
classifiers = [
23+
"Intended Audience :: Developers",
24+
"License :: OSI Approved :: MIT License",
25+
"Operating System :: OS Independent",
26+
"Programming Language :: Python :: 3",
27+
"Topic :: Software Development :: Embedded Systems",
28+
"Topic :: System :: Hardware",
29+
]
30+
requires-python = ">=3.6"
31+
dynamic = ["dependencies", "version"]
32+
33+
[project.scripts]
34+
mpy_cross = "mpy_cross.main:main"
35+
36+
[tool.hatch.metadata.hooks.requirements_txt]
37+
files = ["requirements.txt"]
38+
39+
[tool.hatch.version]
40+
source = "vcs"
41+
tag-pattern = "(?P<version>v(\\d+).(\\d+).(\\d+))"
42+
raw-options = { root = "..", version_scheme = "post-release" }
43+
44+
[tool.hatch.build]
45+
packages = ["mpy_cross"]
46+
47+
# Package the compiled wasm binary and add it to the package for both wheel and sdist.
48+
# Must have run `make -j -f Makefile.wasm` first.
49+
[tool.hatch.build.force-include]
50+
"build-wasm/mpy-cross.wasm" = "mpy_cross/mpy-cross.wasm"
51+
52+
# Workaround to allow `python -m build` to work.
53+
[tool.hatch.build.targets.sdist.force-include]
54+
"build-wasm/mpy-cross.wasm" = "mpy_cross/mpy-cross.wasm"
55+
"requirements.txt" = "requirements.txt"

mpy-cross/requirements.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Install wasmtime by default on supported 64-bit targets.
2+
wasmtime==11.0.0;(sys_platform == "linux" and platform_machine == "aarch64")
3+
wasmtime==11.0.0;(sys_platform == "linux" and platform_machine == "x86_64")
4+
wasmtime==11.0.0;(sys_platform == "darwin")
5+
wasmtime==11.0.0;(sys_platform == "win32" and platform_machine == "AMD64")
6+
7+
# This will work just about anywhere but needs CPython
8+
# development headers installed (e.g. apt install python-dev).
9+
#pywasm3[pywasm3]==0.5.0
10+
11+
# wasmer provide a universal "none" package that will install
12+
# anywhere that doesn't have a supported version. So it's always
13+
# safe to have as a dependency, it just might not actually
14+
# do anything if imported.
15+
#wasmer[wasmer]==1.1.0
16+
#wasmer-compiler-singlepass[wasmer]==1.1.0
17+
#wasmer-compiler-cranelift[wasmer]==1.1.0

0 commit comments

Comments
 (0)