-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpixi.toml
More file actions
101 lines (89 loc) · 3.69 KB
/
pixi.toml
File metadata and controls
101 lines (89 loc) · 3.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
[workspace]
authors = ["ZHU Yuhao (朱宇浩) <dr.yuhao.zhu@outlook.com>"]
channels = ["https://conda.modular.com/max", "https://conda.modular.com/max-nightly", "https://repo.prefix.dev/modular-community", "conda-forge"]
description = "An arbitrary-precision decimal and integer library for Mojo"
license = "Apache-2.0"
name = "decimo"
platforms = ["osx-arm64", "linux-64"]
readme = "README.md"
version = "0.9.0"
[dependencies]
# argmojo = ">=0.4.0" # CLI argument parsing for the Decimo calculator (TODO: waiting for argmojo 0.4.0 compatible with mojo 0.26.2)
mojo = ">=0.26.2.0,<0.26.3" # Mojo language compiler and runtime
python = ">=3.13" # For Python bindings and tests
python-build = ">=0.2.0" # Build PyPI wheel (`pixi run wheel`)
ruff = ">=0.15.0" # Python code formatter
twine = ">=6.2.0" # Upload wheel to PyPI (`twine upload dist/*`)
[tasks]
# format the code
format = """pixi run mojo format ./src \
&&pixi run mojo format ./python \
&&pixi run mojo format ./benches \
&&pixi run mojo format ./tests \
&&pixi run mojo format ./docs \
&&pixi run ruff format ./python"""
# doc
doc = """pixi run mojo doc \
--diagnose-missing-doc-strings --validate-doc-strings src/decimo"""
# compile the package
p = "clear && pixi run package"
package = """pixi run format \
&& pixi run package_decimo"""
package_decimo = """pixi run mojo package src/decimo \
&& cp decimo.mojopkg tests/ \
&& cp decimo.mojopkg benches/ \
&& rm decimo.mojopkg"""
# clean the package files in tests folder
c = "clear && pixi run clean"
clean = """rm tests/decimo.mojopkg && \
rm benches/decimo.mojopkg"""
# tests (use the mojo testing tool)
t = "clear && pixi run test"
tdecimo = "clear && pixi run testdecimo"
test = "pixi run package && bash ./tests/test_all.sh"
testdecimo = "pixi run package && bash ./tests/test_decimo.sh"
testtoml = "pixi run package && bash ./tests/test_toml.sh"
ttoml = "clear && pixi run testtoml"
# bench
bench = "pixi run package && bash benches/run_bench.sh"
# bench with debug assertions enabled
bdec_debug = """clear && pixi run package && cd benches/bigdecimal \
&& pixi run mojo run -I ../ -D ASSERT=all bench.mojo && cd ../.. \
&& pixi run clean"""
bint_debug = """clear && pixi run package && cd benches/bigint \
&& pixi run mojo run -I ../ -D ASSERT=all bench.mojo && cd ../.. \
&& pixi run clean"""
buint_debug = """clear && pixi run package && cd benches/biguint \
&& pixi run mojo run -I ../ -D ASSERT=all bench.mojo && cd ../.. \
&& pixi run clean"""
dec_debug = """clear && pixi run package && cd benches/decimal128 \
&& pixi run mojo run -I ../ -D ASSERT=all bench.mojo && cd ../.. \
&& pixi run clean"""
# Fetch argmojo source code for CLI calculator
fetch = """git clone https://github.com/forfudan/argmojo.git temp/argmojo 2>/dev/null || true \
&& cd temp/argmojo && git checkout 24ca712fa291ec6a82dc9317f6ba5d0484d1fb47 2>/dev/null"""
# cli calculator
bcli = "clear && pixi run buildcli"
buildcli = """pixi run mojo package temp/argmojo/src/argmojo -o temp/argmojo.mojopkg \
&& pixi run mojo build -I src -I src/cli -I temp -o decimo src/cli/main.mojo"""
tcli = "clear && pixi run testcli"
testcli = "bash tests/test_cli.sh"
# python bindings (mojo4py)
bpy = "clear && pixi run buildpy"
buildpy = """pixi run mojo build python/decimo_module.mojo \
--emit shared-lib -I src -o python/src/decimo/_decimo.so"""
testpy = "pixi run buildpy && pixi run python python/tests/test_decimo.py"
tpy = "clear && pixi run testpy"
# build PyPI wheel (placeholder, no .so included)
wheel = "cd python && pixi run python -m build --wheel"
# All task
all = """pixi run format \
&&pixi run package \
&&pixi run doc \
&&pixi run test \
&&pixi run fetch \
&&pixi run buildcli \
&&pixi run testcli \
&&pixi run buildpy \
&&pixi run testpy \
&&pixi run clean"""