Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub Action btwn QCEl and QCSk #218

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions .github/workflows/QCSchema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: QCSchema

on: [pull_request]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
conda-env: [base]
python-version: [3.7]
env:
PYVER: ${{ matrix.python-version }}
CONDA_ENV: ${{ matrix.conda-env }}

steps:
- name: Checkout
uses: actions/checkout@v2
with:
path: qcel

- name: Checkout schema repo
uses: actions/checkout@v2
with:
repository: loriab/QCSchema
#repository: MolSSI/QCSchema
path: qcsk
#ref: py2json
ref: json_files
#ref: master
persist-credentials: false
fetch-depth: 0

- name: Python Setup
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: Create Environment
shell: bash
working-directory: ./qcel
run: |
eval "$(conda shell.bash hook)" && conda activate
python devtools/scripts/create_conda_env.py -n=test -p=$PYVER devtools/conda-envs/$CONDA_ENV.yaml

- name: Install
shell: bash
working-directory: ./qcel
run: |
eval "$(conda shell.bash hook)" && conda activate test
python -m pip install . --no-deps

- name: Environment Information
shell: bash
run: |
eval "$(conda shell.bash hook)" && conda activate test
conda list --show-channel-urls

- name: QCSchema from QCElemental
shell: bash
working-directory: ./qcel
run: |
eval "$(conda shell.bash hook)" && conda activate test
make qcschema
ls -l qcschema
#cp -p qcschema/* ../qcsk/qcschema_json/
cp -p qcschema/* ../qcsk/qcschema/
# Note: `qcschema_json` is a folder in the py2json branch containing plain JSON files of the schema,
# rather than the python module of the current repo

- name: Compare Schemas (generated vs. community)
shell: bash
working-directory: ./qcsk
run: |
git diff --color-words
pull_number=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")
branch=qcel-${pull_number}
git checkout -b ${branch}
git remote -v
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add -A
git commit -m "auto-generated from QCElemental"
echo "::set-env name=prbranch::${branch}"

- name: Propose changes
uses: ad-m/github-push-action@master
with:
directory: ./qcsk
repository: loriab/QCSchema
#repository: MolSSI/QCSchema
branch: ${{ env.prbranch }}
github_token: ${{ secrets.QCSK_TOKEN }}
force: true
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ data: cpu_data
cpu_data:
(cd raw_data/cpu_data; python build_cpu_data.py; mv cpu_data_blob.py ../../qcelemental/info/data/)

.PHONY: qcschema
qcschema: #install
mkdir -p qcschema
python -c "exec(\"import qcelemental as qcel\nfrom pathlib import Path\nfor md in qcel.models.qcschema_models():\n\tmfile = (Path('qcschema') / md.__name__).with_suffix('.json')\n\twith open(mfile, 'w') as fp:\n\t\tfp.write(md.schema_json(indent=4))\")"

.PHONY: clean
clean:
rm -rf `find . -name __pycache__`
Expand Down
16 changes: 16 additions & 0 deletions qcelemental/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,19 @@
from .molecule import Molecule
from .procedures import Optimization, OptimizationInput, OptimizationResult
from .results import AtomicInput, AtomicResult, AtomicResultProperties, Result, ResultInput, ResultProperties


def qcschema_models():
return [
AtomicInput,
AtomicResult,
AtomicResultProperties,
basis.BasisCenter,
BasisSet,
basis.ElectronShell,
basis.ECPPotential,
common_models.Model,
Molecule,
Provenance,
results.WavefunctionProperties,
]
5 changes: 4 additions & 1 deletion qcelemental/models/common_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ class Provenance(ProtoModel):
"""

creator: str = Field(..., description="The creator of the object.")
version: Optional[str] = Field(None, description="The version of the creator.")
version: Optional[str] = Field(
None,
description="The version of the creator, which should be sortable by the very broad [PEP 440](https://www.python.org/dev/peps/pep-0440/).",
)
routine: Optional[str] = Field(None, description="The routine of the creator.")

class Config(ProtoModel.Config):
Expand Down