Skip to content

Commit

Permalink
Merge branch 'main' into comments-typing
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhollas authored Feb 13, 2025
2 parents 21db8da + d2fbf21 commit f70d2a6
Show file tree
Hide file tree
Showing 41 changed files with 3,143 additions and 692 deletions.
2 changes: 1 addition & 1 deletion .docker/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
docker~=7.0.0
pytest~=8.2.0
requests~=2.32.0
pytest-docker~=3.1.0
pytest-docker~=3.2.0
4 changes: 2 additions & 2 deletions .docker/tests/test_aiida.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


def test_correct_python_version_installed(aiida_exec, python_version):
info = json.loads(aiida_exec('mamba list --json --full-name python').decode())[0]
info = json.loads(aiida_exec('mamba list --json --full-name python', ignore_stderr=True).decode())[0]
assert info['name'] == 'python'
assert parse(info['version']) == parse(python_version)

Expand All @@ -15,7 +15,7 @@ def test_correct_pgsql_version_installed(aiida_exec, pgsql_version, variant):
if variant == 'aiida-core-base':
pytest.skip('PostgreSQL is not installed in the base image')

info = json.loads(aiida_exec('mamba list --json --full-name postgresql').decode())[0]
info = json.loads(aiida_exec('mamba list --json --full-name postgresql', ignore_stderr=True).decode())[0]
assert info['name'] == 'postgresql'
assert parse(info['version']).major == parse(pgsql_version).major

Expand Down
4 changes: 2 additions & 2 deletions .github/actions/install-aiida-core/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ runs:
python-version: ${{ inputs.python-version }}

- name: Set up uv
uses: astral-sh/[email protected].0
uses: astral-sh/[email protected].1
with:
version: 0.5.x
version: 0.5.22
python-version: ${{ inputs.python-version }}

- name: Install dependencies from uv lock
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/ci-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: aiida-pytests-py3.9
file: ./coverage.xml
files: ./coverage.xml
fail_ci_if_error: false # don't fail job, if coverage upload fails

tests-presto:
Expand Down Expand Up @@ -126,8 +126,6 @@ jobs:
with:
python-version: '3.12'
from-lock: 'true'
# NOTE: The `verdi devel check-undesired-imports` fails if
# the 'tui' extra is installed.
extras: ''

- name: Run verdi tests
Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,11 @@ jobs:
images: ${{ needs.build.outputs.images }}
registry: ghcr.io

# IMPORTANT: To save arm64 runners resources,
# we run the test only when pushing to main.
# We also only test the aiida-core-dev image.
test-arm64:
needs: build
if: >-
github.repository == 'aiidateam/aiida-core'
&& (github.ref_type == 'tag' || github.ref_name == 'main')
uses: ./.github/workflows/docker-test.yml
with:
runsOn: buildjet-4vcpu-ubuntu-2204-arm
runsOn: ubuntu-22.04-arm
images: ${{ needs.build.outputs.images }}
target: aiida-core-dev

Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/test-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,13 @@ jobs:
python-version: '3.11'

- name: Set up uv
uses: astral-sh/[email protected].0
uses: astral-sh/[email protected].1
with:
version: 0.5.x
version: latest

- name: Install utils/ dependencies
run: uv pip install --system -r utils/requirements.txt

- name: Validate uv lockfile
run: uv lock --check

- name: Validate conda environment file
run: python ./utils/dependency_management.py validate-environment-yml

Expand Down
20 changes: 7 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ci:
autofix_prs: true
autoupdate_commit_msg: 'Devops: Update pre-commit dependencies'
autoupdate_schedule: quarterly
skip: [mypy, check-uv-lock, generate-conda-environment, validate-conda-environment, verdi-autodocs]
skip: [mypy, generate-conda-environment, validate-conda-environment, verdi-autodocs]

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand Down Expand Up @@ -56,6 +56,12 @@ repos:
environment.yml|
)$
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.5.22
hooks:
# Check and update the uv lockfile
- id: uv-lock

- repo: local

hooks:
Expand Down Expand Up @@ -183,18 +189,6 @@ repos:
src/aiida/workflows/arithmetic/multiply_add.py|
)$
- id: check-uv-lock
name: Check uv lockfile up to date
# NOTE: This will not automatically update the lockfile
entry: uv lock --check
language: system
pass_filenames: false
files: >-
(?x)^(
pyproject.toml|
uv.lock|
)$
- id: generate-conda-environment
name: Update conda environment file
entry: python ./utils/dependency_management.py generate-environment-yml
Expand Down
4 changes: 2 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ build:
# https://docs.readthedocs.io/en/stable/build-customization.html#install-dependencies-with-uv
pre_create_environment:
- asdf plugin add uv
- asdf install uv 0.5.20
- asdf global uv 0.5.20
- asdf install uv 0.5.22
- asdf global uv 0.5.22
create_environment:
- uv venv
install:
Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ dependencies:
- python~=3.9
- alembic~=1.2
- archive-path~=0.4.2
- asyncssh~=2.19.0
- circus~=0.18.0
- click-spinner~=0.1.8
- click~=8.1
Expand Down
10 changes: 9 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ classifiers = [
dependencies = [
'alembic~=1.2',
'archive-path~=0.4.2',
"asyncssh~=2.19.0",
'circus~=0.18.0',
'click-spinner~=0.1.8',
'click~=8.1',
Expand Down Expand Up @@ -175,6 +176,7 @@ requires-python = '>=3.9'
[project.entry-points.'aiida.transports']
'core.local' = 'aiida.transports.plugins.local:LocalTransport'
'core.ssh' = 'aiida.transports.plugins.ssh:SshTransport'
'core.ssh_async' = 'aiida.transports.plugins.ssh_async:AsyncSshTransport'
'core.ssh_auto' = 'aiida.transports.plugins.ssh_auto:SshAutoTransport'

[project.entry-points.'aiida.workflows']
Expand Down Expand Up @@ -308,6 +310,7 @@ module = 'tests.*'
ignore_missing_imports = true
module = [
'ase.*',
'asyncssh.*',
'bpython.*',
'bs4.*',
'CifFile.*',
Expand Down Expand Up @@ -388,6 +391,7 @@ testpaths = [
'tests'
]
timeout = 240
timeout_method = "thread"
xfail_strict = true

[tool.ruff]
Expand Down Expand Up @@ -512,4 +516,8 @@ commands = molecule {posargs:test}
"""

[tool.uv]
required-version = ">=0.5.20"
# NOTE: When you bump the minimum uv version, you also need to change it in:
# .pre-commit-config.yaml
# .github/actions/install-aiida-core/action.yml
# .readthedocs.yml
required-version = ">=0.5.21"
12 changes: 8 additions & 4 deletions src/aiida/cmdline/commands/cmd_devel.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,11 @@ def devel_check_load_time():
def devel_check_undesired_imports():
"""Check that verdi does not import python modules it shouldn't.
Note: The blacklist was taken from the list of packages in the 'atomic_tools' extra but can be extended.
This is to keep the verdi CLI snappy, especially for tab-completion.
"""
loaded_modules = 0

for modulename in [
'asyncio',
unwanted_modules = [
'requests',
'plumpy',
'disk_objectstore',
Expand All @@ -78,7 +77,12 @@ def devel_check_undesired_imports():
'spglib',
'pymysql',
'yaml',
]:
]
# trogon powers the optional TUI and uses asyncio.
# Check for asyncio only when the optional tui extras are not installed.
if 'trogon' not in sys.modules:
unwanted_modules += 'asyncio'
for modulename in unwanted_modules:
if modulename in sys.modules:
echo.echo_warning(f'Detected loaded module "{modulename}"')
loaded_modules += 1
Expand Down
7 changes: 7 additions & 0 deletions src/aiida/common/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,13 @@ class IncompatibleDatabaseSchema(ConfigurationError): # noqa: N818
"""


class IncompatibleExternalDependencies(ConfigurationError): # noqa: N818
"""Raised when incomptabale external depencies are found.
This could happen, when the dependency is not a python package and therefore not checked during installation.
"""


class IncompatibleStorageSchema(IncompatibleDatabaseSchema):
"""Raised when the storage schema is incompatible with that of the code."""

Expand Down
Loading

0 comments on commit f70d2a6

Please sign in to comment.