diff --git a/.github/workflows/smoke_tests.yml b/.github/workflows/smoke_tests.yml new file mode 100644 index 0000000000..a8d4c3bae5 --- /dev/null +++ b/.github/workflows/smoke_tests.yml @@ -0,0 +1,38 @@ +name: smoke-tests + +on: [pull_request] +jobs: + unit-test-python: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + python-version: [ "3.9", "3.10", "3.11"] + os: [ ubuntu-latest ] + env: + OS: ${{ matrix.os }} + PYTHON: ${{ matrix.python-version }} + steps: + - uses: actions/checkout@v4 + - name: Setup Python + id: setup-python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + architecture: x64 + - name: Install uv + run: | + curl -LsSf https://astral.sh/uv/install.sh | sh + - name: Get uv cache dir + id: uv-cache + run: | + echo "::set-output name=dir::$(uv cache dir)" + - name: uv cache + uses: actions/cache@v4 + with: + path: ${{ steps.uv-cache.outputs.dir }} + key: ${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-uv-${{ hashFiles(format('**/py{0}-ci-requirements.txt', env.PYTHON)) }} + - name: Install dependencies + run: make install-python-dependencies-uv + - name: Test Imports + run: pixi run python -c "from feast import cli" \ No newline at end of file diff --git a/Makefile b/Makefile index 78a0b6d328..924724bc9e 100644 --- a/Makefile +++ b/Makefile @@ -37,6 +37,21 @@ build: protos build-java build-docker # Python SDK +install-python-dependencies: + python -m piptools sync sdk/python/requirements/py$(PYTHON_VERSION)-requirements.txt + pip install --no-deps . + python setup.py build_python_protos --inplace + +install-python-dependencies-uv: + uv pip sync --system sdk/python/requirements/py$(PYTHON_VERSION)-requirements.txt + uv pip install --system --no-deps . + python setup.py build_python_protos --inplace + +install-python-dependencies-uv-venv: + uv pip sync sdk/python/requirements/py$(PYTHON_VERSION)-requirements.txt + uv pip install --no-deps . + python setup.py build_python_protos --inplace + install-python-ci-dependencies: python -m piptools sync sdk/python/requirements/py$(PYTHON_VERSION)-ci-requirements.txt pip install --no-deps -e . diff --git a/sdk/python/feast/errors.py b/sdk/python/feast/errors.py index 4dbb220c1e..3665a02361 100644 --- a/sdk/python/feast/errors.py +++ b/sdk/python/feast/errors.py @@ -1,11 +1,13 @@ import importlib import json import logging -from typing import Any, List, Optional, Set +from typing import TYPE_CHECKING, Any, List, Optional, Set from colorama import Fore, Style from fastapi import status as HttpStatusCode -from grpc import StatusCode as GrpcStatusCode + +if TYPE_CHECKING: + from grpc import StatusCode as GrpcStatusCode from feast.field import Field @@ -15,7 +17,7 @@ class FeastError(Exception): pass - def grpc_status_code(self) -> GrpcStatusCode: + def grpc_status_code(self) -> "GrpcStatusCode": return GrpcStatusCode.INTERNAL def http_status_code(self) -> int: @@ -89,7 +91,7 @@ def __init__(self, ds_name: str): class FeastObjectNotFoundException(FeastError): pass - def grpc_status_code(self) -> GrpcStatusCode: + def grpc_status_code(self) -> "GrpcStatusCode": return GrpcStatusCode.NOT_FOUND def http_status_code(self) -> int: @@ -504,7 +506,7 @@ class FeastPermissionError(FeastError, PermissionError): def __init__(self, details: str): super().__init__(f"Permission error:\n{details}") - def grpc_status_code(self) -> GrpcStatusCode: + def grpc_status_code(self) -> "GrpcStatusCode": return GrpcStatusCode.PERMISSION_DENIED def http_status_code(self) -> int: