Skip to content

Commit

Permalink
Fix Python version pin (#2085)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathbunnyru committed Jan 21, 2024
1 parent 8d0ec50 commit a4ede5d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion images/docker-stacks-foundation/Dockerfile
Expand Up @@ -117,7 +117,8 @@ RUN set -x && \
'jupyter_core' && \
rm -rf /tmp/bin/ && \
# Pin major.minor version of python
mamba list python | grep '^python ' | tr -s ' ' | cut -d ' ' -f 1,2 >> "${CONDA_DIR}/conda-meta/pinned" && \
# https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-pkgs.html#preventing-packages-from-updating-pinning
mamba list --full-name 'python' | tail -1 | tr -s ' ' | cut -d ' ' -f 1,2 | sed 's/\.[^.]*$/.*/' >> "${CONDA_DIR}/conda-meta/pinned" && \
mamba clean --all -f -y && \
fix-permissions "${CONDA_DIR}" && \
fix-permissions "/home/${NB_USER}"
Expand Down
10 changes: 10 additions & 0 deletions tests/docker-stacks-foundation/test_python_version.py
Expand Up @@ -22,3 +22,13 @@ def test_python_version(container: TrackedContainer) -> None:
major_minor_version = full_version[: full_version.rfind(".")]

assert major_minor_version == EXPECTED_PYTHON_VERSION


def test_python_pinned_version(container: TrackedContainer) -> None:
LOGGER.info(f"Checking that pinned python version is {EXPECTED_PYTHON_VERSION}.*")
logs = container.run_and_wait(
timeout=5,
tty=True,
command=["cat", "/opt/conda/conda-meta/pinned"],
)
assert logs.startswith(f"python {EXPECTED_PYTHON_VERSION}.*")

0 comments on commit a4ede5d

Please sign in to comment.