name: Python on: push: branches: - main pull_request: paths: - python/** - .github/workflows/python.yml concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: lint: name: "Lint" timeout-minutes: 30 runs-on: "ubuntu-22.04" defaults: run: shell: bash working-directory: python steps: - uses: actions/checkout@v4 with: fetch-depth: 0 lfs: true - name: Set up Python uses: actions/setup-python@v5 with: python-version: "3.12" - name: Install ruff run: | pip install ruff==0.9.9 - name: Format check run: ruff format --check . - name: Lint run: ruff check . type-check: name: "Type Check" timeout-minutes: 30 runs-on: "ubuntu-22.04" defaults: run: shell: bash working-directory: python steps: - uses: actions/checkout@v4 with: fetch-depth: 0 lfs: true - name: Set up Python uses: actions/setup-python@v5 with: python-version: "3.12" - name: Install protobuf compiler run: | sudo apt update sudo apt install -y protobuf-compiler pip install toml - name: Install dependencies run: | python ../ci/parse_requirements.py pyproject.toml --extras dev,tests,embeddings > requirements.txt pip install -r requirements.txt - name: Run pyright run: pyright doctest: name: "Doctest" timeout-minutes: 30 runs-on: "ubuntu-24.04" defaults: run: shell: bash working-directory: python steps: - uses: actions/checkout@v4 with: fetch-depth: 0 lfs: true - name: Set up Python uses: actions/setup-python@v5 with: python-version: "3.12" cache: "pip" - name: Install protobuf run: | sudo apt update sudo apt install -y protobuf-compiler - uses: Swatinem/rust-cache@v2 with: workspaces: python - name: Install run: | pip install --extra-index-url https://pypi.fury.io/lancedb/ -e .[tests,dev,embeddings] pip install tantivy pip install mlx - name: Doctest run: pytest --doctest-modules python/lancedb linux: name: "Linux: python-3.${{ matrix.python-minor-version }}" timeout-minutes: 30 strategy: matrix: python-minor-version: ["9", "12"] runs-on: "ubuntu-24.04" defaults: run: shell: bash working-directory: python steps: - uses: actions/checkout@v4 with: fetch-depth: 0 lfs: true - name: Install protobuf run: | sudo apt update sudo apt install -y protobuf-compiler - name: Set up Python uses: actions/setup-python@v5 with: python-version: 3.${{ matrix.python-minor-version }} - uses: Swatinem/rust-cache@v2 with: workspaces: python - uses: ./.github/workflows/build_linux_wheel - uses: ./.github/workflows/run_tests with: integration: true # Make sure wheels are not included in the Rust cache - name: Delete wheels run: rm -rf target/wheels platform: name: "Mac: ${{ matrix.config.name }}" timeout-minutes: 30 strategy: matrix: config: - name: x86 runner: macos-13 - name: Arm runner: macos-14 runs-on: "${{ matrix.config.runner }}" defaults: run: shell: bash working-directory: python steps: - uses: actions/checkout@v4 with: fetch-depth: 0 lfs: true - name: Set up Python uses: actions/setup-python@v5 with: python-version: "3.12" - uses: Swatinem/rust-cache@v2 with: workspaces: python - uses: ./.github/workflows/build_mac_wheel - uses: ./.github/workflows/run_tests # Make sure wheels are not included in the Rust cache - name: Delete wheels run: rm -rf target/wheels windows: name: "Windows: ${{ matrix.config.name }}" timeout-minutes: 60 strategy: matrix: config: - name: x86 runner: windows-latest runs-on: "${{ matrix.config.runner }}" defaults: run: shell: bash working-directory: python steps: - uses: actions/checkout@v4 with: fetch-depth: 0 lfs: true - name: Set up Python uses: actions/setup-python@v5 with: python-version: "3.12" - uses: Swatinem/rust-cache@v2 with: workspaces: python - uses: ./.github/workflows/build_windows_wheel - uses: ./.github/workflows/run_tests # Make sure wheels are not included in the Rust cache - name: Delete wheels run: rm -rf target/wheels pydantic1x: timeout-minutes: 30 runs-on: "ubuntu-24.04" defaults: run: shell: bash working-directory: python steps: - uses: actions/checkout@v4 with: fetch-depth: 0 lfs: true - name: Install dependencies run: | sudo apt update sudo apt install -y protobuf-compiler - name: Set up Python uses: actions/setup-python@v5 with: python-version: 3.9 - name: Install lancedb run: | pip install "pydantic<2" pip install --extra-index-url https://pypi.fury.io/lancedb/ -e .[tests] pip install tantivy - name: Run tests run: pytest -m "not slow and not s3_test" -x -v --durations=30 python/tests