From cef4d3cc713c53137ea0080d7a387dc8202ef7d5 Mon Sep 17 00:00:00 2001 From: Achal Shah Date: Wed, 4 May 2022 10:50:32 -0700 Subject: [PATCH] chore: Fix Dockerfiles to install feast correctly (#2635) * chore: Fix Dockerfiles to install feast correctly Also removes an unsued python script since we use the pypa/gh-action-pypi-publish action to build and publish wheels now. Signed-off-by: Achal Shah * more fixes Signed-off-by: Achal Shah * add a verify step before we publish to pypi wheel Signed-off-by: Achal Shah * more fixes Signed-off-by: Achal Shah --- .github/workflows/publish.yml | 28 ++++++++--- CONTRIBUTING.md | 2 +- infra/scripts/publish-python-sdk.sh | 47 ------------------- .../docker-compose/feast10/Dockerfile | 2 +- sdk/python/feast/infra/aws.py | 2 +- .../infra/transformation_servers/Dockerfile | 6 ++- ui/feature_repo/README.md | 2 +- 7 files changed, 30 insertions(+), 59 deletions(-) delete mode 100755 infra/scripts/publish-python-sdk.sh diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 763cb52d0b..fd0f808250 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -127,7 +127,7 @@ jobs: publish-python-sdk: runs-on: ubuntu-latest - needs: [build-python-sdk, build-python-sdk-macos-py310] + needs: [verify-python-wheel] steps: - uses: actions/download-artifact@v2 with: @@ -139,20 +139,35 @@ jobs: password: ${{ secrets.PYPI_PASSWORD }} + verify-python-wheel: + runs-on: ubuntu-latest + needs: [build-python-sdk, build-python-sdk-macos-py310] + steps: + - name: Setup Python + id: setup-python + uses: actions/setup-python@v2 + with: + python-version: "3.8" + architecture: x64 + - uses: actions/download-artifact@v2 + with: + name: wheels + path: dist + - name: Install wheel + run: pip install dist/*38*linux*.whl + - name: Install sdist + run: pip install dist/*tar.gz + build-python-sdk: name: Build wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: matrix: os: [ ubuntu-latest, macos-10.15 ] - steps: - uses: actions/checkout@v2 - - name: Build wheels uses: pypa/cibuildwheel@v2.4.0 - with: - package-dir: sdk/python env: CIBW_BUILD: "cp3*_x86_64" CIBW_SKIP: "cp36-* *-musllinux_x86_64 cp310-macosx_x86_64" @@ -195,13 +210,12 @@ jobs: make install-go-ci-dependencies - name: Build run: | - cd sdk/python python3 setup.py sdist bdist_wheel - uses: actions/upload-artifact@v2 with: name: wheels - path: sdk/python/dist/* + path: dist/* publish-java-sdk: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 05dc1e3eda..249ea5afce 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -91,7 +91,7 @@ pip install --upgrade pip 4. Install development dependencies for Feast Python SDK / CLI ```sh -pip install -e "sdk/python[dev]" +pip install -e ".[dev]" ``` ### Code Style & Linting diff --git a/infra/scripts/publish-python-sdk.sh b/infra/scripts/publish-python-sdk.sh deleted file mode 100755 index 582d9072b2..0000000000 --- a/infra/scripts/publish-python-sdk.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -usage() -{ - echo "usage: publish-python-sdk.sh - - --directory-path absolute path to the python package, this directory - should contain 'setup.py' file - - --repository the repository name where the package will be uploaded, - check your .pypirc configuration file for the list of - valid repositories, usually it's 'pypi' or 'testpypi' -" -} - -while [ "$1" != "" ]; do - case "$1" in - --directory-path ) DIRECTORY_PATH="$2"; shift;; - --repository ) REPOSITORY="$2"; shift;; - -h | --help ) usage; exit;; - * ) usage; exit 1 - esac - shift -done - -if [ -z $DIRECTORY_PATH ]; then usage; exit 1; fi -if [ -z $REPOSITORY ]; then usage; exit 1; fi - -ORIGINAL_DIR=$PWD -cd $DIRECTORY_PATH - -echo "============================================================" -echo "Generating distribution archives" -echo "============================================================" -python3 -m pip install --user --upgrade setuptools wheel -python3 setup.py sdist bdist_wheel - -echo "============================================================" -echo "Uploading distribution archives" -echo "============================================================" -python3 -m pip install --user --upgrade twine -python3 -m twine upload --repository $REPOSITORY dist/* - -cd $ORIGINAL_DIR diff --git a/java/serving/src/test/resources/docker-compose/feast10/Dockerfile b/java/serving/src/test/resources/docker-compose/feast10/Dockerfile index df14bb592b..5a2291af15 100644 --- a/java/serving/src/test/resources/docker-compose/feast10/Dockerfile +++ b/java/serving/src/test/resources/docker-compose/feast10/Dockerfile @@ -6,7 +6,7 @@ COPY requirements.txt ./ RUN pip install --no-cache-dir -r requirements.txt RUN git clone https://github.com/feast-dev/feast.git /root/feast -RUN cd /root/feast/sdk/python && pip install -e '.[redis]' +RUN cd /root/feast/ && pip install -e '.[redis]' WORKDIR /app COPY . . diff --git a/sdk/python/feast/infra/aws.py b/sdk/python/feast/infra/aws.py index b7cc61de0e..14301faf19 100644 --- a/sdk/python/feast/infra/aws.py +++ b/sdk/python/feast/infra/aws.py @@ -347,7 +347,7 @@ def _get_docker_image_version() -> str: f"version {get_version()}. If you want to update the Feast SDK version, make " "sure to first fetch all new release tags from Github and then reinstall the library:\n" "> git fetch --all --tags\n" - "> pip install -e sdk/python" + "> pip install -e '.'" ) return version diff --git a/sdk/python/feast/infra/transformation_servers/Dockerfile b/sdk/python/feast/infra/transformation_servers/Dockerfile index 79997ce01b..ff276c7a70 100644 --- a/sdk/python/feast/infra/transformation_servers/Dockerfile +++ b/sdk/python/feast/infra/transformation_servers/Dockerfile @@ -6,10 +6,14 @@ COPY sdk/python/feast/infra/transformation_servers/app.py app.py # Copy necessary parts of the Feast codebase COPY sdk/python sdk/python COPY protos protos +COPY go go +COPY setup.py setup.py +COPY pyproject.toml pyproject.toml COPY README.md README.md + # Install dependencies -RUN pip3 install -e 'sdk/python' +RUN pip3 install -e '.' # Start feature transformation server CMD [ "python", "app.py" ] diff --git a/ui/feature_repo/README.md b/ui/feature_repo/README.md index db706e709e..de4bc1f4dc 100644 --- a/ui/feature_repo/README.md +++ b/ui/feature_repo/README.md @@ -18,7 +18,7 @@ git clone https://github.com/feast-dev/feast.git Install a dev build of feast ```bash cd feast -pip install -e "sdk/python[dev]" +pip install -e ".[dev]" ``` Then for this demo, you'll actually need to fix a bug by adding this to `type_map.py#L144`: