Use uv in mac

This commit is contained in:
Cheng
2025-07-30 15:02:49 +09:00
parent aaa7b822cc
commit acc09ed3a7

View File

@@ -75,8 +75,8 @@ jobs:
- run: - run:
name: Run style checks name: Run style checks
command: | command: |
pip install pre-commit curl -LsSf https://astral.sh/uv/install.sh | sh
pre-commit run --all uvx pre-commit run --all
if ! git diff --quiet; then echo 'Style checks failed, please install pre-commit and run pre-commit run --all and push the change'; exit 1; fi if ! git diff --quiet; then echo 'Style checks failed, please install pre-commit and run pre-commit run --all and push the change'; exit 1; fi
- run: - run:
name: Install dependencies name: Install dependencies
@@ -87,7 +87,6 @@ jobs:
pip install --upgrade cmake pip install --upgrade cmake
sudo apt-get install -y libblas-dev liblapack-dev liblapacke-dev sudo apt-get install -y libblas-dev liblapack-dev liblapacke-dev
sudo apt-get install openmpi-bin openmpi-common libopenmpi-dev sudo apt-get install openmpi-bin openmpi-common libopenmpi-dev
curl -LsSf https://astral.sh/uv/install.sh | sh
- run: - run:
name: Install Python package name: Install Python package
command: | command: |
@@ -138,33 +137,30 @@ jobs:
- run: - run:
name: Install dependencies name: Install dependencies
command: | command: |
brew install python@3.9
brew install openmpi brew install openmpi
python3.9 -m venv env curl -LsSf https://astral.sh/uv/install.sh | sh
source env/bin/activate uv venv --python 3.9
pip install --upgrade pip uv pip install \
pip install --upgrade cmake nanobind==2.4.0 \
pip install nanobind==2.4.0 cmake \
pip install numpy numpy \
pip install torch torch \
pip install tensorflow tensorflow \
pip install unittest-xml-reporting unittest-xml-reporting
- run: - run:
name: Install Python package name: Install Python package
command: | command: |
source env/bin/activate
DEBUG=1 CMAKE_ARGS="-DCMAKE_COMPILE_WARNING_AS_ERROR=ON" \ DEBUG=1 CMAKE_ARGS="-DCMAKE_COMPILE_WARNING_AS_ERROR=ON" \
pip install -e . -v uv pip install -e .
- run: - run:
name: Generate package stubs name: Generate package stubs
command: | command: |
source env/bin/activate uv pip install typing_extensions
pip install typing_extensions uv run --no-project setup.py generate_stubs
python setup.py generate_stubs
- run: - run:
name: Run Python tests name: Run Python tests
command: | command: |
source env/bin/activate source .venv/bin/activate
LOW_MEMORY=1 DEVICE=cpu python -m xmlrunner discover -v python/tests -o test-results/cpu LOW_MEMORY=1 DEVICE=cpu python -m xmlrunner discover -v python/tests -o test-results/cpu
LOW_MEMORY=1 DEVICE=gpu METAL_DEVICE_WRAPPER_TYPE=1 METAL_DEBUG_ERROR_MODE=0 python -m xmlrunner discover -v python/tests -o test-results/gpu LOW_MEMORY=1 DEVICE=gpu METAL_DEVICE_WRAPPER_TYPE=1 METAL_DEBUG_ERROR_MODE=0 python -m xmlrunner discover -v python/tests -o test-results/gpu
mpirun --bind-to none -host localhost:8 -np 8 -x DYLD_LIBRARY_PATH=/opt/homebrew/lib/ python python/tests/mpi_test_distributed.py mpirun --bind-to none -host localhost:8 -np 8 -x DYLD_LIBRARY_PATH=/opt/homebrew/lib/ python python/tests/mpi_test_distributed.py
@@ -173,16 +169,15 @@ jobs:
- run: - run:
name: Build example extension name: Build example extension
command: | command: |
source env/bin/activate
cd examples/extensions cd examples/extensions
pip install -r requirements.txt uv pip install -r requirements.txt
python setup.py build_ext -j8 uv run --no-project setup.py build_ext -j8
- store_test_results: - store_test_results:
path: test-results path: test-results
- run: - run:
name: Build CPP only name: Build CPP only
command: | command: |
source env/bin/activate source .venv/bin/activate
mkdir -p build && cd build && cmake .. && make -j `sysctl -n hw.ncpu` mkdir -p build && cd build && cmake .. && make -j `sysctl -n hw.ncpu`
- run: - run:
name: Run CPP tests name: Run CPP tests