Skip to content

Commit

Permalink
Merge branch 'master' into test/python-3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhollas authored Jul 5, 2024
2 parents c5feca7 + 6075e7c commit a2f53fd
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ on:
pull_request:

env:
FORCE_COLOR: 1
FORCE_COLOR: "1"
UV_VERSION: "0.2.17"

# https://docs.github.com/en/actions/using-jobs/using-concurrency
concurrency:
Expand Down Expand Up @@ -43,7 +44,7 @@ jobs:
python-version: '3.11'

- name: Install uv
run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/0.2.13/uv-installer.sh | sh
run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/${UV_VERSION}/uv-installer.sh | sh

- name: Install package test dependencies
# Notebook tests happen in the container, here we only need to install
Expand Down Expand Up @@ -115,7 +116,7 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: Install uv
run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/0.2.13/uv-installer.sh | sh
run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/${UV_VERSION}/uv-installer.sh | sh

- name: Install package
# NOTE: uv (unlike pip) does not compile python to bytecode after install.
Expand All @@ -124,10 +125,10 @@ jobs:
# Ideally, these would be fixed, but vapory is largely unmaintained,
# so here we simply keep the pip behaviour with the --compile flag.
# See https://github.com/astral-sh/uv/issues/1928#issuecomment-1968857514
run: uv pip install --compile --system .[dev,smiles,optimade,eln] aiida-core==${{ matrix.aiida-core-version }}
run: uv pip install --compile --system -e .[dev,smiles,optimade,eln] aiida-core==${{ matrix.aiida-core-version }}

- name: Run pytest
run: pytest -v tests --cov
run: pytest -v tests --cov=aiidalab_widgets_base

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ci:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-json
- id: check-yaml
Expand All @@ -13,7 +13,7 @@ repos:
exclude: miscellaneous/structures

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.4
rev: v0.5.0
hooks:
- id: ruff-format
exclude: ^docs/.*
Expand All @@ -27,7 +27,7 @@ repos:
args: [--preserve-quotes]

- repo: https://github.com/sirosen/check-jsonschema
rev: 0.28.1
rev: 0.28.6
hooks:
- id: check-github-workflows

Expand Down
17 changes: 15 additions & 2 deletions aiidalab_widgets_base/computational_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -1196,16 +1196,26 @@ def on_setup_code(self, _=None):
"append_text",
]

containerized_code_additional_items = [
"image_name",
"engine_command",
]

kwargs = {key: getattr(self, key).value for key in items_to_configure}

# Check for additional keys needed for orm.ContainerizedCode
for container_key in containerized_code_additional_items:
if container_key in self.code_setup.keys():
kwargs[container_key] = self.code_setup[container_key]

# set computer from its widget value the UUID of the computer.
computer = orm.load_computer(self.computer.value)

# Checking if the code with this name already exists
qb = orm.QueryBuilder()
qb.append(orm.Computer, filters={"uuid": computer.uuid}, tag="computer")
qb.append(
orm.InstalledCode,
orm.AbstractCode,
with_computer="computer",
filters={"label": kwargs["label"]},
)
Expand All @@ -1223,7 +1233,10 @@ def on_setup_code(self, _=None):
return False

try:
code = orm.InstalledCode(computer=computer, **kwargs)
if "image_name" in kwargs.keys():
code = orm.ContainerizedCode(computer=computer, **kwargs)
else:
code = orm.InstalledCode(computer=computer, **kwargs)
except (common.exceptions.InputValidationError, KeyError) as exception:
self.message = wrap_message(
f"Invalid input for code creation: <code>{exception}</code>",
Expand Down

0 comments on commit a2f53fd

Please sign in to comment.