Skip to content

Commit

Permalink
Merge pull request #83 from Open-Catalyst-Project/gh-actions
Browse files Browse the repository at this point in the history
GH actions
  • Loading branch information
misko authored May 6, 2024
2 parents 277175c + dd7704e commit a01911e
Show file tree
Hide file tree
Showing 8 changed files with 142 additions and 93 deletions.
70 changes: 0 additions & 70 deletions .circleci/config.yml

This file was deleted.

25 changes: 25 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: lint

on:
push:
workflow_dispatch:

jobs:
lint:
runs-on: ubuntu-latest
strategy:
max-parallel: 6

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[dev]
- name: black
run: |
black --color ocdata
50 changes: 50 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: test
on:
push:
branches: [main]
pull_request:
workflow_call:

jobs:
test:
runs-on: ubuntu-latest
strategy:
max-parallel: 10
matrix:
python_version: ['3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}

- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install dependencies and package
# this can be added along with a dependabot config to run tests with latest versions
# pip install -r requirements.txt
# pip install -r requirements-optional.txt
run: |
python -m pip install --upgrade pip
pip install -e .[dev]
- name: Test with pytest
run: |
pytest tests -vv --cov-report=xml --cov=ocpdata
- if: ${{ matrix.python_version == '3.11' }}
name: codecov-report
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false # optional (default = false)
files: ./coverage.xml
token: ${{ secrets.CODECOV_TOKEN }} # required
verbose: true # optional (default = false)
3 changes: 0 additions & 3 deletions ocdata/databases/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
Script for updating ase pkl and db files from v3.19 to v3.21.
Run it with ase v3.19.
"""


import pickle
from collections import defaultdict

import ase.io
from ase.atoms import Atoms
Expand Down
54 changes: 54 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
[build-system]
requires = ["setuptools>=69"]

[project]
name = "oc-data"
description = "Code for generating adsorbate-catalyst input configurations"
readme = "README.md"
license = {text = "MIT License"}
version = "0.2.0"
requires-python = ">=3.9, <3.13"
dependencies = [
"scipy",
"numpy",
"ase==3.22.1",
"pymatgen",
"tqdm"
]

[tool.setuptools.packages]
find = {namespaces = false} # Disable implicit namespaces

[tool.setuptools_scm] # for version instrospection based on tags + commit

[project.urls]
repository = "http://github.com/Open-Catalyst-Project/Open-Catalyst-Dataset"

# include package data
[tool.setuptools.package-data]
"ocdata.databases.pkls" = ["*pkl"]

[project.optional-dependencies]
dev = ["pre-commit", "pytest", "pytest-cov", "coverage", "black"]

[tool.pytest.ini_options]
minversion = "6.0"
addopts = "-p no:warnings --import-mode importlib -x --quiet -rxXs --color yes"
filterwarnings = [
'ignore::UserWarning',
'ignore::FutureWarning',
'ignore::RuntimeWarning'
]
testpaths = ["tests"]

[tool.coverage.run]
source = ["ocdata"]

[tool.isort]
profile = 'black'
skip_gitignore = true
multi_line_output=3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
line_length = 88
17 changes: 0 additions & 17 deletions setup.py

This file was deleted.

13 changes: 11 additions & 2 deletions tests/test_bulk.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ def test_unique_slab_enumeration(self):
assert slab not in seen
seen.append(slab)

# pymatgen-2023.5.10 + ase 3.22.1
# pymatgen bug see https://github.com/materialsproject/pymatgen/issues/3747
if len(slabs) == 15:
pytest.xfail(
f"Number of generated slabs {len(slabs)} is off due to pymatgen bug!"
)
assert len(slabs) == 14

with open(self.precomputed_path, "wb") as f:
Expand All @@ -86,7 +90,12 @@ def test_precomputed_slab(self):
precomputed_slabs = self.bulk.get_slabs(
precomputed_slabs_dir=precomputed_slabs_dir
)
# pymatgen-2023.5.10 + ase 3.22.1

if len(precomputed_slabs) == 15:
pytest.xfail(
f"Number of generated slabs {len(precomputed_slabs)} is off due to pymatgen bug!"
)

assert len(precomputed_slabs) == 14

slabs = self.bulk.get_slabs()
Expand Down
3 changes: 2 additions & 1 deletion tests/test_slab.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import random

import numpy as np
import pytest

from ocdata.core import Bulk, Slab

Expand Down Expand Up @@ -32,4 +33,4 @@ def test_slab_init_random(self):

assert slab.atoms.get_chemical_formula() == "Sn48"
assert slab.millers == (2, 1, 0)
assert slab.shift == 0.0833333333333334
assert slab.shift == pytest.approx(0.0833333333333334)

0 comments on commit a01911e

Please sign in to comment.