Nix: Upgrade Python to the latest version.

There's no reason to pin it to v3.7. This wasn't causing the Docker
Compose issues; it's a dependency version issue.

We actually don't need to install `docker-compose` at all. It's now a
Docker plugin (and is bundled in Docker Desktop) since Docker Compose
v2. You can run it with `docker compose`.

This also fixes a bug in _dev.sh_ due to a moved `make` target.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5197
GitOrigin-RevId: 638b2eb39c99e7a990e7a6c66388831438aed45f
This commit is contained in:
Samir Talwar 2022-07-26 18:45:33 +02:00 committed by hasura-bot
parent a71007566b
commit a471c5080b

View File

@ -156,18 +156,19 @@ echo '12345' > "$PROJECT_ROOT/server/CURRENT_VERSION"
# Note: this does not help at all on 'nix' environments since 'pyenv' is not
# something you normally use under nix.
if command -v pyenv >/dev/null; then
# For now I guess use the greatest python3 >= 3.5
v=$(pyenv versions --bare | (grep '^ *3' || true) | awk '$1 >= 3.6 && $1 < 3.8 { print $1 }' | tail -n1)
if [ -z "$v" ]; then
# Use the latest version of Python installed with `pyenv`.
# Ensure that it is at least v3.6, so that format strings are supported.
v="$(pyenv versions --bare | (grep '^ *3' || true) | awk '$1 >= 3.6 { print $1 }' | tail -n1)"
if [[ -z "$v" ]]; then
# shellcheck disable=SC2016
echo_error 'Please `pyenv install` a version of python >= 3.6 so we can use it'
exit 2
fi
echo_pretty "Pyenv found. Using python version: $v"
echo_pretty "Pyenv found. Using Python version: $v"
export PYENV_VERSION=$v
python3 --version
else
echo_warn "Pyenv not installed. Proceeding with system python version: $(python3 --version)"
echo_warn "Pyenv not installed. Proceeding with Python from the path, version: $(python3 --version)"
fi
@ -550,7 +551,14 @@ elif [ "$MODE" = "test" ]; then
add_sources $HASURA_GRAPHQL_SERVER_PORT
cd "$PROJECT_ROOT/server/tests-py"
TEST_DIR="server/tests-py"
# Install and load Python test dependencies
PY_VENV="${TEST_DIR}/.hasura-dev-python-venv"
make "$PY_VENV"
source "${PY_VENV}/bin/activate"
cd "$TEST_DIR"
## Install misc test dependencies:
if [ ! -d "node_modules" ]; then
@ -558,13 +566,9 @@ elif [ "$MODE" = "test" ]; then
else
echo_pretty "It looks like node dependencies have been installed already. Skipping."
echo_pretty "If things fail please run this and try again"
echo_pretty " $ rm -r \"$PROJECT_ROOT/server/tests-py/node_modules\""
echo_pretty " $ rm -r \"${TEST_DIR}/node_modules\""
fi
PY_VENV=.hasura-dev-python-venv
make "$PY_VENV"
source "$PY_VENV/bin/activate"
# TODO MAYBE: fix deprecation warnings, make them an error
if ! pytest \
-W ignore::DeprecationWarning \