Skip to content

Commit

Permalink
Pin aiida-core version (#440)
Browse files Browse the repository at this point in the history
Prevent Apps from messing with aiida-core installation.
If users need to use a specific AiiDA version, they should use
the corresponding AiiDAlab image.
  • Loading branch information
danielhollas authored Apr 2, 2024
1 parent 2f88e21 commit c1aeaec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions stack/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ WORKDIR /opt/

ARG AIIDA_VERSION

# Pin shared requirements in the base environemnt.
# The lower bound of aiida-core is set to the version of aiida-core to prevent
# lower aiida-core DB version installed and trigger database downgrade.
# Pin shared requirements in the base environment.
# We pin aiida-core to the exact installed version,
# to prevent accidental upgrade or downgrade, that might
# induce DB migration or break shared dependencies of AiiDAlab Apps.
RUN echo "pip==23.3.1" > /opt/requirements.txt && \
echo "aiida-core>=${AIIDA_VERSION},<3" >> /opt/requirements.txt
echo "aiida-core==${AIIDA_VERSION}" >> /opt/requirements.txt

# Install the shared requirements.
RUN mamba install --yes \
Expand Down
4 changes: 2 additions & 2 deletions tests/test-base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
from packaging.version import parse


@pytest.mark.parametrize("incompatible_version", ["1.6.3"])
@pytest.mark.parametrize("incompatible_version", ["2.3.0"])
def test_prevent_pip_install_of_incompatible_aiida_version(
aiidalab_exec, nb_user, aiida_version, incompatible_version
):
package_manager = "pip"
assert parse(aiida_version) != parse(incompatible_version)
# Expected to succeed:
# Expected to succeed, although should be a no-op.
aiidalab_exec(
f"{package_manager} install aiida-core=={aiida_version}", user=nb_user
)
Expand Down

0 comments on commit c1aeaec

Please sign in to comment.