Skip to content

Commit 3dc66a7

Browse files
committed
Use uv in macOS CI
1 parent 80bcd1c commit 3dc66a7

6 files changed

Lines changed: 52 additions & 35 deletions

File tree

.github/actions/build-macos-release/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ runs:
2121
DEVELOPER_DIR: /Applications/Xcode-latest.app
2222
MACOSX_DEPLOYMENT_TARGET: ${{ inputs.macos-target }}
2323
run: |
24-
pip install build
24+
uv pip install build
2525
python setup.py clean --all
2626
MLX_BUILD_STAGE=1 python -m build -w
2727

.github/actions/build-macos/action.yml

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,61 +4,72 @@ description: 'Build and test MLX on macOS'
44
runs:
55
using: "composite"
66
steps:
7-
- name: Install dependencies
7+
- name: Install Python package
88
env:
99
DEBUG: 1
1010
CMAKE_ARGS: "-DCMAKE_COMPILE_WARNING_AS_ERROR=ON"
11-
shell: bash -l {0}
11+
shell: bash
1212
run: |
13-
pip install --upgrade pip
14-
pip install cmake setuptools typing_extensions
15-
pip install -e ".[dev]" -v
13+
echo "::group::Install Python package"
14+
uv pip install -e ".[dev]" -v
15+
echo "::endgroup::"
1616
1717
- name: Install tests dependencies
18-
shell: bash -l {0}
18+
shell: bash
1919
run: |
20-
pip install tensorflow
20+
echo "::group::Install tests dependencies"
21+
uv pip install tensorflow
22+
echo "::endgroup::"
2123
2224
- name: Run Python tests
23-
shell: bash -l {0}
25+
shell: bash
2426
env:
2527
LOW_MEMORY: 1
2628
run: |
29+
echo "::group::Run Python tests"
2730
DEVICE=cpu python -m unittest discover -v python/tests
2831
DEVICE=gpu METAL_DEVICE_WRAPPER_TYPE=1 METAL_DEBUG_ERROR_MODE=0 python -m unittest discover -v python/tests
2932
mpirun --bind-to none -host localhost:8 -np 8 -x DYLD_LIBRARY_PATH=/opt/homebrew/lib/ python python/tests/mpi_test_distributed.py
3033
mlx.launch --verbose -n 8 python/tests/ring_test_distributed.py -v 2> >(tee -a stderr.log >&2)
3134
if $(grep "\[WARN\]" stderr.log); then echo "Distributed ring test failed"; exit 1; fi
32-
35+
echo "::endgroup::"
36+
3337
- name: Build example extension
34-
shell: bash -l {0}
38+
shell: bash
3539
run: |
40+
echo "::group::Build example extension"
3641
cd examples/extensions
37-
pip install -r requirements.txt
38-
python setup.py build_ext --inplace
39-
python test.py
40-
42+
uv pip install -r requirements.txt
43+
uv run --no-project setup.py build_ext --inplace
44+
uv run --no-project test.py
45+
echo "::endgroup::"
46+
4147
- name: Build CPP only
42-
shell: bash -l {0}
48+
shell: bash
4349
run: |
50+
echo "::group::Build CPP only"
4451
mkdir -p build
4552
cd build
4653
cmake ..
4754
make -j $(sysctl -n hw.ncpu)
55+
echo "::endgroup::"
4856
4957
- name: Run CPP tests
50-
shell: bash -l {0}
58+
shell: bash
5159
env:
5260
DEVICE: gpu
5361
METAL_DEVICE_WRAPPER_TYPE: 1
5462
METAL_DEBUG_ERROR_MODE: 0
5563
run: |
64+
echo "::group::Run CPP tests"
5665
./build/tests/tests
5766
./build/tests/test_teardown
67+
echo "::endgroup::"
5868
5969
- name: Build small binary with JIT
60-
shell: bash -l {0}
70+
shell: bash
6171
run: |
72+
echo "::group::Build small binary with JIT"
6273
mkdir -p build
6374
cd build
6475
cmake .. -DCMAKE_BUILD_TYPE=MinSizeRel \
@@ -68,15 +79,18 @@ runs:
6879
-DMLX_BUILD_GGUF=OFF \
6980
-DMLX_METAL_JIT=ON
7081
make -j $(sysctl -n hw.ncpu)
71-
82+
echo "::endgroup::"
83+
7284
- name: Run Python tests with JIT
73-
shell: bash -l {0}
85+
shell: bash
7486
env:
7587
LOW_MEMORY: 1
7688
DEVICE: gpu
7789
METAL_DEVICE_WRAPPER_TYPE: 1
7890
METAL_DEBUG_ERROR_MODE: 0
7991
run: |
92+
echo "::group::Run Python tests with JIT"
8093
CMAKE_ARGS="-DMLX_METAL_JIT=ON" \
81-
pip install -e . -v
94+
uv pip install -e . -v
8295
python -m unittest discover -v python/tests
96+
echo "::endgroup::"

.github/actions/setup-macos/action.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,20 @@ runs:
1313
- name: Install Homebrew packages
1414
shell: sh
1515
run: /opt/homebrew/bin/brew install openmpi
16-
16+
1717
- name: Verify MetalToolchain installed
1818
shell: bash
1919
run: xcodebuild -showComponent MetalToolchain
2020

21-
- uses: conda-incubator/setup-miniconda@v3
22-
with:
23-
miniconda-version: "latest"
24-
python-version: ${{ inputs.python-version }}
21+
- uses: astral-sh/setup-uv@v7
22+
23+
- name: Setup Python venv
24+
shell: bash
25+
run: |
26+
echo "::group::Setup Python venv"
27+
uv venv --python ${{ inputs.python-version }}
28+
source .venv/bin/activate
29+
echo PATH=$PATH >> $GITHUB_ENV
30+
# Search python packages in .venv
31+
echo PYTHONPATH=`python -c 'import sys; print(sys.path[-1])'` >> $GITHUB_ENV
32+
echo "::endgroup::"

.github/workflows/release.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,8 @@ jobs:
9393
- uses: ./.github/actions/setup-macos
9494
with:
9595
python-version: ${{ matrix.python-version }}
96-
97-
- name: Install dependencies
98-
shell: bash -l {0}
99-
run: |
100-
pip install --upgrade pip
101-
pip install cmake setuptools typing_extensions
102-
pip install -e . -v
96+
- name: Install Python package
97+
run: uv pip install -e . -v
10398
- name: Build macOS 14 package
10499
uses: ./.github/actions/build-macos-release
105100
with:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
setuptools>=42
22
cmake>=3.25
3-
mlx>=0.21.0
3+
mlx>=0.32.0
44
nanobind==2.12.0

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def get_tag(self) -> tuple[str, str, str]:
234234
"ml_dtypes",
235235
"numpy>=2",
236236
"pre-commit",
237-
"psutil",
237+
"psutil>=7.2",
238238
"torch>=2.9",
239239
"typing_extensions",
240240
],

0 commit comments

Comments
 (0)