Skip to content

Commit

Permalink
updates for aiida 2.5 (#42)
Browse files Browse the repository at this point in the history
* add `core.` prefix to several entry points
* bump python & dependency versions
  • Loading branch information
ltalirz authored Jan 28, 2024
1 parent f47fec9 commit 7d50069
Show file tree
Hide file tree
Showing 14 changed files with 40 additions and 52 deletions.
19 changes: 8 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: ci

on:
push:
branches: [master]
pull_request:
on: [push, pull_request]

jobs:

Expand All @@ -12,8 +9,8 @@ jobs:
timeout-minutes: 30
strategy:
matrix:
python-version: ["3.8"]
aiida-version: ["stable"]
python-version: ['3.10']
aiida-version: ['stable']

services:
postgres:
Expand Down Expand Up @@ -58,10 +55,10 @@ jobs:
timeout-minutes: 15
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: "3.8"
python-version: "3.10"
- name: Install python dependencies
run: |
pip install --upgrade pip
Expand All @@ -74,14 +71,14 @@ jobs:
timeout-minutes: 15
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: "3.8"
python-version: "3.10"
- name: Install python dependencies
run: |
pip install --upgrade pip
pip install -e .[pre-commit,testing]
pip install -e .[pre-commit,docs,testing]
- name: Run pre-commit
run: |
pre-commit install
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-on-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Python 3.8
- name: Set up Python 3.10
uses: actions/setup-python@v1
with:
python-version: '3.8'
python-version: '3.10'

- name: Install flit
run: |
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@
# pre-commit install
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
rev: v4.4.0
hooks:
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
- id: check-json

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

- repo: https://github.com/PyCQA/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort

- repo: https://github.com/psf/black
rev: 22.3.0
rev: 22.12.0
hooks:
- id: black

Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2

python:
version: "3.8"
version: "3.10"
install:
- method: pip
path: .
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 The AiiDA Team.
Copyright (c) 2024 The AiiDA Team.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion aiida_diff/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
AiiDA demo plugin that wraps the `diff` executable for computing the difference between two files.
"""

__version__ = "2.0.0"
__version__ = "1.2.0"
1 change: 0 additions & 1 deletion aiida_diff/calculations.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ def prepare_for_submission(self, folder):
)
codeinfo.code_uuid = self.inputs.code.uuid
codeinfo.stdout_name = self.metadata.options.output_filename
codeinfo.withmpi = self.inputs.metadata.options.withmpi

# Prepare a `CalcInfo` to be returned to the engine
calcinfo = datastructures.CalcInfo()
Expand Down
2 changes: 1 addition & 1 deletion aiida_diff/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def export(node, outfile):
string = str(node)

if outfile:
with open(outfile, "w") as f:
with open(outfile, "w", encoding="utf8") as f:
f.write(string)
else:
click.echo(string)
8 changes: 4 additions & 4 deletions aiida_diff/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def __init__(self, dict=None, **kwargs):
dict = self.validate(dict)
super().__init__(dict=dict, **kwargs)

def validate(self, parameters_dict): # pylint: disable=no-self-use
def validate(self, parameters_dict):
"""Validate command line options.
Uses the voluptuous package for validation. Find out about allowed keys using::
Expand All @@ -71,9 +71,9 @@ def cmdline_params(self, file1_name, file2_name):
parameters = []

pm_dict = self.get_dict()
for k in pm_dict.keys():
if pm_dict[k]:
parameters += ["--" + k]
for option, enabled in pm_dict.items():
if enabled:
parameters += ["--" + option]

parameters += [file1_name, file2_name]

Expand Down
10 changes: 4 additions & 6 deletions aiida_diff/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ def get_computer(name=LOCALHOST_NAME, workdir=None):
description="localhost computer set up by aiida_diff tests",
hostname=name,
workdir=workdir,
transport_type="local",
scheduler_type="direct",
transport_type="core.local",
scheduler_type="core.direct",
)
computer.store()
computer.set_minimum_job_poll_interval(0.0)
Expand All @@ -73,16 +73,14 @@ def get_code(entry_point, computer):
:param entry_point: Entry point of calculation plugin
:param computer: (local) AiiDA computer
:return: The code node
:rtype: :py:class:`aiida.orm.nodes.data.code.Code`
:rtype: :py:class:`aiida.orm.nodes.data.code.installed.InstalledCode`
"""

try:
executable = executables[entry_point]
except KeyError as exc:
raise KeyError(
"Entry point '{}' not recognized. Allowed values: {}".format(
entry_point, list(executables.keys())
)
f"Entry point '{entry_point}' not recognized. Allowed values: {list(executables.keys())}"
) from exc

codes = Code.objects.find( # pylint: disable=no-member
Expand Down
4 changes: 2 additions & 2 deletions aiida_diff/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def parse(self, **kwargs):
output_filename = self.node.get_option("output_filename")

# Check that folder content is as expected
files_retrieved = self.retrieved.base.repository.list_object_names()
files_retrieved = self.retrieved.list_object_names()
files_expected = [output_filename]
# Note: set(A) <= set(B) checks whether A is a subset of B
if not set(files_expected) <= set(files_retrieved):
Expand All @@ -50,7 +50,7 @@ def parse(self, **kwargs):

# add output file
self.logger.info(f"Parsing '{output_filename}'")
with self.retrieved.base.repository.open(output_filename, "rb") as handle:
with self.retrieved.open(output_filename, "rb") as handle:
output_node = SinglefileData(file=handle)
self.out("diff", output_node)

Expand Down
2 changes: 1 addition & 1 deletion conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


@pytest.fixture(scope="function", autouse=True)
def clear_database_auto(aiida_profile_clean): # pylint: disable=unused-argument
def clear_database_auto(clear_database): # pylint: disable=unused-argument
"""Automatically clear database in between tests."""


Expand Down
10 changes: 5 additions & 5 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
import sys
import time

from aiida.manage.configuration import load_documentation_profile
from aiida import load_profile

import aiida_diff

# -- AiiDA-related setup --------------------------------------------------

# Load the dummy documentation profile
load_documentation_profile()
# Load AiiDA profile
load_profile()

# -- General configuration ------------------------------------------------

Expand Down Expand Up @@ -61,7 +61,7 @@

# General information about the project.
project = "aiida-diff"
copyright_first_year = "2022"
copyright_first_year = "2024"
copyright_owners = "The AiiDA Team"

current_year = str(time.localtime().tm_year)
Expand All @@ -87,7 +87,7 @@
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = "en"

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
Expand Down
18 changes: 6 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ classifiers = [
"Framework :: AiiDA"
]
keywords = ["aiida", "plugin"]
requires-python = ">=3.8"
requires-python = ">=3.7"
dependencies = [
"aiida-core>=2.0,<3",
"aiida-core>=2.5,<3",
"voluptuous"
]

Expand All @@ -39,7 +39,7 @@ testing = [
]
pre-commit = [
"pre-commit~=2.2",
"pylint>=2.5.0,<2.9"
"pylint~=2.15.10"
]
docs = [
"sphinx",
Expand Down Expand Up @@ -72,16 +72,14 @@ disable = [
"too-many-ancestors",
"invalid-name",
"duplicate-code",
# black compatibility
"C0330",
"C0326",
]

[tool.pytest.ini_options]
# Configuration for [pytest](https://docs.pytest.org)
python_files = "test_*.py example_*.py"
filterwarnings = [
"ignore::DeprecationWarning:aiida:",
"ignore:Creating AiiDA configuration folder:",
"ignore::DeprecationWarning:plumpy:",
"ignore::DeprecationWarning:yaml:",
]
Expand All @@ -106,18 +104,14 @@ envlist = py38
[testenv]
usedevelop=True
[testenv:py{38,39,310}]
[testenv:py{37,38,39,310}]
description = Run the test suite against a python version
extras = testing
setenv =
AIIDA_WARN_v3 = 1
commands = pytest {posargs}
[testenv:pre-commit]
description = Run the pre-commit checks
extras =
pre-commit
testing
extras = pre-commit
commands = pre-commit run {posargs}
[testenv:docs]
Expand Down

0 comments on commit 7d50069

Please sign in to comment.