From 1a5cc9a4ce29e69149ef8fbe44a625edcb2cb7d6 Mon Sep 17 00:00:00 2001 From: openhands Date: Thu, 2 Jan 2025 19:12:08 +0000 Subject: [PATCH] Fix lint error and add GitHub workflow for Python client tests --- .github/workflows/python-client-tests.yml | 40 +++++++++++++++++++++++ moondream/torch/image_crops.py | 2 +- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/python-client-tests.yml diff --git a/.github/workflows/python-client-tests.yml b/.github/workflows/python-client-tests.yml new file mode 100644 index 00000000..fecbcb46 --- /dev/null +++ b/.github/workflows/python-client-tests.yml @@ -0,0 +1,40 @@ +name: Python Client Tests + +on: + push: + paths: + - 'clients/python/**' + - '.github/workflows/python-client-tests.yml' + pull_request: + paths: + - 'clients/python/**' + - '.github/workflows/python-client-tests.yml' + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.10', '3.11', '3.12'] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install Poetry + run: | + curl -sSL https://install.python-poetry.org | python3 - + + - name: Install dependencies + working-directory: ./clients/python + run: | + poetry install + + - name: Run tests + working-directory: ./clients/python + run: | + poetry run pytest tests/test_local_inference.py -v \ No newline at end of file diff --git a/moondream/torch/image_crops.py b/moondream/torch/image_crops.py index 00a48e0b..928fcf03 100644 --- a/moondream/torch/image_crops.py +++ b/moondream/torch/image_crops.py @@ -2,7 +2,7 @@ import numpy as np import torch -from typing import TypedDict, Union +from typing import TypedDict from PIL import Image