Skip to content

Commit 860a4ca

Browse files
committed
Merge branch 'main' into python-3.10.11
2 parents aeaa700 + 0639149 commit 860a4ca

File tree

10 files changed

+84
-37
lines changed

10 files changed

+84
-37
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,11 @@ jobs:
5555
runsOn: ubuntu-22.04
5656
platforms: linux/amd64,linux/arm64
5757

58-
# To save arm64 runner resources, we run the tests only on main
59-
# and only for full-stack image (same for integration tests below).
6058
test-arm64:
61-
#if: >-
62-
# github.repository == 'aiidalab/aiidalab-docker-stack'
63-
# && (github.ref_type == 'tag' || github.ref_name == 'main')
6459
needs: build
6560
uses: ./.github/workflows/test.yml
6661
with:
67-
runsOn: buildjet-4vcpu-ubuntu-2204-arm
62+
runsOn: ubuntu-22.04-arm
6863
images: ${{ needs.build.outputs.images }}
6964
target: full-stack
7065
integration: false
@@ -74,16 +69,8 @@ jobs:
7469
needs: build
7570
strategy:
7671
fail-fast: false
77-
# Trick to exclude arm64 tests from PRs
78-
# https://github.com/orgs/community/discussions/26253
7972
matrix:
80-
runner: [ubuntu-22.04, buildjet-4vcpu-ubuntu-2204-arm]
81-
isPR:
82-
- ${{ github.event_name == 'pull_request' }}
83-
#exclude:
84-
# - isPR: true
85-
# runner: buildjet-4vcpu-ubuntu-2204-arm
86-
73+
runner: [ubuntu-22.04, ubuntu-22.04-arm]
8774
uses: ./.github/workflows/test.yml
8875
with:
8976
runsOn: ${{ matrix.runner }}

.github/workflows/test.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ jobs:
5151
cache: pip
5252

5353
- name: Install dependencies 📦
54-
run: |
55-
pip install -r requirements.txt
56-
pip freeze
54+
run: pip install -r requirements.txt
5755

5856
- name: Run tests
5957
run: pytest -s -m "${{ inputs.integration && 'integration' || 'not integration' }}" --target ${{inputs.target}}

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ repos:
1818
args: [--preserve-quotes]
1919

2020
- repo: https://github.com/astral-sh/ruff-pre-commit
21-
rev: v0.6.9
21+
rev: v0.9.2
2222
hooks:
2323
- id: ruff-format
2424
- id: ruff
2525
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
2626

2727
- repo: https://github.com/python-jsonschema/check-jsonschema
28-
rev: "0.29.3"
28+
rev: "0.31.0"
2929
hooks:
3030
- id: check-dependabot
3131
- id: check-github-workflows

build.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
"default": "3.9.13"
1111
},
1212
"AIIDA_VERSION": {
13-
"default": "2.6.2"
13+
"default": "2.6.3"
1414
},
1515
"AIIDALAB_VERSION": {
1616
"default": "24.09.0"
1717
},
1818
"AIIDALAB_HOME_VERSION": {
19-
"default": "24.09.0"
19+
"default": "25.01.0"
2020
}
2121
}
2222
}

bumpver.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpver]
2-
current_version = "v2024.1023"
2+
current_version = "v2025.1025"
33
version_pattern = "vYYYY.BUILD[-TAG]"
44
commit_message = "Bump version {old_version} -> {new_version}."
55
commit = true

requirements.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
docker
2+
requests
3+
pre-commit
4+
pytest~=7.0
5+
pytest-docker
6+
doit
7+
dunamai

requirements.txt

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,32 @@
1-
docker
2-
requests
3-
pre-commit
4-
pytest~=7.0
5-
pytest-docker
6-
doit
7-
dunamai
1+
# This file was autogenerated by uv via the following command:
2+
# uv pip compile --universal --python 3.9 requirements.in --annotation-style=line -o requirements.txt
3+
attrs==24.3.0 # via pytest-docker
4+
certifi==2024.12.14 # via requests
5+
cfgv==3.4.0 # via pre-commit
6+
charset-normalizer==3.4.1 # via requests
7+
cloudpickle==3.1.1 # via doit
8+
colorama==0.4.6 ; sys_platform == 'win32' # via pytest
9+
distlib==0.3.9 # via virtualenv
10+
docker==7.1.0 # via -r requirements.in
11+
doit==0.36.0 # via -r requirements.in
12+
dunamai==1.23.0 # via -r requirements.in
13+
exceptiongroup==1.2.2 ; python_full_version < '3.11' # via pytest
14+
filelock==3.17.0 # via virtualenv
15+
identify==2.6.6 # via pre-commit
16+
idna==3.10 # via requests
17+
importlib-metadata==8.6.1 # via doit
18+
iniconfig==2.0.0 # via pytest
19+
nodeenv==1.9.1 # via pre-commit
20+
packaging==24.2 # via dunamai, pytest
21+
platformdirs==4.3.6 # via virtualenv
22+
pluggy==1.5.0 # via pytest
23+
pre-commit==4.1.0 # via -r requirements.in
24+
pytest==7.4.4 # via pytest-docker, -r requirements.in
25+
pytest-docker==3.1.1 # via -r requirements.in
26+
pywin32==308 ; sys_platform == 'win32' # via docker
27+
pyyaml==6.0.2 # via pre-commit
28+
requests==2.32.3 # via docker, -r requirements.in
29+
tomli==2.2.1 ; python_full_version < '3.11' # via pytest
30+
urllib3==2.3.0 # via docker, requests
31+
virtualenv==20.29.1 # via pre-commit
32+
zipp==3.21.0 # via importlib-metadata

stack/base/Dockerfile

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,19 @@ RUN cat /opt/requirements.txt | xargs -I{} conda config --system --add pinned_pa
4242

4343
# Configure pip to use the same requirements file as constraints file.
4444
ENV PIP_CONSTRAINT /opt/requirements.txt
45-
# Ensure that pip installs packages to ~/.local by default
46-
COPY pip.conf /etc/pip.conf
45+
# Ensure that pip installs packages to '~/.local/lib/python3.X/site-packages/' by default
46+
# by implicitly passing the '--user' option to 'pip install'
47+
# Otherwise, pip would install into /opt/conda and such packages would be lost
48+
# when the container exits.
49+
# NOTE: We specifically chose the location '/opt/conda/pip.conf'
50+
# which represents the 'site' config file when VIRTUAL_ENV is not set, per:
51+
# https://pip.pypa.io/en/stable/topics/configuration/#configuration-files
52+
# Other locations such as '~/.config/pip/pip.conf' or '/etc/pip.conf' would interfere with virtual environments,
53+
# for example those used by pre-commit.
54+
# We can't use the PIP_USER env variable for the same reason.
55+
# To better understand this, try running `pip config debug` and see
56+
# https://github.com/aiidalab/aiidalab-docker-stack/issues/501
57+
COPY pip.conf "${CONDA_DIR}/pip.conf"
4758

4859
# Upgrade pip and mamba to latest
4960
# Update async_generator, certipy to satisfy `pip check`

tests/conftest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import pytest
55
import requests
6-
from requests.exceptions import ConnectionError
6+
from requests.exceptions import ConnectionError # noqa: A004
77

88
TARGETS = ("base", "lab", "base-with-services", "full-stack")
99

@@ -112,11 +112,11 @@ def pip_install(aiidalab_exec, nb_user):
112112
def _pip_install(pkg, **args):
113113
nonlocal package
114114
package = pkg
115-
return aiidalab_exec(f"pip install {pkg}", **args)
115+
return aiidalab_exec(f"pip install {pkg}", user=nb_user, **args)
116116

117117
yield _pip_install
118118
if package:
119-
aiidalab_exec(f"pip uninstall --yes {package}")
119+
aiidalab_exec(f"pip uninstall --yes {package}", user=nb_user)
120120

121121

122122
@pytest.fixture(scope="session")

tests/test_base.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
"""This module contains tests for the base image, which are AiiDA and package management related tests."""
22

3+
import email
34
import json
45

56
import pytest
67
from packaging.version import parse
78

89

10+
@pytest.fixture
11+
def venv(tmp_path, aiidalab_exec):
12+
venv_path = tmp_path / ".venv"
13+
aiidalab_exec(f"python -m venv {venv_path}")
14+
return venv_path
15+
16+
917
@pytest.mark.parametrize("pkg_manager", ["pip", "mamba"])
1018
def test_prevent_installation_of_aiida(
1119
aiidalab_exec, nb_user, aiida_version, pkg_manager
@@ -76,8 +84,6 @@ def test_path_local_pip(aiidalab_exec, nb_user):
7684

7785
def test_pip_user_install(aiidalab_exec, pip_install, nb_user):
7886
"""Test that pip installs packages to ~/.local/ by default"""
79-
import email
80-
8187
# We use 'tuna' as an example of python-only package without dependencies
8288
pkg = "tuna"
8389
pip_install(pkg)
@@ -86,3 +92,16 @@ def test_pip_user_install(aiidalab_exec, pip_install, nb_user):
8692
# `pip show` output is in the RFC-compliant email header format
8793
msg = email.message_from_string(output)
8894
assert msg.get("Location").startswith(f"/home/{nb_user}/.local/")
95+
96+
97+
def test_pip_install_in_venv(aiidalab_exec, venv, nb_user):
98+
"""Test that pip installs packages to an activated venv"""
99+
100+
pkg = "tuna"
101+
pip = venv / "bin/pip"
102+
103+
aiidalab_exec(f"{pip} install {pkg}")
104+
105+
output = aiidalab_exec(f"{pip} show {pkg}")
106+
msg = email.message_from_string(output)
107+
assert msg.get("Location").startswith(f"{venv}/lib")

0 commit comments

Comments
 (0)