Skip to content

Commit

Permalink
Merge branch 'main' into update/docker-container
Browse files Browse the repository at this point in the history
  • Loading branch information
yakutovicha authored Mar 13, 2024
2 parents 61f164b + 4714825 commit d45c079
Show file tree
Hide file tree
Showing 52 changed files with 18,921 additions and 464 deletions.
3 changes: 1 addition & 2 deletions .docker/cp2k-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ label: cp2k
computer: localhost
description:
input_plugin: cp2k
on_computer: True
remote_abs_path: /opt/conda/envs/cp2k/bin/cp2k.psmp
filepath_executable: /opt/conda/envs/cp2k/bin/cp2k.psmp
append_text:
prepend_text: "conda activate cp2k"
10 changes: 10 additions & 0 deletions .docker/init/add-codes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash -e

# Debugging
set -x

# Environment
export SHELL=/bin/bash

# Install cp2k code.
verdi code show cp2k@localhost || verdi code create core.code.installed --config /home/aiida/aiida-cp2k/.docker/cp2k-code.yml --non-interactive
7 changes: 0 additions & 7 deletions .docker/my_init.d/add-codes.sh

This file was deleted.

10 changes: 0 additions & 10 deletions .docker/opt/add-codes.sh

This file was deleted.

Empty file.
1 change: 1 addition & 0 deletions .docker/s6-rc.d/cp2k-code-setup/timeout-up
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
1 change: 1 addition & 0 deletions .docker/s6-rc.d/cp2k-code-setup/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
oneshot
7 changes: 7 additions & 0 deletions .docker/s6-rc.d/cp2k-code-setup/up
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/command/execlineb -S0

with-contenv

foreground { s6-echo "Setting up CP2K code" }

/etc/init/add-codes.sh
Empty file added .docker/user/cp2k-code-setup
Empty file.
8 changes: 3 additions & 5 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
[flake8]
# Recommend matching the black line length (default 88),
# rather than using the flake8 default of 79:
max-line-length = 88
extend-ignore =
E501 # Line length handled by black.
W503 # Line break before binary operator, preferred formatting for black.
E203 # Whitespace before ':', preferred formatting for black.
E501
W503
E203
exclude =
docs/source/conf.py
6 changes: 2 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ jobs:
- name: Create container from aiida_cp2k_test image and test the plugin inside
run: |
export DOCKERID=`docker run -d aiida_cp2k_test`
docker exec --tty $DOCKERID wait-for-services
sleep 5
docker logs $DOCKERID
docker exec --tty --user aiida $DOCKERID /bin/bash -l -c 'cd /opt/aiida-cp2k/ && py.test --cov aiida_cp2k --cov-append .'
docker exec --tty --user aiida $DOCKERID /bin/bash -l -c 'cd /home/aiida/aiida-cp2k/ && py.test --cov aiida_cp2k --cov-append .'
pre-commit:
Expand All @@ -68,7 +68,6 @@ jobs:
run: |
pip install --upgrade pip
pip install -e .[dev,docs]
reentry scan
- name: Run pre-commit
run: |
pre-commit install
Expand All @@ -90,7 +89,6 @@ jobs:
run: |
pip install --upgrade pip
pip install -e .[docs,dev]
reentry scan
- name: Build docs
run: cd docs && make
15 changes: 9 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
---
ci:
autoupdate_schedule: quarterly

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
rev: v4.4.0
hooks:

- id: check-json
Expand All @@ -16,32 +19,32 @@ repos:
exclude: *exclude_pre_commit_hooks

- repo: https://github.com/psf/black
rev: 22.3.0
rev: 23.9.1
hooks:
- id: black
language_version: python3 # Should be a command that runs python3.6+
exclude: aiida_cp2k/workchains/base.py

- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
rev: 6.1.0
hooks:
- id: flake8
args: [--count, --show-source, --statistics]

- repo: https://github.com/pycqa/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort
args: [--profile, black, --filter-files]

- repo: https://github.com/asottile/pyupgrade
rev: v2.32.1
rev: v3.14.0
hooks:
- id: pyupgrade
args: [--py37-plus]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.961
rev: v1.5.1
hooks:
- id: mypy
additional_dependencies:
Expand Down
14 changes: 7 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@
# For further information on the license, see the LICENSE.txt file. #
###############################################################################

FROM aiidateam/aiida-core:1.6.9

FROM aiidateam/aiida-core-with-services:2.5.0


# To prevent the container to exit prematurely.
ENV KILL_ALL_RPOCESSES_TIMEOUT=50

WORKDIR /opt/

# Install CP2K from conda-forge.
RUN conda create --yes -c conda-forge -n cp2k cp2k=9.1 && conda clean --all -f -y

# Install aiida-cp2k plugin.
COPY . aiida-cp2k
COPY --chown="${SYSTEM_UID}:${SYSTEM_GID}" . /home/aiida/aiida-cp2k
RUN pip install ./aiida-cp2k[dev,docs]

# Install coverals.
RUN pip install coveralls

# Install the cp2k code.
COPY .docker/opt/add-codes.sh /opt/
COPY .docker/my_init.d/add-codes.sh /etc/my_init.d/50_add-codes.sh
COPY .docker/init/add-codes.sh /etc/init/
COPY .docker/s6-rc.d/cp2k-code-setup /etc/s6-overlay/s6-rc.d/cp2k-code-setup
COPY .docker/user/cp2k-code-setup /etc/s6-overlay/s6-rc.d/user/contents.d/cp2k-code-setup
57 changes: 52 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
[![Build Status](https://travis-ci.org/aiidateam/aiida-cp2k.svg?branch=develop)](https://travis-ci.org/aiidateam/aiida-cp2k)
[![Coverage Status](https://coveralls.io/repos/github/aiidateam/aiida-cp2k/badge.svg?branch=develop)](https://coveralls.io/github/aiidateam/aiida-cp2k?branch=develop)
[![PyPI version](https://badge.fury.io/py/aiida-cp2k.svg)](https://badge.fury.io/py/aiida-cp2k)
[![Documentation Status](https://readthedocs.org/projects/aiida-cp2k/badge/?version=latest)](https://aiida-cp2k.readthedocs.io/en/latest/?badge=latest)
[![PyPI pyversions](https://img.shields.io/pypi/pyversions/aiida-cp2k.svg)](https://pypi.python.org/pypi/aiida-cp2k/)
[![Test CI](https://github.com/aiidateam/aiida-cp2k/actions/workflows/ci.yml/badge.svg)](https://github.com/aiidateam/aiida-cp2k/actions)
[![Coverage Status](https://coveralls.io/repos/github/aiidateam/aiida-cp2k/badge.svg?branch=main)](https://coveralls.io/github/aiidateam/aiida-cp2k?branch=main)
[![Documentation](https://readthedocs.org/projects/aiida-cp2k/badge/?version=latest)](https://aiida-cp2k.readthedocs.io/en/latest/?badge=latest)

# AiiDA CP2K

[AiiDA](http://www.aiida.net/) plugin for [CP2K](https://www.cp2k.org/).

## Installation
Expand All @@ -21,21 +23,66 @@ pip install -e . # Also installs aiida, if missing (but not postgres/rabbitmq).
```

## Links

* [Documentation](https://aiida-cp2k.readthedocs.io/en/latest/) for the calculation examples and features of the plugin.
* [Make an issue](https://github.com/aiidateam/aiida-cp2k/issues/new) for bug reports, questions and suggestions.
* [AiiDA](http://www.aiida.net/) to learn about AiiDA.
* [Cp2k](https://www.cp2k.org/) to learn about CP2K.
* [CP2K](https://www.cp2k.org/) to learn about CP2K.

## For maintainers

### Release

To create a new release, clone the repository, install development dependencies with `pip install '.[dev]'`, and then execute `bumpver update --major/--minor/--patch`.
This will:

1. Create a tagged release with bumped version and push it to the repository.
2. Trigger a GitHub actions workflow that creates a GitHub release.

Additional notes:

- Use the `--dry` option to preview the release change.
- The release tag (e.g. a/b/rc) is determined from the last release.
Use the `--tag` option to override the release tag.

### Testing

To run the tests, you need to have Docker installed in your system.
Once this is done, you can build the Docker image with the following command:

```bash
docker build -t aiida_cp2k_test .
```
Then, you can launch the container:

```bash
DOKERID=`docker run -it aiida_cp2k_test`
```
This will remeber the container ID in the variable `DOKERID`.
You can then run the tests with the following command:

```bash
docker exec --tty --user aiida $DOCKERID /bin/bash -l -c 'cd /home/aiida/aiida-cp2k/ && pytest'
```

To enter the container for manual testing do:

```bash
docker exec -it --user aiida $DOCKERID bash
```


## License
MIT

MIT

## Contact

[email protected]


## Acknowledgements

This work is supported by:
* the [MARVEL National Centre for Competency in Research](http://nccr-marvel.ch) funded by the [Swiss National Science Foundation](http://www.snf.ch/en);
* the [MaX European Centre of Excellence](http://www.max-centre.eu/) funded by the Horizon 2020 EINFRA-5 program, Grant No. 676598;
Expand Down
2 changes: 1 addition & 1 deletion aiida_cp2k/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
###############################################################################
"""The official AiiDA plugin for CP2K."""

__version__ = "1.5.0"
__version__ = "2.0.0"

# EOF
Loading

0 comments on commit d45c079

Please sign in to comment.