Skip to content

Commit

Permalink
Devops: Use recursive dependencies for pre-commit extra (#6368)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sphuber authored Apr 23, 2024
1 parent 73a734a commit 6564e78
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/ci-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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={}))
Expand All @@ -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()))
Expand Down

0 comments on commit 6564e78

Please sign in to comment.