From 15811a9fc3448aa7048ca7c8342927478b116c41 Mon Sep 17 00:00:00 2001 From: Chip Kent <chipkent@deephaven.io> Date: Thu, 25 Apr 2024 14:57:22 -0600 Subject: [PATCH 1/2] DH version to 0.33.3 Java version to 17 --- .github/workflows/Dockerfile.pip | 4 ++-- .github/workflows/build-and-publish.yml | 6 +++--- docker/dev/Dockerfile | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/Dockerfile.pip b/.github/workflows/Dockerfile.pip index 5eb27210..e0de4e5e 100644 --- a/.github/workflows/Dockerfile.pip +++ b/.github/workflows/Dockerfile.pip @@ -2,10 +2,10 @@ FROM ubuntu:22.04 RUN apt update && \ - apt install -y openjdk-11-jdk python3-pip python3-venv curl zip && \ + apt install -y openjdk-17-jdk python3-pip python3-venv curl zip && \ pip3 install --upgrade pip setuptools wheel -ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/ +ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64/ COPY ./wheels /wheels COPY ./ib-wheels /ib-wheels diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index c6d7318e..af5b3345 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -13,7 +13,7 @@ on: env: IB_VERSION: 10.19.01 - DH_VERSION: 0.28.1 + DH_VERSION: 0.33.3 jobs: build-ib-whl: @@ -114,7 +114,7 @@ jobs: - name: Apt installs run: | sudo apt update - sudo apt install -y openjdk-11-jdk + sudo apt install -y openjdk-17-jdk - name: Pip installs run: pip3 install --upgrade sphinx==4.2.0 sphinx-autodoc-typehints furo==2021.10.9 - name: Download IB wheels @@ -132,7 +132,7 @@ jobs: - name: Run Sphinx working-directory: ./sphinx env: - JAVA_HOME: /usr/lib/jvm/java-11-openjdk-amd64 + JAVA_HOME: /usr/lib/jvm/java-17-openjdk-amd64 run: | make html touch build/html/.nojekyll diff --git a/docker/dev/Dockerfile b/docker/dev/Dockerfile index 18351e1f..4b0fa0d4 100644 --- a/docker/dev/Dockerfile +++ b/docker/dev/Dockerfile @@ -11,12 +11,12 @@ ARG DH_VERSION # Install requirements RUN apt update && \ - apt install -y openjdk-11-jdk && \ - ln -s /usr/lib/jvm/java-11-openjdk-*/ /usr/lib/jvm/java-11-openjdk && \ + apt install -y openjdk-17-jdk && \ + ln -s /usr/lib/jvm/java-17-openjdk-*/ /usr/lib/jvm/java-17-openjdk && \ apt install --yes git python3-venv python3-pip curl unzip && \ pip3 install --upgrade pip setuptools wheel build -ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk +ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk # Build and install ibapi From d338575af33df72cf79e33dfb2d783e0b4eaf3c8 Mon Sep 17 00:00:00 2001 From: Chip Kent <chipkent@deephaven.io> Date: Wed, 28 Aug 2024 11:39:32 -0600 Subject: [PATCH 2/2] Assert that the python version meets the required minimum. Update the default deephaven version to 0.36.1 --- dhib_env.py | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/dhib_env.py b/dhib_env.py index c3bbc42f..3e494d5d 100755 --- a/dhib_env.py +++ b/dhib_env.py @@ -15,7 +15,8 @@ import requests IB_VERSION_DEFAULT="10.19.04" -DH_VERSION_DEFAULT="0.34.1" +DH_VERSION_DEFAULT="0.36.1" +MIN_PY_VERSION="3.10.0" ######################################################################################################################## # Version Numbers @@ -197,6 +198,36 @@ def pkg_dependencies(path_or_module: Union[str, Path, ModuleType]) -> Dict[str, ######################################################################################################################## +def python_version(python: str) -> tuple[int, ...]: + """Get the version of Python. + + Args: + python: The path to the Python executable. + + Returns: + A tuple of integers representing the version of Python. + """ + cmd = f"{python} --version" + logging.warning(f"Getting Python version: {cmd}") + version = os.popen(cmd).read().strip().split(" ")[1] + return version_tuple(version) + +def assert_python_version(python: str) -> None: + """Assert that the version of Python is at least the minimum required version. + + Args: + python: The path to the Python executable. + + Raises: + ValueError: If the version of Python is less than the minimum required version. + """ + version = python_version(python) + min_version = version_tuple(MIN_PY_VERSION) + + if version < min_version: + raise ValueError(f"Python version {version_str(version, True)} is less than the minimum required version {version_str(min_version, True)}.") + + class Pyenv: """A python environment.""" @@ -431,6 +462,8 @@ def ib_wheel( python = Path(python).absolute() if python.startswith("./") else python logging.warning(f"Using system python: {python}") + assert_python_version(python) + pyenv = Pyenv(python) ib_wheel = IbWheel(ib_version) @@ -463,6 +496,8 @@ def dhib_wheel( python = Path(python).absolute() if python.startswith("./") else python logging.warning(f"Using system python: {python}") + assert_python_version(python) + pyenv = Pyenv(python) logging.warning(f"Building deephaven-ib from source: {dh_ib_version}") @@ -500,6 +535,7 @@ def dev( logging.warning(f"Creating development environment: python={python} dh_version={dh_version}, dh_version_exact={dh_version_exact}, ib_version={ib_version}, dh_ib_version={dh_ib_version}, delete_vm_if_exists={delete_venv}") python = Path(python).absolute() if python.startswith("./") else python + assert_python_version(python) if dh_version_exact: if dh_version != DH_VERSION_DEFAULT: @@ -572,6 +608,7 @@ def release( logging.warning(f"Creating release environment: python={python} dh_ib_version={dh_ib_version}") python = Path(python).absolute() if python.startswith("./") else python + assert_python_version(python) wheel = download_wheel(python, "deephaven_ib", dh_ib_version) deps = pkg_dependencies(wheel)