Skip to content

Commit

Permalink
Merge branch 'aiidateam:master' into mlip
Browse files Browse the repository at this point in the history
  • Loading branch information
federicazanca authored Mar 20, 2024
2 parents 7a29ad1 + 359756a commit 768ec45
Show file tree
Hide file tree
Showing 16 changed files with 92 additions and 64 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/dev-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: CI

# For development, use the following instead:
on: [pull_request]


# https://docs.github.com/en/actions/using-jobs/using-concurrency
concurrency:
# only cancel in-progress jobs or runs for the current workflow - matches against branch & tags
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test-utils:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo ⚡️
uses: actions/checkout@v4
- name: Create dev environment
uses: ./.github/actions/create-dev-env
- name: Run tests
run: pytest tests/

test-webpage-build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
timeout-minutes: 30
steps:
# This is a CI job that checks if the webpage can be built
# We use the plugins metadata from caching since we don't want to
# fetch it twice and it is not essential for this job to have
# the latest generated metadata
- name: Checkout Repo ⚡️
uses: actions/checkout@v4

- name: Create dev environment
uses: ./.github/actions/create-dev-env

- name: Generate metadata
uses: ./.github/actions/generate-metadata
with:
gh_token: ${{ secrets.GITHUB_TOKEN }}
cache: true

- uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Install npm dependencies and build
run: |
npm install
npm run build
working-directory: ./aiida-registry-app
15 changes: 0 additions & 15 deletions .github/workflows/ci.yml → .github/workflows/plugin-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,6 @@ jobs:
- uses: suzuki-shunsuke/[email protected]
id: pr

pre-commit:
runs-on: ubuntu-latest
needs:
- get-pr
steps:
- name: Checkout Repo ⚡️
uses: actions/checkout@v4
with:
ref: ${{needs.get-pr.outputs.merge_commit_sha}}
- name: Create dev environment
uses: ./.github/actions/create-dev-env
- name: Run pre-commit
run:
pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )

test-utils:
runs-on: ubuntu-latest
needs:
Expand Down
25 changes: 7 additions & 18 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,18 @@

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: end-of-file-fixer
- id: fix-encoding-pragma
- id: mixed-line-ending
- id: trailing-whitespace
- id: check-json

- repo: https://github.com/PyCQA/isort
rev: 5.12.0
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.3.3
hooks:
- id: isort
args: ["--profile", "black", "--filter-files"]

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

- repo: local
hooks:
- id: pylint
name: pylint
entry: pylint
types: [python]
language: system
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
- id: ruff-format
2 changes: 0 additions & 2 deletions .pylintrc

This file was deleted.

8 changes: 4 additions & 4 deletions aiida_registry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# -*- coding: utf-8 -*-
"""Configuration of plugin registry.
* paths to files & folders
* info on entry points
* info on development status
* paths to files & folders
* info on entry points
* info on development status
"""

import os
Expand Down Expand Up @@ -134,7 +134,7 @@
"Development Status :: 7 - Inactive": "inactive",
}

status_no_pip_url_allowed = {"planning", "pre-alpha", "alpha"}
status_no_pip_url_required = {"planning", "pre-alpha", "alpha"}

## dictionary of human-readable entrypointtypes
entrypointtypes = {k: v["longname"] for k, v in entrypoint_metainfo.items()}
Expand Down
1 change: 1 addition & 0 deletions aiida_registry/cli.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
"""CLI for AiiDA registry."""

import click

from aiida_registry.make_pages import make_pages
Expand Down
5 changes: 2 additions & 3 deletions aiida_registry/fetch_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Data is primarily sourced from PyPI,
with a fallback to the repository build file (setup.json, setup.cfg, pyproject.toml).
"""

import json

# pylint: disable=consider-using-f-string
Expand Down Expand Up @@ -134,9 +135,7 @@ def get_git_commits_count(repo_name):
return int(commits_count)


def complete_plugin_data(
plugin_data: dict, fetch_pypi=True, fetch_pypi_wheel=True
): # pylint: disable=too-many-branches,too-many-statements
def complete_plugin_data(plugin_data: dict, fetch_pypi=True, fetch_pypi_wheel=True): # pylint: disable=too-many-branches,too-many-statements
"""Update plugin data dictionary.
* add metadata, aiida_version and entrypoints from plugin_info
Expand Down
17 changes: 8 additions & 9 deletions aiida_registry/make_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
entrypointtypes,
main_entrypoints,
status_dict,
status_no_pip_url_allowed,
status_no_pip_url_required,
)

entrypoints_count = defaultdict(list)
Expand Down Expand Up @@ -120,11 +120,10 @@ def global_summary():


def get_pip_install_cmd(plugin_data):
if (
"pip_url" not in plugin_data
and plugin_data["development_status"] in status_no_pip_url_allowed
):
return "See source code repository."
if "pip_url" not in plugin_data:
if plugin_data["development_status"] in status_no_pip_url_required:
return "See source code repository."
return "Missing, see source code repository"

pip_url = plugin_data["pip_url"]

Expand Down Expand Up @@ -159,9 +158,9 @@ def make_pages(package=None):
all_data["plugins"] = plugins_metadata
all_data["globalsummary"] = global_summary()
all_data["status_dict"] = status_dict
all_data[
"entrypointtypes"
] = entrypointtypes # add a static entrypointtypes dictionary
all_data["entrypointtypes"] = (
entrypointtypes # add a static entrypointtypes dictionary
)

with open(PLUGINS_METADATA, "w", encoding="utf8") as handle:
json.dump(all_data, handle, indent=2)
7 changes: 4 additions & 3 deletions aiida_registry/parse_build_file.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
"""Module for parsing package build files."""

import ast
import json
from configparser import ConfigParser
Expand Down Expand Up @@ -261,9 +262,9 @@ def parse_setup_cfg(content: str, ep_only=False) -> SourceData:
}
if config.has_option("metadata", "classifiers"):
infos["metadata"]["classifiers"] = [
l.strip()
for l in config.get("metadata", "classifiers").splitlines()
if l.strip() and not l.strip().startswith("#")
line.strip()
for line in config.get("metadata", "classifiers").splitlines()
if line.strip() and not line.strip().startswith("#")
]

return SourceData(**infos)
Expand Down
1 change: 1 addition & 0 deletions aiida_registry/parse_pypi.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
"""Parse metadata from PyPI."""

# pylint: disable=too-many-ancestors,too-many-locals,too-many-branches
import configparser
import json
Expand Down
6 changes: 3 additions & 3 deletions aiida_registry/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,9 @@ def test_install_all(container_image):
for key, _ in data["plugins"][plugin_name]["entry_points"][
ep_group
].items():
data["plugins"][plugin_name]["entry_points"][ep_group][
key
] = process_metadata[ep_group][key]
data["plugins"][plugin_name]["entry_points"][ep_group][key] = (
process_metadata[ep_group][key]
)
except KeyError:
continue

Expand Down
1 change: 1 addition & 0 deletions aiida_registry/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
"""Utility functions."""

import os
import traceback

Expand Down
3 changes: 2 additions & 1 deletion bin/analyze_entrypoints.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""""
"""
Fetch information about plugins and print it in a human-readable format.
Adapted from `aiida.cmdline.commands.cmd_plugin`.
Note: This script should run inside the aiida-core docker container without requiring additional dependencies.
"""

# pylint: disable=missing-class-docstring,import-outside-toplevel
import inspect
import json
Expand Down
10 changes: 5 additions & 5 deletions plugins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ aiida-alloy:
pip_url: git+https://github.com/DanielMarchand/aiida-alloy
plugin_info: https://raw.githubusercontent.com/DanielMarchand/aiida-alloy/master/setup.json
aiida-amber:
code_home: https://github.com/PSDI-Biomolecular-team/aiida-amber
code_home: https://github.com/PSDI-UK/aiida-amber
entry_point_prefix: amber
pip_url: git+https://github.com/PSDI-Biomolecular-team/aiida-amber
plugin_info: https://raw.githubusercontent.com/PSDI-Biomolecular-team/aiida-amber/main/pyproject.toml
pip_url: git+https://github.com/PSDI-UK/aiida-amber
plugin_info: https://raw.githubusercontent.com/PSDI-UK/aiida-amber/main/pyproject.toml
aiida-ase:
code_home: https://github.com/aiidateam/aiida-ase
documentation_url: https://aiida-ase.readthedocs.io/
Expand Down Expand Up @@ -188,11 +188,11 @@ aiida-graphql:
pip_url: aiida-graphql
plugin_info: https://raw.github.com/dev-zero/aiida-graphql/develop/pyproject.toml
aiida-gromacs:
code_home: https://github.com/PSDI-Biomolecular-team/aiida-gromacs
code_home: https://github.com/PSDI-UK/aiida-gromacs
documentation_url: https://aiida-gromacs.readthedocs.io/
entry_point_prefix: gromacs
pip_url: aiida-gromacs
plugin_info: https://raw.githubusercontent.com/PSDI-Biomolecular-team/aiida-gromacs/master/pyproject.toml
plugin_info: https://raw.githubusercontent.com/PSDI-UK/aiida-gromacs/master/pyproject.toml
aiida-gudhi:
code_home: https://github.com/ltalirz/aiida-gudhi
development_status: beta
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ dependencies = [
"markupsafe~=2.0.1",
# dev dependencies
"pre-commit~=2.2",
"pylint~=2.16.1",
"pytest~=6.2.2",
"pytest-regressions~=2.5.0",
]
Expand Down
1 change: 1 addition & 0 deletions tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* poetry: pyproject.toml
* flit: pyproject.toml
"""

from pathlib import Path

import yaml
Expand Down

0 comments on commit 768ec45

Please sign in to comment.