From 6114e47edeed78e49358044df92549b79d55b53b Mon Sep 17 00:00:00 2001 From: tokoko Date: Sat, 17 Aug 2024 09:30:16 +0000 Subject: [PATCH] chore: auto-detect python version in Makefile Signed-off-by: tokoko --- Makefile | 13 +++++++------ docs/project/development-guide.md | 20 ++++++++++++-------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 5e3bd0d9135..7119bad856d 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,7 @@ ifeq ($(shell uname -s), Darwin) OS = osx endif TRINO_VERSION ?= 376 +PYTHON_VERSION = ${shell python --version | grep -Eo '[0-9]\.[0-9]+'} # General @@ -37,22 +38,22 @@ build: protos build-java build-docker # Python SDK install-python-ci-dependencies: - python -m piptools sync sdk/python/requirements/py$(PYTHON)-ci-requirements.txt + python -m piptools sync sdk/python/requirements/py$(PYTHON_VERSION)-ci-requirements.txt pip install --no-deps -e . python setup.py build_python_protos --inplace install-python-ci-dependencies-uv: - uv pip sync --system sdk/python/requirements/py$(PYTHON)-ci-requirements.txt + uv pip sync --system sdk/python/requirements/py$(PYTHON_VERSION)-ci-requirements.txt uv pip install --system --no-deps -e . python setup.py build_python_protos --inplace install-python-ci-dependencies-uv-venv: - uv pip sync sdk/python/requirements/py$(PYTHON)-ci-requirements.txt + uv pip sync sdk/python/requirements/py$(PYTHON_VERSION)-ci-requirements.txt uv pip install --no-deps -e . python setup.py build_python_protos --inplace lock-python-ci-dependencies: - uv pip compile --system --no-strip-extras setup.py --extra ci --output-file sdk/python/requirements/py$(PYTHON)-ci-requirements.txt + uv pip compile --system --no-strip-extras setup.py --extra ci --output-file sdk/python/requirements/py$(PYTHON_VERSION)-ci-requirements.txt package-protos: cp -r ${ROOT_DIR}/protos ${ROOT_DIR}/sdk/python/feast/protos @@ -61,11 +62,11 @@ compile-protos-python: python setup.py build_python_protos --inplace install-python: - python -m piptools sync sdk/python/requirements/py$(PYTHON)-requirements.txt + python -m piptools sync sdk/python/requirements/py$(PYTHON_VERSION)-requirements.txt python setup.py develop lock-python-dependencies: - uv pip compile --system --no-strip-extras setup.py --output-file sdk/python/requirements/py$(PYTHON)-requirements.txt + uv pip compile --system --no-strip-extras setup.py --output-file sdk/python/requirements/py$(PYTHON_VERSION)-requirements.txt lock-python-dependencies-all: pixi run --environment py39 --manifest-path infra/scripts/pixi/pixi.toml "uv pip compile --system --no-strip-extras setup.py --output-file sdk/python/requirements/py3.9-requirements.txt" diff --git a/docs/project/development-guide.md b/docs/project/development-guide.md index e3b09294bc3..cec4f68dafc 100644 --- a/docs/project/development-guide.md +++ b/docs/project/development-guide.md @@ -132,8 +132,7 @@ Setting up your development environment for Feast Python SDK / CLI: source venv/bin/activate ``` 4. (M1 Mac only): Follow the [dev guide](https://github.com/feast-dev/feast/issues/2105) -5. Install uv -It is recommended to use uv for managing python dependencies. +5. Install uv. It is recommended to use uv for managing python dependencies. ```sh curl -LsSf https://astral.sh/uv/install.sh | sh ``` @@ -145,21 +144,26 @@ pip install uv ``` make build-ui ``` -7. (Optional) install pixi -pixi is necessary to run step 8 for all python versions at once. +7. (Optional) install pixi. pixi is necessary to run step 8 for all python versions at once. ```sh curl -fsSL https://pixi.sh/install.sh | bash ``` -8. (Optional): Recompile python lock files -If you make changes to requirements or simply want to update python lock files to reflect latest versioons. +8. (Optional): Recompile python lock files. Only when you make changes to requirements or simply want to update python lock files to reflect latest versioons. ```sh make lock-python-dependencies-all ``` -9. Install development dependencies for Feast Python SDK / CLI -This will install package versions from the lock file, install editable version of feast and compile protobufs. +9. Install development dependencies for Feast Python SDK / CLI. This will install package versions from the lock file, install editable version of feast and compile protobufs. + +If running inside a virtual environment: +```sh +make install-python-ci-dependencies-uv-venv +``` + +Otherwise: ```sh make install-python-ci-dependencies-uv ``` + 10. Spin up Docker Image ```sh docker build -t docker-whale -f ./sdk/python/feast/infra/feature_servers/multicloud/Dockerfile .