Skip to content

Commit

Permalink
Merge pull request #266 from loriab/docs1
Browse files Browse the repository at this point in the history
pydantic >= 1.8.2
  • Loading branch information
bennybp authored Jun 29, 2021
2 parents 7efbf60 + ef72ac1 commit 5e413e6
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Physical constants can be acquired directly from the [NIST CODATA](https://physi
>>> qcel.constants.get('hartree ENERGY in ev')
27.21138602
>>> pc = qcel.constants.get('hartree ENERGY in ev', return_tuple=True)
>>> pc.lbl
>>> pc.label
'Hartree energy in eV'
>>> pc.data
Decimal('27.21138602')
Expand Down
3 changes: 2 additions & 1 deletion devtools/conda-envs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ more common `conda create` (the commands are slightly different as of writing,
circa Conda 4.3), so note the difference in commands.

* `base.yaml` is environment specification for general use.
* `minimal_pins.yaml` is primarily for CI canary testing. It specifies
* `base-cf.yaml` is the conda-forge-only version of `base.yaml`.
* `minimal.yaml` is primarily for CI canary testing. It specifies
minimal dependency set and pins to what we think are the minimal versions.

## Requirements to use Environments
Expand Down
2 changes: 1 addition & 1 deletion devtools/conda-envs/base-cf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dependencies:
- nomkl
- python
- pint>=0.10.0
- pydantic>=1.5.0,!=1.6.0,!=1.8.0
- pydantic>=1.8.2

# Optional depends
- msgpack-python
Expand Down
4 changes: 2 additions & 2 deletions devtools/conda-envs/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ dependencies:
- nomkl
- python
- pint>=0.10.0
- pydantic>=1.5.0,!=1.6.0,!=1.8.0
- dataclasses
- pydantic>=1.8.2
- dataclasses # only for py36 and only b/c default channel pydantic missing the conditional dep

# Optional depends
- msgpack-python
Expand Down
3 changes: 2 additions & 1 deletion devtools/conda-envs/minimal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ dependencies:
- nomkl
- python
- pint=0.10.0 # technically, qcel has no lower bound for pint version for py36,37 but needs 0.10 for 38
- pydantic=1.5.0
- pydantic=1.8.2
- dataclasses # until drop py36

# Testing
- pytest=4.6.4 # technically, qcel works with 4.0.0 but c-f doesn't have py38 builds for it
Expand Down
17 changes: 17 additions & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,23 @@ Changelog
.. +++++++++
0.21.0 / 2021-MM-DD
-------------------

New Features
++++++++++++
- (:pr:`xxx`) Serialization learned msgpack mode that, in contrast to msgpack-ext, *doesn't* embed NumPy objects.

Enhancements
++++++++++++
- (:pr:`266`) Testing function ``compare_values()`` learned to print RMS and MAX statistics for arrays.

Bug Fixes
+++++++++
- (:pr:`265`) Fix search path construction. @sheepforce
- (:pr:`266`) Bump minimum pydantic to 1.8.2 to avoid security hole -- https://github.com/samuelcolvin/pydantic/security/advisories/GHSA-5jqp-qgf6-3pvh .


0.20.0 / 2021-05-16
-------------------

Expand Down
5 changes: 5 additions & 0 deletions qcelemental/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,18 @@ def compare_values(
diff[isclose] = 0.0
diff_str = np.array_str(diff, max_line_width=120, precision=12, suppress_small=False)
diff_str = "\n".join(" " + ln for ln in diff_str.splitlines())
digits_str += f" (o-e: RMS {_rms(cptd) - _rms(xptd):.1e}, MAX {np.amax(np.absolute(diff)):.1e})"
message = """\t{}: computed value does not match {}.\n Expected:\n{}\n Observed:\n{}\n Difference (passed elements are zeroed):\n{}\n""".format(
label, digits_str, xptd_str, cptd_str, diff_str
)

return return_handler(allclose, label, message, return_message, quiet)


def _rms(arr: np.ndarray) -> float:
return np.sqrt(np.mean(np.square(arr)))


def compare(
expected: Union[int, bool, str, List[int], np.ndarray],
computed: Union[int, bool, str, List[int], np.ndarray],
Expand Down
6 changes: 3 additions & 3 deletions qcelemental/tests/test_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
False,
(
None,
"""test_compare_values: computed value does not match to atol=0.1.
"""test_compare_values: computed value does not match to atol=0.1 (o-e: RMS -1.2e-02, MAX 6.0e+00).
Expected:
[0. 1. 2. 3.]
Observed:
Expand All @@ -104,7 +104,7 @@
False,
(
None,
"""test_compare_values: computed value does not match to atol=0.01.
"""test_compare_values: computed value does not match to atol=0.01 (o-e: RMS 1.2e-02, MAX 2.0e-02).
Expected:
[0. 1. 2. 3.]
Observed:
Expand All @@ -122,7 +122,7 @@
False,
(
None,
"""test_compare_values: computed value does not match to atol=0.01.
"""test_compare_values: computed value does not match to atol=0.01 (o-e: RMS 1.2e-02, MAX 2.0e-02).
Expected:
[[0. 1.]
[2. 3.]]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
package_data={'': [os.path.join('qcelemental', 'data', '*.json')]},
setup_requires=[] + pytest_runner,
python_requires='>=3.6',
install_requires=["numpy >= 1.12.0", "pint >= 0.10.0", "pydantic >=1.5.0,!=1.6.0,!=1.8.0"],
install_requires=["numpy >= 1.12.0", "pint >= 0.10.0", "pydantic >=1.8.2"],
extras_require={
'docs': [
'numpydoc',
Expand Down

0 comments on commit 5e413e6

Please sign in to comment.