Skip to content
Merged
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
30 changes: 30 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Tests

on:
push:
pull_request:

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13", "3.14"]

steps:
- uses: actions/checkout@v4

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

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest jsonschema
pip install -e .

- name: Test with pytest
run: make test
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ __pycache__/
*.py[cod]
*$py.class

.agents/
.claude/

# C extensions
*.so

Expand All @@ -24,6 +27,8 @@ wheels/
*.egg-info/
.installed.cfg
*.egg
*.whl
*.tar.gz

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down Expand Up @@ -103,3 +108,8 @@ ENV/

# Dev schema
docs/source/auto*rst


# Agent workflow (local only, not tracked)
.agents/

8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.9
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
args: [--line-length=120]
30 changes: 0 additions & 30 deletions .travis.yml

This file was deleted.

15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# QCSchema

[![Build Status](https://img.shields.io/travis/MolSSI/QCSchema/master.svg?logo=linux&logoColor=white)](https://travis-ci.org/MolSSI/QCSchema)
[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/MolSSI/QCSchema.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/MolSSI/QCSchema/context:python)
[![Documentation Status](https://readthedocs.org/projects/molssi-qc-schema/badge/?version=latest)](https://molssi-qc-schema.readthedocs.io/en/latest/?badge=latest)

Expand All @@ -11,5 +10,17 @@ chemistry packages to enable more complex workflows. The core of this is to
avoid parsing ASCII-based output files and place output variables, vectors,
matrices in a consistent format that can be easily parsed.

Please see the [website](http://molssi-qc-schema.readthedocs.io/en/latest/index.html#) for the current specification.
Please see the [website](http://molssi-qc-schema.readthedocs.io/en/latest/index.html#) for the current specification.

## Development

Install the package with development dependencies and set up pre-commit hooks:

```bash
pip install -e .
pip install pre-commit
pre-commit install
```

Pre-commit will automatically lint and format code on each commit using [ruff](https://github.com/astral-sh/ruff).

5 changes: 2 additions & 3 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
Expand All @@ -20,10 +19,10 @@
# -- Project information -----------------------------------------------------

# Super hacky auto gen
import sys
import os
import sys

sys.path.insert(1, os.path.dirname(__file__))
import gen_schema_docs

project = 'A schema for Quantum Chemistry'
copyright = f'2018-{datetime.datetime.today().year}, The Molecular Sciences Software Institute'
Expand Down
6 changes: 3 additions & 3 deletions docs/source/gen_schema_docs.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"""
Very hacky way to write out the schema (for demo purposes only)
"""
import qcschema
import textwrap
import os

# Import headers from this
import sys
import os

import qcschema

sys.path.insert(1, os.path.dirname(__file__))
import schema_doc_helpers as sh
Expand Down
5 changes: 3 additions & 2 deletions docs/source/schema_doc_helpers/writers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
import textwrap


def write_header(data, header):
data.append("")
data.append(header)
Expand All @@ -25,11 +26,11 @@ def write_key_table(top_file, properties, keys=None):
fmt_string = ' | {:%s} | {:%s} | {:%s} |' % tuple(table_widths)
dash_inds = tuple("-" * w for w in table_widths)
equals_inds = tuple("=" * w for w in table_widths)

top_file.append(" +-{}-+-{}-+-{}-+".format(*dash_inds))
top_file.append(fmt_string.format("Key Name", "Description", "Field Type"))
top_file.append(" +={}=+={}=+={}=+".format(*equals_inds))

if keys is None:
keys = properties.keys()

Expand Down
67 changes: 65 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,66 @@
[tool.black]
[build-system]
requires = ["setuptools>=45", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "qcschema"
version = "1"
description = "A schema for quantum chemistry"
readme = "README.md"
requires-python = ">3.11"
dependencies = [
"jsonschema",
"pathlib2; python_version < '3.5'",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why mention py35?

EDIT: nm, all the deps are old (I think we can use past sphinx v1 by now.

]

[project.optional-dependencies]
docs = [
"sphinx==1.2.3",
"sphinxcontrib-napoleon",
"sphinx_rtd_theme",
"numpydoc",
]
tests = [
"pytest",
]

[project.urls]
Homepage = "https://github.com/MolSSI/QCSchema"

[tool.setuptools]
packages = [
"qcschema",
"qcschema.data",
"qcschema.data.v1",
"qcschema.data.v2",
"qcschema.dev",
"qcschema.dev.properties",
"qcschema.dev.wavefunction",
]
zip-safe = true

[tool.setuptools.package-data]
"qcschema.data.v1" = ["*.schema"]
"qcschema.data.v2" = ["*.schema"]

[tool.ruff]
line-length = 120
target-version = "py311"
lint.select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # Pyflakes
"I", # isort
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"UP", # pyupgrade
]
lint.ignore = [
"E501", # Line too long (handled by formatter)
]

[tool.ruff.lint.isort]
known-first-party = ["qcschema"]

[tool.ruff.format]
line-length = 120
target-version = ['py27', 'py36', 'py37', 'py38']
Empty file added qcschema/data/v2/__init__.py
Empty file.
6 changes: 1 addition & 5 deletions qcschema/dev/dev_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@

import copy

from . import molecule
from . import definitions
from . import properties
from . import basis
from . import wavefunction
from . import basis, definitions, molecule, properties, wavefunction

# The base schema definition
base_schema = {
Expand Down
2 changes: 1 addition & 1 deletion qcschema/dev/properties/cc_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,4 @@
"type": "number",
"multipleOf": 1.0,
"description": "The number of CCSDTQ iterations taken before convergence."
}
}
6 changes: 3 additions & 3 deletions qcschema/dev/properties/properties_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
The base file for QC Schema properties.
"""

from .scf_properties import scf_properties
from .mp_properties import mp_properties
from .cc_properties import cc_properties
from .calcinfo_properties import calcinfo_properties
from .cc_properties import cc_properties
from .mp_properties import mp_properties
from .scf_properties import scf_properties

properties = {
"type": "object",
Expand Down
2 changes: 1 addition & 1 deletion qcschema/dev/wavefunction/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .wavefunction_base import output_wavefunction
from .wavefunction_base import output_wavefunction
6 changes: 3 additions & 3 deletions qcschema/dev/wavefunction/wavefunction_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
The base file for QC Schema properties.
"""

from ..basis import basis
from .core_wavefunction import core_wavefunction
from .localized_wavefunction import localized_wavefunction
from .result_wavefunction import result_wavefunction
from .scf_wavefunction import scf_wavefunction
from .localized_wavefunction import localized_wavefunction
from .core_wavefunction import core_wavefunction
from ..basis import basis

output_wavefunction = {
"type": "object",
Expand Down
6 changes: 3 additions & 3 deletions qcschema/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def list_versions(schema_type):
if schema_type.lower() in aliases:
return _versions_list[sk]

raise KeyError("Schema type should be among {} (+aliases), not '{}'.".format(list(_aliases.keys()), schema_type))
raise KeyError(f"Schema type should be among {list(_aliases.keys())} (+aliases), not '{schema_type}'.")


def get_schema(schema_type, version="dev"):
Expand All @@ -62,10 +62,10 @@ def get_schema(schema_type, version="dev"):
fname = "qc_schema_" + sk
break
else:
raise KeyError("Schema version should be among {}, not '{}'.".format(_versions_list[sk], version))
raise KeyError(f"Schema version should be among {_versions_list[sk]}, not '{version}'.")
else:
raise KeyError(
"Schema type should be among {} (+aliases), not '{}'.".format(list(_aliases.keys()), schema_type)
f"Schema type should be among {list(_aliases.keys())} (+aliases), not '{schema_type}'."
)

fpath = _data_path / ("v" + str(version)) / (fname + ".schema")
Expand Down
32 changes: 0 additions & 32 deletions setup.py

This file was deleted.

8 changes: 4 additions & 4 deletions tests/test_failures.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""
Tests the JSON schema
"""

import jsonschema
import pytest
import os

import test_helpers

import qcschema

### Test input validation errors
Expand All @@ -17,7 +17,7 @@
def test_input_failures(version, testfile):

example = test_helpers.get_test(testfile)

with pytest.raises(jsonschema.exceptions.ValidationError):
qcschema.validate(example, "input")

Expand All @@ -30,7 +30,7 @@ def test_input_failures(version, testfile):
def test_output_failures(version, testfile):

example = test_helpers.get_test(testfile)

with pytest.raises(jsonschema.exceptions.ValidationError):
qcschema.validate(example, "output")

Loading
Loading