Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion client/python/cli/polaris_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,5 +191,9 @@ def _get_client_builder(options):
return lambda: ApiClient(config)


if __name__ == "__main__":
def main():
PolarisCli.execute()


if __name__ == "__main__":
main()
11 changes: 10 additions & 1 deletion client/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,18 @@ dependencies = [
homepage = "https://polaris.apache.org/"
repository = "https://github.com/apache/polaris/"

[project.scripts]
polaris = "cli.polaris_cli:main"

[tool.poetry]
requires-poetry = "==2.1.3"
packages = [{ include = "polaris" }]
packages = [
{ include = "polaris" },
{ include = "cli" }
]
include = [
"polaris/**"
]

[tool.poetry.group.test.dependencies]
pytest = ">= 7.2.1"
Expand Down
12 changes: 8 additions & 4 deletions polaris
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ if [ ! -d "${dir}"/polaris-venv ] || [ "$repair" == true ]; then
pip install --upgrade pip
pip install --upgrade -r regtests/requirements.txt

cp "${dir}"/client/python/pyproject.toml "${dir}"
pushd "$dir" && poetry install ; popd
(cd "${dir}/client/python" && poetry install)

deactivate

Expand All @@ -63,5 +62,10 @@ if [ ! -d "${dir}"/polaris-venv ] || [ "$repair" == true ]; then
fi
fi

cd "$dir"
env PYTHONPATH=client/python SCRIPT_DIR="$dir" "${dir}"/polaris-venv/bin/python3 client/python/cli/polaris_cli.py "$@"
# Check if the correct virtual environment is already active, if not, activate it.
if [ -z "$VIRTUAL_ENV" ] || [ "$(realpath "$VIRTUAL_ENV")" != "$(realpath "${dir}/polaris-venv")" ]; then
source "${dir}/polaris-venv/bin/activate"
fi

export SCRIPT_DIR="${dir}"
exec polaris "$@"
14 changes: 8 additions & 6 deletions regtests/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,19 @@ ENV PYTHONPATH="${SPARK_HOME}/python/:${SPARK_HOME}/python/lib/py4j-0.10.9.7-src

# Copy and run setup.sh separately so that test sources can change, but the setup script run is still cached
WORKDIR /home/spark/polaris
COPY ./regtests/setup.sh /home/spark/polaris/regtests/setup.sh
COPY ./regtests/pyspark-setup.sh /home/spark/polaris/regtests/pyspark-setup.sh
COPY ./client/python /home/spark/polaris/client/python
COPY ./polaris /home/spark/polaris/polaris
COPY ./regtests/requirements.txt /tmp/
COPY --chown=spark ./regtests/setup.sh /home/spark/polaris/regtests/setup.sh
COPY --chown=spark ./regtests/pyspark-setup.sh /home/spark/polaris/regtests/pyspark-setup.sh
COPY --chown=spark ./client/python /home/spark/polaris/client/python
COPY --chown=spark ./polaris /home/spark/polaris/polaris
COPY --chown=spark ./regtests/requirements.txt /tmp/

RUN python3 -m venv /home/spark/polaris/polaris-venv && \
. /home/spark/polaris/polaris-venv/bin/activate && \
pip install -r /tmp/requirements.txt && \
cd /home/spark/polaris/client/python && \
poetry install && \
deactivate \
./regtests/setup.sh
/home/spark/polaris/regtests/setup.sh

COPY --chown=spark ./regtests /home/spark/polaris/regtests

Expand Down
Loading