diff --git a/.github/workflows/run_tests.yaml b/.github/workflows/run_tests.yaml index 0aef60b..08d0843 100644 --- a/.github/workflows/run_tests.yaml +++ b/.github/workflows/run_tests.yaml @@ -29,15 +29,14 @@ jobs: - name: Checkout repo uses: actions/checkout@v4 - - name: Install magic + - name: Install pixi run: | - curl -ssL https://magic.modular.com/ | MAGIC_VERSION=0.7.0 bash + curl -fsSL https://pixi.sh/install.sh | sh - name: Add path run: | - echo "MODULAR_HOME=$HOME/.modular" >> $GITHUB_ENV - echo "$HOME/.modular/bin" >> $GITHUB_PATH - echo "$HOME/.modular/pkg/packages.modular.com_mojo/bin" >> $GITHUB_PATH + echo "PIXI_HOME=$HOME/.pixi" >> $GITHUB_ENV + echo "$HOME/.pixi/bin" >> $GITHUB_PATH - name: Activate virtualenv run: | @@ -45,21 +44,21 @@ jobs: . $HOME/venv/bin/activate echo PATH=$PATH >> $GITHUB_ENV - - name: Magic install + - name: Pixi install run: | - magic install + pixi install - name: Build package run: | - magic run mojo package src/decimojo - magic run mojo package src/tomlmojo + pixi run mojo package src/decimojo + pixi run mojo package src/tomlmojo cp decimojo.mojopkg tests/ cp decimojo.mojopkg benches/ mv tomlmojo.mojopkg tests/ - name: Run tests run: | - magic run mojo test tests + pixi run mojo test tests - name: Install pre-commit run: | @@ -68,5 +67,5 @@ jobs: - name: Run pre-commit run: | - magic install + pixi install pre-commit run --all-files \ No newline at end of file diff --git a/.gitignore b/.gitignore index 6841c79..e0c91fa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # pixi environments .pixi +pixi.lock *.egg-info # magic environments .magic diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6a72c9e..3ae3cdf 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ repos: hooks: - id: mojo-format name: mojo-format - entry: magic run mojo format + entry: pixi run mojo format language: system files: '\.(mojo|🔥|py)$' stages: [pre-commit] diff --git a/README.md b/README.md index 2931977..54ceb98 100644 --- a/README.md +++ b/README.md @@ -37,17 +37,18 @@ This repository includes [TOMLMojo](https://github.com/forfudan/decimojo/tree/ma DeciMojo is available in the [modular-community](https://repo.prefix.dev/modular-community) package repository. You can install it using any of these methods: -From the `magic` CLI, simply run ```magic add decimojo```. This fetches the latest version and makes it immediately available for import. +From the `pixi` CLI, simply run ```pixi add decimojo```. This fetches the latest version and makes it immediately available for import. -For projects with a `mojoproject.toml`file, add the dependency ```decimojo = ">=0.3.0"```. Then run `magic install` to download and install the package. +For projects with a `mojoproject.toml`file, add the dependency ```decimojo = ">=0.3.1"```. Then run `pixi install` to download and install the package. For the latest development version, clone the [GitHub repository](https://github.com/forfudan/decimojo) and build the package locally. -| `decimojo` | `mojo` | -| ---------- | ------ | -| v0.1.0 | >=25.1 | -| v0.2.0 | >=25.2 | -| v0.3.0 | >=25.2 | +| `decimojo` | `mojo` | package manager | +| ---------- | ------------- | --------------- | +| v0.1.0 | ==25.1 | magic | +| v0.2.0 | ==25.2 | magic | +| v0.3.0 | ==25.2 | magic | +| v0.3.1 | >=25.2, <25.4 | pixi | ## Quick start @@ -203,8 +204,8 @@ Regular benchmarks against Python's `decimal` module are available in the `bench After cloning the repo onto your local disk, you can: -- Use `magic run test` to run tests. -- Use `magic run bench_decimal` to generate logs for benchmarking tests against `python.decimal` module. The log files are saved in `benches/decimal/logs/`. +- Use `pixi run test` to run tests. +- Use `pixi run bench_decimal` to generate logs for benchmarking tests against `python.decimal` module. The log files are saved in `benches/decimal/logs/`. ## Citation @@ -216,7 +217,7 @@ If you find DeciMojo useful for your research, consider listing it in your citat year = {2025}, title = {An arbitrary-precision decimal and integer mathematics library for Mojo}, url = {https://github.com/forfudan/decimojo}, - version = {0.3.0}, + version = {0.3.1}, note = {Computer Software} } ``` diff --git a/docs/changelog.md b/docs/changelog.md index d9053a4..a755fe4 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -2,6 +2,10 @@ This is a list of RELEASED changes for the DeciMojo Package. For the unreleased changes, please refer to **[changelog_unreleased](https://zhuyuhao.com/decimojo/docs/changelog_unreleased.html)**. +## 06/06/2025 (v0.3.1) + +DeciMojo v0.3.1 updates the codebase to Mojo 25.3 and replaces the `magic` package manager with `pixi`. This release enables you to use DeciMojo with the latest Mojo features and the new package manager. + ## 15/04/2025 (v0.3.0) DeciMojo v0.3.0 introduces the arbitrary-precision `BigDecimal` type with comprehensive arithmetic operations, comparisons, and mathematical functions (`sqrt`, `root`, `log`, `exp`, `power`). A new `tomlmojo` package supports test refactoring. Improvements include refined `BigUInt` constructors, enhanced `scale_up_by_power_of_10()` functionality, and a critical multiplication bug fix. diff --git a/docs/readme_zht.md b/docs/readme_zht.md index a4d39b1..d0a3c0e 100644 --- a/docs/readme_zht.md +++ b/docs/readme_zht.md @@ -18,17 +18,18 @@ DeciMojo 爲 Mojo 提供了全面的定點數和整數運算庫,專爲處理 DeciMojo 可在 [modular-community](https://repo.prefix.dev/modular-community) 包倉庫中獲取。您可以使用以下任一方法進行安裝: -從 `magic` CLI,只需運行 ```magic add decimojo```。這會獲取最新版本並使其立即可用於導入。 +從 `pixi` CLI,只需運行 ```pixi add decimojo```。這會獲取最新版本並使其立即可用於導入。 -對於帶有 `mojoproject.toml` 文件的項目,添加依賴 ```decimojo = ">=0.3.0"```。然後運行 `magic install` 來下載並安裝包。 +對於帶有 `mojoproject.toml` 文件的項目,添加依賴 ```decimojo = ">=0.3.1"```。然後運行 `pixi install` 來下載並安裝包。 如需最新的開發版本,請克隆 [GitHub 倉庫](https://github.com/forfudan/decimojo) 並在本地構建包。 -| `decimojo` | `mojo` | -| ---------- | ------ | -| v0.1.0 | >=25.1 | -| v0.2.0 | >=25.2 | -| v0.3.0 | >=25.2 | +| `decimojo` | `mojo` | 包管理 | +| ---------- | ------------- | ------ | +| v0.1.0 | >=25.1 | magic | +| v0.2.0 | >=25.2 | magic | +| v0.3.0 | >=25.2 | magic | +| v0.3.1 | >=25.2, <25.4 | pixi | ## 快速入門 @@ -203,8 +204,8 @@ DeciMojo 相較於 Python 的 `decimal` 模塊提供了卓越的性能,同時 在將倉庫克隆到本地磁盤後,您可以: -- 使用 `magic run test`(或 `maigic run t`)運行測試。 -- 使用 `magic run bench`(或 `magic run b`)生成對比 `python.decimal` 模塊的基準測試日誌。日誌文件保存在 `benches/logs/` 中。 +- 使用 `pixi run test`(或 `pixi run t`)運行測試。 +- 使用 `pixi run bench`(或 `pixi run b`)生成對比 `python.decimal` 模塊的基準測試日誌。日誌文件保存在 `benches/logs/` 中。 ## 引用 @@ -216,7 +217,7 @@ DeciMojo 相較於 Python 的 `decimal` 模塊提供了卓越的性能,同時 year = {2025}, title = {DeciMojo: A fixed-point decimal arithmetic library in Mojo}, url = {https://github.com/forfudan/decimojo}, - version = {0.3.0}, + version = {0.3.1}, note = {Computer Software} } ``` diff --git a/mojoproject.toml b/mojoproject.toml deleted file mode 100644 index 01f99d1..0000000 --- a/mojoproject.toml +++ /dev/null @@ -1,41 +0,0 @@ -[project] -authors = ["ZHU Yuhao 朱宇浩 "] -channels = ["https://conda.modular.com/max", "https://repo.prefix.dev/modular-community", "conda-forge"] -# channels = ["https://conda.modular.com/max-nightly", "https://conda.modular.com/max", "https://repo.prefix.dev/modular-community", "conda-forge"] -description = "An arbitrary-precision decimal and integer mathematics library for Mojo" -license = "Apache-2.0" -name = "decimojo" -platforms = ["osx-arm64", "linux-64"] -readme = "README.md" -version = "0.3.0" - -[dependencies] -max = "==25.3" - -[tasks] -# format the code -format = "magic run mojo format ./" - -# compile the package -package_decimojo = "magic run mojo package src/decimojo && cp decimojo.mojopkg tests/ && cp decimojo.mojopkg benches/ && rm decimojo.mojopkg" -package_tomlmojo = "magic run mojo package src/tomlmojo && mv tomlmojo.mojopkg tests/" -package = "magic run format && magic run package_decimojo && magic run package_tomlmojo" -p = "clear && magic run package" - -# clean the package files in tests folder -clean = "rm tests/decimojo.mojopkg && rm benches/decimojo.mojopkg && rm tests/tomlmojo.mojopkg" -c = "clear && magic run clean" - -# tests (use the mojo testing tool) -test = "magic run package && magic run mojo test tests --filter" -t = "clear && magic run package && magic run mojo test tests --filter" - -# benches -bench_decimal = "clear && magic run package && cd benches/decimal && magic run mojo -I ../ bench.mojo && cd ../.. && magic run clean" -bench_bigint = "clear && magic run package && cd benches/bigint && magic run mojo -I ../ bench.mojo && cd ../.. && magic run clean" -bench_biguint = "clear && magic run package && cd benches/biguint && magic run mojo -I ../ bench.mojo && cd ../.. && magic run clean" -bench_bigdecimal = "clear && magic run package && cd benches/bigdecimal && magic run mojo -I ../ bench.mojo && cd ../.. && magic run clean" -bench_dec = "magic run bench_decimal" -bench_bint = "magic run bench_bigint" -bench_buint = "magic run bench_biguint" -bench_bdec = "magic run bench_bigdecimal" diff --git a/pixi.toml b/pixi.toml new file mode 100644 index 0000000..ee6656b --- /dev/null +++ b/pixi.toml @@ -0,0 +1,41 @@ +[project] +authors = ["ZHU Yuhao 朱宇浩 "] +channels = ["https://conda.modular.com/max", "https://repo.prefix.dev/modular-community", "conda-forge"] +# channels = ["https://conda.modular.com/max-nightly", "https://conda.modular.com/max", "https://repo.prefix.dev/modular-community", "conda-forge"] +description = "An arbitrary-precision decimal and integer mathematics library for Mojo" +license = "Apache-2.0" +name = "decimojo" +platforms = ["osx-arm64", "linux-64"] +readme = "README.md" +version = "0.3.1" + +[dependencies] +max = ">=25.2, <25.4" + +[tasks] +# format the code +format = "pixi run mojo format ./" + +# compile the package +package_decimojo = "pixi run mojo package src/decimojo && cp decimojo.mojopkg tests/ && cp decimojo.mojopkg benches/ && rm decimojo.mojopkg" +package_tomlmojo = "pixi run mojo package src/tomlmojo && mv tomlmojo.mojopkg tests/" +package = "pixi run format && pixi run package_decimojo && pixi run package_tomlmojo" +p = "clear && pixi run package" + +# clean the package files in tests folder +clean = "rm tests/decimojo.mojopkg && rm benches/decimojo.mojopkg && rm tests/tomlmojo.mojopkg" +c = "clear && pixi run clean" + +# tests (use the mojo testing tool) +test = "pixi run package && pixi run mojo test tests --filter" +t = "clear && pixi run package && pixi run mojo test tests --filter" + +# benches +bench_decimal = "clear && pixi run package && cd benches/decimal && pixi run mojo -I ../ bench.mojo && cd ../.. && pixi run clean" +bench_bigint = "clear && pixi run package && cd benches/bigint && pixi run mojo -I ../ bench.mojo && cd ../.. && pixi run clean" +bench_biguint = "clear && pixi run package && cd benches/biguint && pixi run mojo -I ../ bench.mojo && cd ../.. && pixi run clean" +bench_bigdecimal = "clear && pixi run package && cd benches/bigdecimal && pixi run mojo -I ../ bench.mojo && cd ../.. && pixi run clean" +bench_dec = "pixi run bench_decimal" +bench_bint = "pixi run bench_bigint" +bench_buint = "pixi run bench_biguint" +bench_bdec = "pixi run bench_bigdecimal"