From 965a76447673f8f615ad6c5b11dd32b0f879355e Mon Sep 17 00:00:00 2001 From: "Lori A. Burns" Date: Mon, 31 Jul 2023 14:08:20 -0400 Subject: [PATCH] Update docs location (#311) * Update README.md * pydantic pin, changelog update * clear up numpy deprecation * actually commit * clear skips and warnings * need lower bound? * reorganize extras * modern scipy? * syntax * sep scipy * tidy --- .github/workflows/CI.yaml | 13 +++++++++---- README.md | 4 ++-- docs/changelog.rst | 30 ++++++++++++++++++++++++++++-- pyproject.toml | 21 ++++++++++++++------- qcelemental/models/results.py | 6 +++--- qcelemental/tests/test_molecule.py | 1 + qcelemental/tests/test_utils.py | 8 ++++---- qcelemental/util/misc.py | 2 +- 8 files changed, 62 insertions(+), 23 deletions(-) diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 6dd2718b..e3cd0701 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -10,8 +10,9 @@ jobs: test: runs-on: ubuntu-latest strategy: + fail-fast: true matrix: - python-version: ["3.7", "3.11"] + python-version: ["3.7", "3.9", "3.11"] pydantic-version: ["1", "2"] steps: @@ -31,9 +32,13 @@ jobs: - name: Sed replace pydantic on repo run: | sed -i 's/^pydantic *= *">*= *\([0-9.]*\)"/pydantic = "^\1"/' pyproject.toml - if: ${{ matrix.pydantic-version == 1 }} - - name: Install repo with poetry - run: poetry install --no-interaction --no-ansi + if: matrix.pydantic-version == '1' + - name: Install repo with poetry (full deps) + if: matrix.python-version != '3.9' + run: poetry install --no-interaction --no-ansi --all-extras + - name: Install repo with poetry (min deps) + if: matrix.python-version == '3.9' + run: poetry install --no-interaction --no-ansi --extras test - name: Run tests run: poetry run pytest -rws -v --cov=qcelemental --color=yes --cov-report=xml - name: Upload coverage to Codecov diff --git a/README.md b/README.md index eea589d1..cf6b6514 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,11 @@ [![Build Status](https://github.com/MolSSI/QCElemental/workflows/CI/badge.svg?branch=master)](https://github.com/MolSSI/QCElemental/actions?query=workflow%3ACI) [![codecov](https://img.shields.io/codecov/c/github/MolSSI/QCElemental.svg?logo=Codecov&logoColor=white)](https://codecov.io/gh/MolSSI/QCElemental) -[![Documentation Status](https://img.shields.io/github/workflow/status/MolSSI/QCElemental/CI/master?label=docs&logo=readthedocs&logoColor=white)](http://docs.qcarchive.molssi.org/projects/qcelemental/en/latest/) +[![Documentation Status](https://img.shields.io/github/actions/workflow/status/MolSSI/QCElemental/CI.yaml?label=docs&logo=readthedocs&logoColor=white)](https://molssi.github.io/QCElemental/) [![Chat on Slack](https://img.shields.io/badge/chat-on_slack-green.svg?longCache=true&style=flat&logo=slack)](https://join.slack.com/t/qcarchive/shared_invite/enQtNDIzNTQ2OTExODk0LTE3MWI0YzBjNzVhNzczNDM0ZTA5MmQ1ODcxYTc0YTA1ZDQ2MTk1NDhlMjhjMmQ0YWYwOGMzYzJkZTM2NDlmOGM) ![python](https://img.shields.io/badge/python-3.7+-blue.svg) -**Documentation:** [Read The Docs](http://docs.qcarchive.molssi.org/projects/qcelemental/en/latest/index.html) +**Documentation:** [GitHub Pages](https://molssi.github.io/QCElemental/) Core data structures for Quantum Chemistry. QCElemental also contains physical constants and periodic table data from NIST and molecule handlers. diff --git a/docs/changelog.rst b/docs/changelog.rst index 0322677f..d2d8bf8a 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,7 +1,7 @@ Changelog ========= -.. X.Y.0 / 2022-MM-DD +.. X.Y.0 / 2023-MM-DD .. ------------------- .. .. Breaking Changes @@ -22,6 +22,22 @@ Unreleased Breaking Changes ++++++++++++++++ +New Features +++++++++++++ + +Enhancements +++++++++++++ + +Bug Fixes ++++++++++ + + +0.26.0 / 2023-07-31 +------------------- + +Breaking Changes +++++++++++++++++ + - (:pr:`308`) Fix CI Pipelines. Dropped Python3.6. Bring CI pipelines into harmony with local dev experience. Lint and format entire code base. Accelerate CI pipelines. Update setup.py to correctly define extras packages. Breaking change due to dropped support for Python3.6. No code functionality was altered. - Dropped support for dead Python 3.6. Minimum supported Python is now 3.7. - Updated CONTRIBUTING.md to contain detailed instructions for developers on how to contribute. @@ -36,12 +52,22 @@ Enhancements - (:pr:`310`) Modernize DevOps Tooling - Added `/scripts` directory to root of project that contains scripts for testing, formatting code, and building docs. - Updated build system from `setuptools` to modern `pyproject.toml` specification using `poetry` for the build backend. - - Removed complicated versioning code in favor of single source of truth in `pyproject.toml`. Using standard library `importlib` for looking up package version in `__init__.py` file. + - Removed complicated versioning code in favor of single source of truth in `pyproject.toml`. Using standard library `importlib` for looking up package version in `__init__.py` file. - Added `build_docs.sh` script to `/scrips` and removed `Makefile` from `/docs`. Flattened `/docs` file structure. - Removed `travis-ci` code from `devtools` - Removed LGTM code (they no longer exist as a project). - Bring all package directories under `black`, `isort`, and `autoflake` control. +Bug Fixes ++++++++++ +- (:pr:`305`) Initialize `Molecule.extras` as empty dictionary. +- (:pr:`311`) Update docs location from RTD to GH pages. Resolve escape char warnings. Update changelog. +- (:pr:`311`) Clear up NumPy "Conversion of an array with ndim > 0 to a scalar is deprecated" in + `util.measure_coordinates` called by `Molecule.measure`. +- (:pr:`314`) Import `pydantic.v1` from pydantic v2 so that QCElemental can work with any >=1.8.2 pydantic + until QCElemental is updated for v2. + + 0.25.1 / 2022-10-31 ------------------- diff --git a/pyproject.toml b/pyproject.toml index 752b8499..b6cc5365 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,9 +5,9 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "qcelemental" -version = "0.25.1" +version = "0.26.0" description = "Core data structures for Quantum Chemistry." -authors = ["The QCArchive Development Team "] +authors = ["The QCArchive Development Team "] license = "BSD-3-Clause" readme = "README.md" homepage = "https://github.com/MolSSI/QCElemental" @@ -32,12 +32,20 @@ numpy = [ python = "^3.7" pint = ">=0.10.0" pydantic = ">=1.8.2" -nglview = { extras = ["viz"], version = "^3.0.3" } -ipykernel = { version = "<6.0.0", extras = ["viz"] } +nglview = { version = "^3.0.3", optional = true } +ipykernel = { version = "<6.0.0", optional = true } importlib-metadata = { version = ">=4.8", python = "<3.8" } -networkx = { version = "<3.0", extras = ["align"] } -pytest = { extras = ["test"], version = "^7.2.2" } +networkx = { version = "<3.0", optional = true } +scipy = [ + { version = ">=1.6.0", python = "<3.9", optional = true }, + { version = ">=1.9.0", python = ">=3.9", optional = true }, +] +pytest = { version = "^7.2.2", optional = true } +[tool.poetry.extras] +viz = ["nglview", "ipykernel"] +align = ["networkx", "scipy"] +test = ["pytest"] [tool.poetry.group.dev.dependencies] black = ">=23.1.0" @@ -62,7 +70,6 @@ sphinx-autodoc-typehints = "^1.22" line-length = 120 target-version = ['py37'] - [tool.isort] force_grid_wrap = 0 include_trailing_comma = true diff --git a/qcelemental/models/results.py b/qcelemental/models/results.py index 5962aa37..e6288a42 100644 --- a/qcelemental/models/results.py +++ b/qcelemental/models/results.py @@ -44,16 +44,16 @@ class AtomicResultProperties(ProtoModel): nuclear_repulsion_energy: Optional[float] = Field(None, description="The nuclear repulsion energy.") return_energy: Optional[float] = Field( None, - description="The energy of the requested method, identical to :attr:`~qcelemental.models.AtomicResult.return_result` for :attr:`~qcelemental.models.AtomicInput.driver`\ =\ :attr:`~qcelemental.models.DriverEnum.energy` computations.", + description=f"The energy of the requested method, identical to :attr:`~qcelemental.models.AtomicResult.return_result` for :attr:`~qcelemental.models.AtomicInput.driver`\\ =\\ :attr:`~qcelemental.models.DriverEnum.energy` computations.", ) return_gradient: Optional[Array[float]] = Field( None, - description="The gradient of the requested method, identical to :attr:`~qcelemental.models.AtomicResult.return_result` for :attr:`~qcelemental.models.AtomicInput.driver`\ =\ :attr:`~qcelemental.models.DriverEnum.gradient` computations.", + description=f"The gradient of the requested method, identical to :attr:`~qcelemental.models.AtomicResult.return_result` for :attr:`~qcelemental.models.AtomicInput.driver`\\ =\\ :attr:`~qcelemental.models.DriverEnum.gradient` computations.", units="E_h/a0", ) return_hessian: Optional[Array[float]] = Field( None, - description="The Hessian of the requested method, identical to :attr:`~qcelemental.models.AtomicResult.return_result` for :attr:`~qcelemental.models.AtomicInput.driver`\ =\ :attr:`~qcelemental.models.DriverEnum.hessian` computations.", + description=f"The Hessian of the requested method, identical to :attr:`~qcelemental.models.AtomicResult.return_result` for :attr:`~qcelemental.models.AtomicInput.driver`\\ =\\ :attr:`~qcelemental.models.DriverEnum.hessian` computations.", units="E_h/a0^2", ) diff --git a/qcelemental/tests/test_molecule.py b/qcelemental/tests/test_molecule.py index 5d4c07d8..1d7b82ab 100644 --- a/qcelemental/tests/test_molecule.py +++ b/qcelemental/tests/test_molecule.py @@ -536,6 +536,7 @@ def test_molecule_repeated_hashing(): ([0, 1, 2, 3], 180.0), ([[0, 1, 2, 3]], [180.0]), ([[1, 3], [3, 1], [1, 2, 3]], [6.3282716, 6.3282716, 149.51606694803903]), + ([[0, 1, 2, 3], [3, 2, 1, 0]], [180.0, 180.0]), ], ) def test_measurements(measure, result): diff --git a/qcelemental/tests/test_utils.py b/qcelemental/tests/test_utils.py index 0c4b8be9..f8c70aff 100644 --- a/qcelemental/tests/test_utils.py +++ b/qcelemental/tests/test_utils.py @@ -145,7 +145,7 @@ def test_unnp(inp, expected): def test_distance(): def _test_distance(p1, p2, value): tmp = qcel.util.compute_distance(p1, p2) - assert compare_values(value, float(tmp)) + assert compare_values(value, tmp[0]) _test_distance([0, 0, 0], [0, 0, 1], 1.0) _test_distance([0, 0, 0], [0, 0, 0], 0.0) @@ -160,7 +160,7 @@ def _test_distance(p1, p2, value): def test_angle(): def _test_angle(p1, p2, p3, value, degrees=True): tmp = qcel.util.compute_angle(p1, p2, p3, degrees=degrees) - assert compare_values(value, float(tmp)) + assert compare_values(value, tmp[0]) # Check all 90 degree domains p1 = [5, 0, 0] @@ -194,7 +194,7 @@ def _test_angle(p1, p2, p3, value, degrees=True): def test_dihedral1(): def _test_dihedral(p1, p2, p3, p4, value, degrees=True): tmp = qcel.util.compute_dihedral(p1, p2, p3, p4, degrees=degrees) - assert compare_values(value, float(tmp), label="test_dihedral1") + assert compare_values(value, tmp[0], label="test_dihedral1") p1 = [0, 0, 0] p2 = [0, 2, 0] @@ -231,7 +231,7 @@ def test_dihedral2(): def _test_dihedral(p1, p2, p3, p4, value, degrees=True): tmp = qcel.util.compute_dihedral(p1, p2, p3, p4, degrees=degrees) - assert compare_values(value, float(tmp), label="test_dihedral1") + assert compare_values(value, tmp[0], label="test_dihedral1") p0 = [24.969, 13.428, 30.692] p1 = [24.044, 12.661, 29.808] diff --git a/qcelemental/util/misc.py b/qcelemental/util/misc.py index a5d3bda4..ad9f9076 100644 --- a/qcelemental/util/misc.py +++ b/qcelemental/util/misc.py @@ -175,7 +175,7 @@ def measure_coordinates(coordinates, measurements, degrees=False): raise KeyError(f"Unrecognized number of arguments for measurement {num}, found {len(m)}, expected 2-4.") val = func(*[coordinates[x] for x in m], **kwargs) - ret.append(float(val)) + ret.append(val[0]) if single: return ret[0]