From ddc018fd77a35620fa1df7994dd5a5f0017bf9b5 Mon Sep 17 00:00:00 2001 From: James Robinson Date: Tue, 25 Jul 2023 13:15:35 +0100 Subject: [PATCH 1/2] :recycle: Replace poetry with pip-compile for better dependency solving --- .../cloud_init/resources/pyenv_install.sh | 23 ++++++++----------- .../packages/packages-python.yaml | 3 +-- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/deployment/secure_research_desktop/cloud_init/resources/pyenv_install.sh b/deployment/secure_research_desktop/cloud_init/resources/pyenv_install.sh index 555c46c14f..2770f82466 100644 --- a/deployment/secure_research_desktop/cloud_init/resources/pyenv_install.sh +++ b/deployment/secure_research_desktop/cloud_init/resources/pyenv_install.sh @@ -27,24 +27,19 @@ echo "Installed $(${EXE_PATH}/python --version)" # Install and upgrade installation prerequisites # ---------------------------------------------- echo "Installing and upgrading installation prerequisites for Python ${PYTHON_VERSION}..." -${EXE_PATH}/pip install --upgrade pip poetry +${EXE_PATH}/pip install --upgrade pip pip-tools setuptools -# Solve dependencies and install using poetry -# ------------------------------------------- -echo "Installing packages with poetry..." -${EXE_PATH}/poetry config virtualenvs.create false -${EXE_PATH}/poetry config virtualenvs.in-project true -rm poetry.lock pyproject.toml 2> /dev/null -sed -e "s/PYTHON_VERSION/$PYTHON_VERSION/" /opt/build/pyenv/pyproject_template.toml > $PYPROJECT_TOML -ln -s $PYPROJECT_TOML pyproject.toml -${EXE_PATH}/poetry add $(tr '\n' ' ' < $REQUIREMENTS_TXT) || exit 3 +# Solve dependencies and write package versions to monitoring log +# --------------------------------------------------------------- +echo "Determining package versions with pip-compile..." +${EXE_PATH}/pip-compile -o "$MONITORING_LOG" "$REQUIREMENTS_TXT" -# Write package versions to monitoring log -# ---------------------------------------- -${EXE_PATH}/poetry show > $MONITORING_LOG -${EXE_PATH}/poetry show --tree >> $MONITORING_LOG +# Install pinned packages using pip +# --------------------------------- +echo "Installing packages with pip..." +${EXE_PATH}/pip install -r "$MONITORING_LOG" # Run any post-install commands diff --git a/deployment/secure_research_desktop/packages/packages-python.yaml b/deployment/secure_research_desktop/packages/packages-python.yaml index 879788d373..d520b3d60e 100644 --- a/deployment/secure_research_desktop/packages/packages-python.yaml +++ b/deployment/secure_research_desktop/packages/packages-python.yaml @@ -39,9 +39,8 @@ packages: pathos: pg8000: Pillow: + pip-tools: plotly: - poetry: # also used by installation scripts - "all": [">1.0.0"] # increase solver flexibility prophet: psycopg2: pydot: From b176e94cdbdceb0e6c49407191bd8271c637f397 Mon Sep 17 00:00:00 2001 From: James Robinson Date: Tue, 25 Jul 2023 13:15:00 +0100 Subject: [PATCH 2/2] :coffin: Remove pyproject.toml --- .../cloud-init-buildimage-ubuntu-1804.mustache.yaml | 5 ----- .../cloud-init-buildimage-ubuntu-2004.mustache.yaml | 5 ----- .../cloud-init-buildimage-ubuntu-2204.mustache.yaml | 5 ----- .../cloud_init/resources/pyenv_install.sh | 1 - .../resources/pyenv_pyproject_template.toml | 12 ------------ 5 files changed, 28 deletions(-) delete mode 100644 deployment/secure_research_desktop/cloud_init/resources/pyenv_pyproject_template.toml diff --git a/deployment/secure_research_desktop/cloud_init/cloud-init-buildimage-ubuntu-1804.mustache.yaml b/deployment/secure_research_desktop/cloud_init/cloud-init-buildimage-ubuntu-1804.mustache.yaml index 44e1bb4397..8f450ead3d 100644 --- a/deployment/secure_research_desktop/cloud_init/cloud-init-buildimage-ubuntu-1804.mustache.yaml +++ b/deployment/secure_research_desktop/cloud_init/cloud-init-buildimage-ubuntu-1804.mustache.yaml @@ -114,11 +114,6 @@ write_files: content: | {{packages-python.yaml}} - - path: "/opt/build/pyenv/pyproject_template.toml" - permissions: "0400" - content: | - {{pyenv_pyproject_template.toml}} - - path: "/opt/build/rstudio.debinfo" permissions: "0400" content: | diff --git a/deployment/secure_research_desktop/cloud_init/cloud-init-buildimage-ubuntu-2004.mustache.yaml b/deployment/secure_research_desktop/cloud_init/cloud-init-buildimage-ubuntu-2004.mustache.yaml index 5605e07707..575de168d0 100644 --- a/deployment/secure_research_desktop/cloud_init/cloud-init-buildimage-ubuntu-2004.mustache.yaml +++ b/deployment/secure_research_desktop/cloud_init/cloud-init-buildimage-ubuntu-2004.mustache.yaml @@ -114,11 +114,6 @@ write_files: content: | {{packages-python.yaml}} - - path: "/opt/build/pyenv/pyproject_template.toml" - permissions: "0400" - content: | - {{pyenv_pyproject_template.toml}} - - path: "/opt/build/rstudio.debinfo" permissions: "0400" content: | diff --git a/deployment/secure_research_desktop/cloud_init/cloud-init-buildimage-ubuntu-2204.mustache.yaml b/deployment/secure_research_desktop/cloud_init/cloud-init-buildimage-ubuntu-2204.mustache.yaml index 17527746cb..059dece327 100644 --- a/deployment/secure_research_desktop/cloud_init/cloud-init-buildimage-ubuntu-2204.mustache.yaml +++ b/deployment/secure_research_desktop/cloud_init/cloud-init-buildimage-ubuntu-2204.mustache.yaml @@ -118,11 +118,6 @@ write_files: content: | {{packages-python.yaml}} - - path: "/opt/build/pyenv/pyproject_template.toml" - permissions: "0400" - content: | - {{pyenv_pyproject_template.toml}} - - path: "/opt/build/rbase.debinfo" permissions: "0400" content: | diff --git a/deployment/secure_research_desktop/cloud_init/resources/pyenv_install.sh b/deployment/secure_research_desktop/cloud_init/resources/pyenv_install.sh index 2770f82466..56898d3915 100644 --- a/deployment/secure_research_desktop/cloud_init/resources/pyenv_install.sh +++ b/deployment/secure_research_desktop/cloud_init/resources/pyenv_install.sh @@ -9,7 +9,6 @@ if [ $# -ne 1 ]; then fi PYTHON_VERSION=$1 PYENV_ROOT="$(pyenv root)" -PYPROJECT_TOML="/opt/build/python-${PYTHON_VERSION}-pyproject.toml" MONITORING_LOG="/opt/monitoring/python-${PYTHON_VERSION}-package-versions.log" REQUIREMENTS_TXT="/opt/build/python-${PYTHON_VERSION}-requirements.txt" REQUESTED_PACKAGE_LIST="/opt/build/packages/packages-python-${PYTHON_VERSION}.list" diff --git a/deployment/secure_research_desktop/cloud_init/resources/pyenv_pyproject_template.toml b/deployment/secure_research_desktop/cloud_init/resources/pyenv_pyproject_template.toml deleted file mode 100644 index 3f0998952a..0000000000 --- a/deployment/secure_research_desktop/cloud_init/resources/pyenv_pyproject_template.toml +++ /dev/null @@ -1,12 +0,0 @@ -[tool.poetry] -name = "Python PYTHON_VERSION" -version = "1.0.0" -description = "Python PYTHON_VERSION" -authors = ["ROOT "] - -[tool.poetry.dependencies] -python = "PYTHON_VERSION" - -[build-system] -requires = ["poetry-core>=1.0.0"] -build-backend = "poetry.core.masonry.api"