From 6f84c2cb88da0399aa742b81d680ce531f057f32 Mon Sep 17 00:00:00 2001 From: Rui Zhang <45241093+Raysilience@users.noreply.github.com> Date: Mon, 17 Jun 2024 17:59:51 +0800 Subject: [PATCH] feat: disable installation of milvus-lite on windows platform Since the project is managed by setuptools, and according to the [setuptools](https://setuptools.pypa.io/en/latest/userguide/dependency_management.html), we can disable the automatic installation of milvus-lite on windows platform by adding environment markers. Following [PEP508](https://peps.python.org/pep-0508/), I pick the environment marker "sys_platform != 'win32'" to prevent the installation. I build packages after the modification. Then test the .tar.gz and the .whl files both on my windows laptop and a linux docker. The issue mentioned in #2131 seems gone. Due the lack of macOS machine, I could not perform testing on that particular platform. Please check validity before merging. enhance: Check PyMilvus on Windows platform See also: #2131, #2134, #2131 Co-Authored-by: rui zhang Signed-off-by: yangxuan --- .github/workflows/check_milvus_proto.yml | 2 +- .github/workflows/code_checker.yml | 2 +- .github/workflows/pull_request.yml | 3 ++- Makefile | 2 +- pyproject.toml | 1 + tests/test_milvus_lite.py | 4 +++- 6 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/check_milvus_proto.yml b/.github/workflows/check_milvus_proto.yml index 5c4f2e307..00bf479c2 100644 --- a/.github/workflows/check_milvus_proto.yml +++ b/.github/workflows/check_milvus_proto.yml @@ -26,7 +26,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -e . + pip install -e ".[dev]" - name: Try generate proto run: | diff --git a/.github/workflows/code_checker.yml b/.github/workflows/code_checker.yml index 10488b616..fa70b4722 100644 --- a/.github/workflows/code_checker.yml +++ b/.github/workflows/code_checker.yml @@ -19,7 +19,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: check pyproject.toml install + - name: Check pyproject.toml install run: | pip install -e . - name: Install requirements diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 74389642a..78e8c20b1 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -8,10 +8,11 @@ on: jobs: build: name: Run Python Tests - runs-on: ubuntu-latest strategy: matrix: python-version: [3.8, 3.12] + os: [ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} steps: - name: Checkout code diff --git a/Makefile b/Makefile index 2dfd51128..642fa4043 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ get_proto: git submodule update --init gen_proto: - python3 -m pip install -e ".[dev]" + pip install -e ".[dev]" cd pymilvus/grpc_gen && ./python_gen.sh check_proto_product: gen_proto diff --git a/pyproject.toml b/pyproject.toml index 53d56f2e2..08ce1eb38 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,6 +25,7 @@ dependencies=[ "pandas>=1.2.4", "numpy<1.25.0;python_version<='3.8'", "milvus_lite>=2.4.0,<2.5.0", + "milvus-lite>=2.4.0,<2.5.0;sys_platform!='win32'", ] classifiers=[ diff --git a/tests/test_milvus_lite.py b/tests/test_milvus_lite.py index ef4f49274..0149fd5bc 100644 --- a/tests/test_milvus_lite.py +++ b/tests/test_milvus_lite.py @@ -1,12 +1,14 @@ import os +import sys from tempfile import TemporaryDirectory import numpy as np +import pytest from pymilvus.milvus_client import MilvusClient +@pytest.mark.skipif(sys.platform.startswith('win'), reason="Milvus Lite is not supported on Windows") class TestMilvusLite: - def test_milvus_lite(self): with TemporaryDirectory(dir='./') as root: db_file = os.path.join(root, 'test.db')