-
Notifications
You must be signed in to change notification settings - Fork 36
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
Formalizing the Schema #37
Merged
Merged
Changes from 11 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
e71d410
First pass at a simple JSON Schema
dgasmith 72e4e80
Toying around with testing systems
dgasmith 6843ee5
Adds various built in definitions
dgasmith ba958ef
Adds a simple travis YAML
dgasmith d4fc8f5
Reformats error definition
dgasmith a748f51
Starts the move to a small py repo for organizational purposes
dgasmith 9d5faad
Adds MP and SCF properties
dgasmith a71dc8e
Continue refactoring to a git module
dgasmith 1163ae8
Starts documentation
dgasmith 0010693
Starts the generation of schema docs
dgasmith 9a933f7
MP2 total energy and travis fix
dgasmith f7f7ab1
Top-level Makefile
berquist 3106cc2
Adds several validation failure tests
dgasmith 12e0188
Writes topology keys out as a table
dgasmith 50c703d
Merge pull request #1 from berquist/dgasmith-schema
dgasmith ca8cdbc
Updates travis to build docs via make
dgasmith 8f92170
Minor tweaks from Lori's feedback
dgasmith 585e132
Magic 'header', multi description, and more partners
dgasmith a21678a
Updates the tech specs rst to reflect the current big/small discussion
dgasmith File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,3 +99,6 @@ ENV/ | |
|
||
# mypy | ||
.mypy_cache/ | ||
|
||
# Dev schema | ||
docs/source/auto*rst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# After changing this file, check it on: | ||
# http://lint.travis-ci.org/ | ||
language: python | ||
|
||
# Run jobs on container-based infrastructure, can be overridden per job | ||
sudo: false | ||
|
||
matrix: | ||
include: | ||
- python: 2.7 | ||
- python: 3.5 | ||
|
||
before_install: | ||
- uname -a | ||
- free -m | ||
- df -h | ||
- ulimit -a | ||
- python -V | ||
- pip install --upgrade pip setuptools | ||
- pip install pytest jsonschema | ||
- pip install -e . | ||
|
||
script: | ||
- py.test -v | ||
|
||
notifications: | ||
email: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line. | ||
SPHINXOPTS = | ||
SPHINXBUILD = sphinx-build | ||
SPHINXPROJ = qc_schema | ||
SOURCEDIR = source | ||
BUILDDIR = _build | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
.PHONY: help Makefile | ||
|
||
# Catch-all target: route all unknown targets to Sphinx using the new | ||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
%: Makefile | ||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Compiling QC_JSON_Schema's Documentation | ||
|
||
The docs for this project are built with [Sphinx](http://www.sphinx-doc.org/en/master/). | ||
To compile the docs, first ensure that Sphinx and the ReadTheDocs theme are installed. | ||
|
||
```bash | ||
pip install sphinx sphinx_rtd_theme | ||
``` | ||
|
||
Once installed, you can use the `Makefile` in this directory to compile static HTML pages by | ||
```bash | ||
make html | ||
``` | ||
|
||
The compiled docs will be in the `_build` directory and can be viewed by opening `index.html` (which may itself | ||
be inside a directory called `html/` depending on what version of Sphinx is installed). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
@ECHO OFF | ||
|
||
pushd %~dp0 | ||
|
||
REM Command file for Sphinx documentation | ||
|
||
if "%SPHINXBUILD%" == "" ( | ||
set SPHINXBUILD=sphinx-build | ||
) | ||
set SOURCEDIR=source | ||
set BUILDDIR=_build | ||
set SPHINXPROJ=qc_schema | ||
|
||
if "%1" == "" goto help | ||
|
||
%SPHINXBUILD% >NUL 2>NUL | ||
if errorlevel 9009 ( | ||
echo. | ||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx | ||
echo.installed, then set the SPHINXBUILD environment variable to point | ||
echo.to the full path of the 'sphinx-build' executable. Alternatively you | ||
echo.may add the Sphinx directory to PATH. | ||
echo. | ||
echo.If you don't have Sphinx installed, grab it from | ||
echo.http://sphinx-doc.org/ | ||
exit /b 1 | ||
) | ||
|
||
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% | ||
goto end | ||
|
||
:help | ||
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% | ||
|
||
:end | ||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# Configuration file for the Sphinx documentation builder. | ||
# | ||
# This file does only contain a selection of the most common options. For a | ||
# full list see the documentation: | ||
# http://www.sphinx-doc.org/en/stable/config | ||
|
||
# -- Path setup -------------------------------------------------------------- | ||
|
||
# If extensions (or modules to document with autodoc) are in another directory, | ||
# add these directories to sys.path here. If the directory is relative to the | ||
# documentation root, use os.path.abspath to make it absolute, like shown here. | ||
# | ||
# import os | ||
# import sys | ||
# sys.path.insert(0, os.path.abspath('.')) | ||
|
||
|
||
# -- Project information ----------------------------------------------------- | ||
|
||
# Super hacky auto gen | ||
import sys | ||
import os | ||
sys.path.insert(1, os.path.dirname(__file__)) | ||
import gen_schema_docs | ||
|
||
project = 'A schema for Quantum Chemistry' | ||
copyright = "2018, The Molecular Sciences Software Institute" | ||
author = 'The Molecular Sciences Software Institute' | ||
|
||
# The short X.Y version | ||
version = '' | ||
# The full version, including alpha/beta/rc tags | ||
release = '' | ||
|
||
|
||
# -- General configuration --------------------------------------------------- | ||
|
||
# If your documentation needs a minimal Sphinx version, state it here. | ||
# | ||
# needs_sphinx = '1.0' | ||
|
||
# Add any Sphinx extension module names here, as strings. They can be | ||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom | ||
# ones. | ||
extensions = [ | ||
'sphinx.ext.autodoc', | ||
'sphinx.ext.mathjax', | ||
] | ||
|
||
# Add any paths that contain templates here, relative to this directory. | ||
templates_path = ['_templates'] | ||
|
||
# The suffix(es) of source filenames. | ||
# You can specify multiple suffix as a list of string: | ||
# | ||
# source_suffix = ['.rst', '.md'] | ||
source_suffix = '.rst' | ||
|
||
# The master toctree document. | ||
master_doc = 'index' | ||
|
||
# The language for content autogenerated by Sphinx. Refer to documentation | ||
# for a list of supported languages. | ||
# | ||
# 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 | ||
|
||
# List of patterns, relative to source directory, that match files and | ||
# directories to ignore when looking for source files. | ||
# This pattern also affects html_static_path and html_extra_path . | ||
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] | ||
|
||
# The name of the Pygments (syntax highlighting) style to use. | ||
pygments_style = 'sphinx' | ||
|
||
|
||
# -- Options for HTML output ------------------------------------------------- | ||
|
||
# The theme to use for HTML and HTML Help pages. See the documentation for | ||
# a list of builtin themes. | ||
# | ||
html_theme = 'sphinx_rtd_theme' | ||
|
||
# Theme options are theme-specific and customize the look and feel of a theme | ||
# further. For a list of options available for each theme, see the | ||
# documentation. | ||
# | ||
# html_theme_options = {} | ||
|
||
# Add any paths that contain custom static files (such as style sheets) here, | ||
# relative to this directory. They are copied after the builtin static files, | ||
# so a file named "default.css" will overwrite the builtin "default.css". | ||
html_static_path = ['_static'] | ||
|
||
# Custom sidebar templates, must be a dictionary that maps document names | ||
# to template names. | ||
# | ||
# The default sidebars (for documents that don't match any pattern) are | ||
# defined by theme itself. Builtin themes are using these templates by | ||
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html', | ||
# 'searchbox.html']``. | ||
# | ||
# html_sidebars = {} | ||
|
||
|
||
# -- Options for HTMLHelp output --------------------------------------------- | ||
|
||
# Output file base name for HTML help builder. | ||
htmlhelp_basename = 'QC_JSON_Schemadoc' | ||
|
||
|
||
# -- Options for LaTeX output ------------------------------------------------ | ||
|
||
latex_elements = { | ||
# The paper size ('letterpaper' or 'a4paper'). | ||
# | ||
# 'papersize': 'letterpaper', | ||
|
||
# The font size ('10pt', '11pt' or '12pt'). | ||
# | ||
# 'pointsize': '10pt', | ||
|
||
# Additional stuff for the LaTeX preamble. | ||
# | ||
# 'preamble': '', | ||
|
||
# Latex figure (float) alignment | ||
# | ||
# 'figure_align': 'htbp', | ||
} | ||
|
||
# Grouping the document tree into LaTeX files. List of tuples | ||
# (source start file, target name, title, | ||
# author, documentclass [howto, manual, or own class]). | ||
latex_documents = [ | ||
(master_doc, 'QC_JSON_Schema.tex', 'QC_JSON_Schema Documentation', | ||
'QC_JSON_Schema', 'manual'), | ||
] | ||
|
||
|
||
# -- Options for manual page output ------------------------------------------ | ||
|
||
# One entry per manual page. List of tuples | ||
# (source start file, name, description, authors, manual section). | ||
man_pages = [ | ||
(master_doc, 'QC_JSON_Schema', 'QC_JSON_Schema Documentation', | ||
[author], 1) | ||
] | ||
|
||
|
||
# -- Options for Texinfo output ---------------------------------------------- | ||
|
||
# Grouping the document tree into Texinfo files. List of tuples | ||
# (source start file, target name, title, author, | ||
# dir menu entry, description, category) | ||
texinfo_documents = [ | ||
(master_doc, 'QC_JSON_Schema', 'QC_JSON_Schema Documentation', | ||
author, 'QC_JSON_Schema', 'A schema for Quantum Chemistry', | ||
'Miscellaneous'), | ||
] | ||
|
||
|
||
# -- Extension configuration ------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
""" | ||
Very hacky way to write out the schema (for demo purposes only) | ||
""" | ||
import qc_schema | ||
|
||
scf_props = qc_schema.dev.properties.scf_properties.scf_properties | ||
mp_props = qc_schema.dev.properties.mp_properties.mp_properties | ||
|
||
def write_header(data, header): | ||
data.append("") | ||
data.append(header) | ||
data.append("-" * len(header)) | ||
data.append("") | ||
|
||
def write_line_items(data, key, item): | ||
data.append("") | ||
data.append(key) | ||
data.append("~" * len(key)) | ||
data.append("") | ||
if "description" in item: | ||
data.append(item["description"]) | ||
else: | ||
data.append("No description available") | ||
data.append("") | ||
|
||
|
||
prop_file = ["Schema Properties"] | ||
prop_file.append("=" * len(prop_file[-1])) | ||
|
||
intro = """ | ||
A list of valid quantum chemistry properties tracked by the schema. | ||
""" | ||
|
||
prop_file.extend(intro.split()) | ||
|
||
# Write out SCF properties | ||
write_header(prop_file, "SCF Properties") | ||
|
||
for key, value in scf_props.items(): | ||
write_line_items(prop_file, key, value) | ||
|
||
# Write out MP properties | ||
write_header(prop_file, "Moller-Plesset Properties") | ||
|
||
for key, value in mp_props.items(): | ||
write_line_items(prop_file, key, value) | ||
|
||
# Write out the file | ||
with open("auto_props.rst", "w") as outfile: | ||
outfile.write("\n".join(prop_file)) | ||
|
||
|
||
### Write out Topology | ||
|
||
top_file = ["Schema Topology"] | ||
top_file.append("=" * len(top_file[-1])) | ||
|
||
intro = """ | ||
A list of valid quantum chemistry properties tracked by the schema. | ||
""" | ||
|
||
top_file.extend(intro.split()) | ||
|
||
topo_props = qc_schema.dev.molecule.molecule["properties"] | ||
|
||
for key, value in topo_props.items(): | ||
write_line_items(top_file, key, value) | ||
|
||
# Write out the file | ||
with open("auto_topology.rst", "w") as outfile: | ||
outfile.write("\n".join(top_file)) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, based on #35 that it makes sense to have an "identifier" section, with comment, molecule name, formula, InChI, SMILES, etc. as optional. This would probably also include provenance and DOI.
Looking at my notes, I think these were grouped in the discussion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you thinking of
comment
as a dictionary? I was considering moving up a few of those to top level optional fields.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I'm thinking that there's an obvious request for identifiers, and I think comment/title have usually been identifiers in QC codes.
So my suggestion is that there's an explicit identifier object - something like: