From 6564e78ddb349b89f6a3e9bfa81ce357ce865961 Mon Sep 17 00:00:00 2001 From: Sebastiaan Huber Date: Tue, 23 Apr 2024 09:52:03 +0200 Subject: [PATCH] Devops: Use recursive dependencies for `pre-commit` extra (#6368) As of pip 21.2, it is possible to recursively reference extras in an extra requirement. This allows us to complete the `pre-commit` extra to install the other extras whose requirements are necessary as they are imported during pre-commit hooks. --- .github/workflows/ci-style.yml | 8 +------- pyproject.toml | 1 + .../migrations/versions/main_0000a_replace_nulls.py | 8 ++++---- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci-style.yml b/.github/workflows/ci-style.yml index 6454e4bffe..043a822e21 100644 --- a/.github/workflows/ci-style.yml +++ b/.github/workflows/ci-style.yml @@ -16,18 +16,12 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Install system dependencies - # note libkrb5-dev is required as a dependency for the gssapi pip install - run: | - sudo apt update - sudo apt install libkrb5-dev ruby ruby-dev - - name: Install python dependencies uses: ./.github/actions/install-aiida-core with: python-version: '3.10' extras: '[pre-commit]' - from-requirements: 'true' + from-requirements: 'false' - name: Run pre-commit run: pre-commit run --all-files || ( git status --short ; git diff ; exit 1 ) diff --git a/pyproject.toml b/pyproject.toml index 4d8543b6e2..5e78686955 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -210,6 +210,7 @@ notebook = [ 'notebook~=6.1,>=6.1.5' ] pre-commit = [ + 'aiida-core[atomic_tools,rest,tests,tui]', 'mypy~=1.7.1', 'packaging~=23.0', 'pre-commit~=2.2', diff --git a/src/aiida/storage/sqlite_zip/migrations/versions/main_0000a_replace_nulls.py b/src/aiida/storage/sqlite_zip/migrations/versions/main_0000a_replace_nulls.py index 22f8200f6d..af718dc302 100644 --- a/src/aiida/storage/sqlite_zip/migrations/versions/main_0000a_replace_nulls.py +++ b/src/aiida/storage/sqlite_zip/migrations/versions/main_0000a_replace_nulls.py @@ -42,8 +42,8 @@ def upgrade(): ) # remove rows with null values, which may have previously resulted from deletion of a user or computer - op.execute(db_dbauthinfo.delete().where(db_dbauthinfo.c.aiidauser_id.is_(None))) # type: ignore[arg-type] - op.execute(db_dbauthinfo.delete().where(db_dbauthinfo.c.dbcomputer_id.is_(None))) # type: ignore[arg-type] + op.execute(db_dbauthinfo.delete().where(db_dbauthinfo.c.aiidauser_id.is_(None))) + op.execute(db_dbauthinfo.delete().where(db_dbauthinfo.c.dbcomputer_id.is_(None))) op.execute(db_dbauthinfo.update().where(db_dbauthinfo.c.enabled.is_(None)).values(enabled=True)) op.execute(db_dbauthinfo.update().where(db_dbauthinfo.c.auth_params.is_(None)).values(auth_params={})) @@ -60,8 +60,8 @@ def upgrade(): ) # remove rows with null values, which may have previously resulted from deletion of a node or user - op.execute(db_dbcomment.delete().where(db_dbcomment.c.dbnode_id.is_(None))) # type: ignore[arg-type] - op.execute(db_dbcomment.delete().where(db_dbcomment.c.user_id.is_(None))) # type: ignore[arg-type] + op.execute(db_dbcomment.delete().where(db_dbcomment.c.dbnode_id.is_(None))) + op.execute(db_dbcomment.delete().where(db_dbcomment.c.user_id.is_(None))) op.execute(db_dbcomment.update().where(db_dbcomment.c.content.is_(None)).values(content='')) op.execute(db_dbcomment.update().where(db_dbcomment.c.ctime.is_(None)).values(ctime=timezone.now()))