Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-unyt for openSUSE:Factory checked in at 2021-04-27 21:35:07 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-unyt (Old) and /work/SRC/openSUSE:Factory/.python-unyt.new.12324 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-unyt" Tue Apr 27 21:35:07 2021 rev:2 rq:888647 version:2.8.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-unyt/python-unyt.changes 2020-09-01 20:09:13.224644385 +0200 +++ /work/SRC/openSUSE:Factory/.python-unyt.new.12324/python-unyt.changes 2021-04-27 21:35:32.628070862 +0200 @@ -1,0 +2,12 @@ +Tue Apr 27 05:38:31 UTC 2021 - Steve Kowalik <[email protected]> + +- Update to 2.8.0: + * Dropped support for Python 3.5. + * Add delta_degC and delta_degF units to support temperature difference arithmetic. See PR #152. Thank you to Lee Johnston (@l-johnston on GitHub) for the contribution. + * Fix an issue where a subsequent load of the unit registry with units that are equal but not identical leads to a crash. See PR #158. Thank you to Matthew Turk (@matthewturk on GitHub) for the initial bug report and fix. + * Add force unit kip and pressure unit psi. Thank you to P. Talley (@otaithleigh on GitHub) for the contribution. See PR #162. + * Fix an issue where arithmetic operations on units defined in different registries and having the conversion defined in one direction would lead to a crash. See PR #164. Thank you to Cl??ment Robert (@neutrinoceros on GitHub) for the initial bug report and fix. +- Do not build for Python 2, since no longer supported by upstream, and also + do not build for Python 3.6, due to no NumPy. + +------------------------------------------------------------------- Old: ---- unyt-2.7.2.tar.gz New: ---- unyt-2.8.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-unyt.spec ++++++ --- /var/tmp/diff_new_pack.wwhvPv/_old 2021-04-27 21:35:33.128071685 +0200 +++ /var/tmp/diff_new_pack.wwhvPv/_new 2021-04-27 21:35:33.132071692 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-unyt # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,8 +17,10 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} +%define skip_python2 1 +%define skip_python36 1 Name: python-unyt -Version: 2.7.2 +Version: 2.8.0 Release: 0 Summary: A package for handling numpy arrays with units License: BSD-3-Clause @@ -54,8 +56,8 @@ %python_expand %fdupes %{buildroot}%{$python_sitelib} %check -# test_old_registry_json - requires fixture data not provided in tarball -%pytest unyt/tests -k 'not test_old_registry_json' +# Two old registry tests requires fixture data not provided in tarball +%pytest unyt/tests -k 'not (test_old_registry_json or test_old_registry_multiple_load)' %files %{python_files} %doc *.rst ++++++ unyt-2.7.2.tar.gz -> unyt-2.8.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unyt-2.7.2/HISTORY.rst new/unyt-2.8.0/HISTORY.rst --- old/unyt-2.7.2/HISTORY.rst 2020-06-29 19:00:03.000000000 +0200 +++ new/unyt-2.8.0/HISTORY.rst 2020-10-05 21:45:39.000000000 +0200 @@ -2,6 +2,28 @@ History ======= +2.8.0 (2020-10-05) +------------------ + +* Dropped support for Python 3.5. +* Add ``delta_degC`` and ``delta_degF`` units to support temperature difference + arithmetic. See `PR #152 + <https://github.com/yt-project/unyt/pull/152>`_. Thank you to Lee Johnston + (@l-johnston on GitHub) for the contribution. +* Fix an issue where a subsequent load of the unit registry with units that are + equal but not identical leads to a crash. See `PR #158 + <https://github.com/yt-project/unyt/pull/158>`_. Thank you to Matthew Turk + (@matthewturk on GitHub) for the initial bug report and fix. +* Add force unit ``kip`` and pressure unit ``psi``. Thank you to P. Talley + (@otaithleigh on GitHub) for the contribution. See `PR #162 + <https://github.com/yt-project/unyt/pull/162>`_. +* Fix an issue where arithmetic operations on units defined in different + registries and having the conversion defined in one direction would lead to a + crash. See `PR #164 <https://github.com/yt-project/unyt/pull/164>`_. Thank + you to Cl??ment Robert (@neutrinoceros on GitHub) for the initial bug report + and fix. + + 2.7.2 (2020-06-29) ------------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unyt-2.7.2/PKG-INFO new/unyt-2.8.0/PKG-INFO --- old/unyt-2.7.2/PKG-INFO 2020-06-29 20:16:45.000000000 +0200 +++ new/unyt-2.8.0/PKG-INFO 2020-10-05 22:18:10.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: unyt -Version: 2.7.2 +Version: 2.8.0 Summary: A package for handling numpy arrays with units Home-page: https://github.com/yt-project/unyt Author: The yt project @@ -112,6 +112,28 @@ History ======= + 2.8.0 (2020-10-05) + ------------------ + + * Dropped support for Python 3.5. + * Add ``delta_degC`` and ``delta_degF`` units to support temperature difference + arithmetic. See `PR #152 + <https://github.com/yt-project/unyt/pull/152>`_. Thank you to Lee Johnston + (@l-johnston on GitHub) for the contribution. + * Fix an issue where a subsequent load of the unit registry with units that are + equal but not identical leads to a crash. See `PR #158 + <https://github.com/yt-project/unyt/pull/158>`_. Thank you to Matthew Turk + (@matthewturk on GitHub) for the initial bug report and fix. + * Add force unit ``kip`` and pressure unit ``psi``. Thank you to P. Talley + (@otaithleigh on GitHub) for the contribution. See `PR #162 + <https://github.com/yt-project/unyt/pull/162>`_. + * Fix an issue where arithmetic operations on units defined in different + registries and having the conversion defined in one direction would lead to a + crash. See `PR #164 <https://github.com/yt-project/unyt/pull/164>`_. Thank + you to Cl??ment Robert (@neutrinoceros on GitHub) for the initial bug report + and fix. + + 2.7.2 (2020-06-29) ------------------ Binary files old/unyt-2.7.2/docs/_build/html/_images/mpl_fig1.png and new/unyt-2.8.0/docs/_build/html/_images/mpl_fig1.png differ Binary files old/unyt-2.7.2/docs/_build/html/_images/mpl_fig2.png and new/unyt-2.8.0/docs/_build/html/_images/mpl_fig2.png differ Binary files old/unyt-2.7.2/docs/_build/html/_images/mpl_fig3.png and new/unyt-2.8.0/docs/_build/html/_images/mpl_fig3.png differ Binary files old/unyt-2.7.2/docs/_build/html/_images/mpl_fig4.png and new/unyt-2.8.0/docs/_build/html/_images/mpl_fig4.png differ Binary files old/unyt-2.7.2/docs/_build/html/_images/mpl_fig5.png and new/unyt-2.8.0/docs/_build/html/_images/mpl_fig5.png differ Binary files old/unyt-2.7.2/docs/_build/html/_static/file.png and new/unyt-2.8.0/docs/_build/html/_static/file.png differ Binary files old/unyt-2.7.2/docs/_build/html/_static/minus.png and new/unyt-2.8.0/docs/_build/html/_static/minus.png differ Binary files old/unyt-2.7.2/docs/_build/html/_static/mpl_fig1.png and new/unyt-2.8.0/docs/_build/html/_static/mpl_fig1.png differ Binary files old/unyt-2.7.2/docs/_build/html/_static/mpl_fig2.png and new/unyt-2.8.0/docs/_build/html/_static/mpl_fig2.png differ Binary files old/unyt-2.7.2/docs/_build/html/_static/mpl_fig3.png and new/unyt-2.8.0/docs/_build/html/_static/mpl_fig3.png differ Binary files old/unyt-2.7.2/docs/_build/html/_static/mpl_fig4.png and new/unyt-2.8.0/docs/_build/html/_static/mpl_fig4.png differ Binary files old/unyt-2.7.2/docs/_build/html/_static/mpl_fig5.png and new/unyt-2.8.0/docs/_build/html/_static/mpl_fig5.png differ Binary files old/unyt-2.7.2/docs/_build/html/_static/plus.png and new/unyt-2.8.0/docs/_build/html/_static/plus.png differ Binary files old/unyt-2.7.2/docs/_build/html/_static/yt_icon.png and new/unyt-2.8.0/docs/_build/html/_static/yt_icon.png differ Binary files old/unyt-2.7.2/docs/_build/html/_static/yt_logo.png and new/unyt-2.8.0/docs/_build/html/_static/yt_logo.png differ Binary files old/unyt-2.7.2/docs/_build/html/_static/yt_logo_small.png and new/unyt-2.8.0/docs/_build/html/_static/yt_logo_small.png differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unyt-2.7.2/docs/modules/unyt.array.rst new/unyt-2.8.0/docs/modules/unyt.array.rst --- old/unyt-2.7.2/docs/modules/unyt.array.rst 2020-06-29 19:03:58.000000000 +0200 +++ new/unyt-2.8.0/docs/modules/unyt.array.rst 1970-01-01 01:00:00.000000000 +0100 @@ -1,7 +0,0 @@ -unyt.array module -================= - -.. automodule:: unyt.array - :members: - :undoc-members: - :show-inheritance: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unyt-2.7.2/docs/modules/unyt.dimensions.rst new/unyt-2.8.0/docs/modules/unyt.dimensions.rst --- old/unyt-2.7.2/docs/modules/unyt.dimensions.rst 2020-06-29 19:03:58.000000000 +0200 +++ new/unyt-2.8.0/docs/modules/unyt.dimensions.rst 1970-01-01 01:00:00.000000000 +0100 @@ -1,7 +0,0 @@ -unyt.dimensions module -====================== - -.. automodule:: unyt.dimensions - :members: - :undoc-members: - :show-inheritance: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unyt-2.7.2/docs/modules/unyt.equivalencies.rst new/unyt-2.8.0/docs/modules/unyt.equivalencies.rst --- old/unyt-2.7.2/docs/modules/unyt.equivalencies.rst 2020-06-29 19:03:58.000000000 +0200 +++ new/unyt-2.8.0/docs/modules/unyt.equivalencies.rst 1970-01-01 01:00:00.000000000 +0100 @@ -1,7 +0,0 @@ -unyt.equivalencies module -========================= - -.. automodule:: unyt.equivalencies - :members: - :undoc-members: - :show-inheritance: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unyt-2.7.2/docs/modules/unyt.exceptions.rst new/unyt-2.8.0/docs/modules/unyt.exceptions.rst --- old/unyt-2.7.2/docs/modules/unyt.exceptions.rst 2020-06-29 19:03:58.000000000 +0200 +++ new/unyt-2.8.0/docs/modules/unyt.exceptions.rst 1970-01-01 01:00:00.000000000 +0100 @@ -1,7 +0,0 @@ -unyt.exceptions module -====================== - -.. automodule:: unyt.exceptions - :members: - :undoc-members: - :show-inheritance: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unyt-2.7.2/docs/modules/unyt.mpl_interface.rst new/unyt-2.8.0/docs/modules/unyt.mpl_interface.rst --- old/unyt-2.7.2/docs/modules/unyt.mpl_interface.rst 2020-06-29 19:03:58.000000000 +0200 +++ new/unyt-2.8.0/docs/modules/unyt.mpl_interface.rst 1970-01-01 01:00:00.000000000 +0100 @@ -1,7 +0,0 @@ -unyt.mpl\_interface module -========================== - -.. automodule:: unyt.mpl_interface - :members: - :undoc-members: - :show-inheritance: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unyt-2.7.2/docs/modules/unyt.physical_constants.rst new/unyt-2.8.0/docs/modules/unyt.physical_constants.rst --- old/unyt-2.7.2/docs/modules/unyt.physical_constants.rst 2020-06-29 19:03:58.000000000 +0200 +++ new/unyt-2.8.0/docs/modules/unyt.physical_constants.rst 1970-01-01 01:00:00.000000000 +0100 @@ -1,7 +0,0 @@ -unyt.physical\_constants module -=============================== - -.. automodule:: unyt.physical_constants - :members: - :undoc-members: - :show-inheritance: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unyt-2.7.2/docs/modules/unyt.rst new/unyt-2.8.0/docs/modules/unyt.rst --- old/unyt-2.7.2/docs/modules/unyt.rst 2020-06-29 19:11:43.000000000 +0200 +++ new/unyt-2.8.0/docs/modules/unyt.rst 1970-01-01 01:00:00.000000000 +0100 @@ -1,24 +0,0 @@ -unyt package -============ - -.. automodule:: unyt - :members: - :undoc-members: - :show-inheritance: - -Submodules ----------- - -.. toctree:: - - unyt.array - unyt.dimensions - unyt.equivalencies - unyt.exceptions - unyt.mpl_interface - unyt.physical_constants - unyt.testing - unyt.unit_object - unyt.unit_registry - unyt.unit_symbols - unyt.unit_systems diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unyt-2.7.2/docs/modules/unyt.testing.rst new/unyt-2.8.0/docs/modules/unyt.testing.rst --- old/unyt-2.7.2/docs/modules/unyt.testing.rst 2020-06-29 19:03:58.000000000 +0200 +++ new/unyt-2.8.0/docs/modules/unyt.testing.rst 1970-01-01 01:00:00.000000000 +0100 @@ -1,7 +0,0 @@ -unyt.testing module -=================== - -.. automodule:: unyt.testing - :members: - :undoc-members: - :show-inheritance: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unyt-2.7.2/docs/modules/unyt.unit_object.rst new/unyt-2.8.0/docs/modules/unyt.unit_object.rst --- old/unyt-2.7.2/docs/modules/unyt.unit_object.rst 2020-06-29 19:03:58.000000000 +0200 +++ new/unyt-2.8.0/docs/modules/unyt.unit_object.rst 1970-01-01 01:00:00.000000000 +0100 @@ -1,7 +0,0 @@ -unyt.unit\_object module -======================== - -.. automodule:: unyt.unit_object - :members: - :undoc-members: - :show-inheritance: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unyt-2.7.2/docs/modules/unyt.unit_registry.rst new/unyt-2.8.0/docs/modules/unyt.unit_registry.rst --- old/unyt-2.7.2/docs/modules/unyt.unit_registry.rst 2020-06-29 19:03:58.000000000 +0200 +++ new/unyt-2.8.0/docs/modules/unyt.unit_registry.rst 1970-01-01 01:00:00.000000000 +0100 @@ -1,7 +0,0 @@ -unyt.unit\_registry module -========================== - -.. automodule:: unyt.unit_registry - :members: - :undoc-members: - :show-inheritance: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unyt-2.7.2/docs/modules/unyt.unit_symbols.rst new/unyt-2.8.0/docs/modules/unyt.unit_symbols.rst --- old/unyt-2.7.2/docs/modules/unyt.unit_symbols.rst 2020-06-29 19:03:58.000000000 +0200 +++ new/unyt-2.8.0/docs/modules/unyt.unit_symbols.rst 1970-01-01 01:00:00.000000000 +0100 @@ -1,7 +0,0 @@ -unyt.unit\_symbols module -========================= - -.. automodule:: unyt.unit_symbols - :members: - :undoc-members: - :show-inheritance: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unyt-2.7.2/docs/modules/unyt.unit_systems.rst new/unyt-2.8.0/docs/modules/unyt.unit_systems.rst --- old/unyt-2.7.2/docs/modules/unyt.unit_systems.rst 2020-06-29 19:03:58.000000000 +0200 +++ new/unyt-2.8.0/docs/modules/unyt.unit_systems.rst 1970-01-01 01:00:00.000000000 +0100 @@ -1,7 +0,0 @@ -unyt.unit\_systems module -========================= - -.. automodule:: unyt.unit_systems - :members: - :undoc-members: - :show-inheritance: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unyt-2.7.2/docs/usage.rst new/unyt-2.8.0/docs/usage.rst --- old/unyt-2.7.2/docs/usage.rst 2020-06-23 04:14:59.000000000 +0200 +++ new/unyt-2.8.0/docs/usage.rst 2020-10-05 21:07:38.000000000 +0200 @@ -335,8 +335,8 @@ Temperature Units ----------------- -The temperature unit degree Celsius has the symbol ??C, but since the degree character -is an invalid Python identifier, Uynt uses the symbol `degC`. Printing a degree Celsius +The temperature unit degree Celsius has the symbol ``??C``, but since the degree character +is an invalid Python identifier, :mod:`unyt` uses the symbol ``degC``. Printing a degree Celsius quantity will show the correct symbol. >>> from unyt import degC @@ -344,7 +344,7 @@ >>> print(Ta) 23 ??C -The `degC` symbol has alternative names `degree_Celsius`, `Celsius` and `??C`. +The ``degC`` symbol has alternative names ``degree_Celsius``, ``Celsius`` and ``??C``. >>> from unyt import degree_Celsius, unyt_array >>> Ta = 23*degree_Celsius @@ -356,6 +356,20 @@ These comments also apply to degree Fahrenheit. +Performing arithmetic with temperature quantities can be ambiguous. To clarify intent, +:mod:`unyt` has the convenience units ``delta_degC`` and ``delta_degF``. + + >>> from unyt import degC, delta_degC, V + >>> t1 = 23*degC + >>> t2 = 1*delta_degC + >>> print(t1 + t2) + 24 ??C + >>> print(t2 - t1) + -22 ??C + >>> tempco = 10.0*V/delta_degC + >>> print(tempco*2*delta_degC) + 20.0 V + Unit Conversions and Unit Systems +++++++++++++++++++++++++++++++++ @@ -1089,11 +1103,11 @@ ... >>> data = [1, 2, 3]*cm ... - >>> with h5py.File('my_data.h5') as f: + >>> with h5py.File('my_data.h5', 'a') as f: ... d = f.create_dataset('my_data', data=data) ... f['my_data'].attrs['units'] = str(data.units) ... - >>> with h5py.File('my_data.h5') as f: + >>> with h5py.File('my_data.h5', 'r') as f: ... new_data = f['my_data'][:] ... unit_str = f['my_data'].attrs['units'] ... diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unyt-2.7.2/pyproject.toml new/unyt-2.8.0/pyproject.toml --- old/unyt-2.7.2/pyproject.toml 2019-05-18 19:31:32.000000000 +0200 +++ new/unyt-2.8.0/pyproject.toml 1970-01-01 01:00:00.000000000 +0100 @@ -1,21 +0,0 @@ -[tool.black] -line-length = 88 -exclude = ''' -( - /( - \.eggs - | \.git - | \.hg - | \.mypy_cache - | \.tox - | \.venv - | _build - | buck-out - | build - | dist - )/ | ( - versioneer.py - | _version.py - ) -) -''' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unyt-2.7.2/setup.cfg new/unyt-2.8.0/setup.cfg --- old/unyt-2.7.2/setup.cfg 2020-06-29 20:16:45.000000000 +0200 +++ new/unyt-2.8.0/setup.cfg 2020-10-05 22:18:10.000000000 +0200 @@ -18,7 +18,6 @@ test = pytest [tool:pytest] -collect_ignore = ['setup.py'] norecursedirs = benchmarks paper .* [versioneer] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unyt-2.7.2/unyt/_unit_lookup_table.py new/unyt-2.8.0/unyt/_unit_lookup_table.py --- old/unyt-2.7.2/unyt/_unit_lookup_table.py 2020-06-29 19:00:01.000000000 +0200 +++ new/unyt-2.8.0/unyt/_unit_lookup_table.py 2020-10-05 21:07:38.000000000 +0200 @@ -124,7 +124,9 @@ (1.0, dimensions.luminous_flux / dimensions.area, 0.0, r"\rm{lx}", True), ), ("degC", (1.0, dimensions.temperature, -273.15, r"^\circ\rm{C}", True)), + ("delta_degC", (1.0, dimensions.temperature, 0, r"\Delta^\circ\rm{C}", True)), # Imperial and other non-metric units + ("mil", (1e-3 * m_per_inch, dimensions.length, 0.0, r"\rm{mil}", False)), ("inch", (m_per_inch, dimensions.length, 0.0, r"\rm{in}", False)), ("ft", (m_per_ft, dimensions.length, 0.0, r"\rm{ft}", False)), ("yd", (0.9144, dimensions.length, 0.0, r"\rm{yd}", False)), @@ -141,6 +143,16 @@ ), ), ( + "delta_degF", + ( + kelvin_per_rankine, + dimensions.temperature, + 0.0, + r"\Delta^\circ\rm{F}", + False, + ), + ), + ( "R", (kelvin_per_rankine, dimensions.temperature, 0.0, r"^\circ\rm{R}", False), ), @@ -154,6 +166,16 @@ False, ), ), + ( + "kip", + ( + 1000 * kg_per_pound * standard_gravity_m_per_s2, + dimensions.force, + 0.0, + r"\rm{kip}", + False, + ), + ), ("lb", (kg_per_pound, dimensions.mass, 0.0, r"\rm{lb}", False)), ("atm", (pascal_per_atm, dimensions.pressure, 0.0, r"\rm{atm}", False)), ("hp", (watt_per_horsepower, dimensions.power, 0.0, r"\rm{hp}", False)), @@ -181,6 +203,16 @@ False, ), ), + ( + "ksi", + ( + 1000 * kg_per_pound * standard_gravity_m_per_s2 / m_per_inch ** 2, + dimensions.pressure, + 0.0, + r"\rm{ksi}", + False, + ), + ), ("smoot", (1.7018, dimensions.length, 0.0, r"\rm{smoot}", False)), # dimensionless stuff ("dimensionless", (1.0, dimensions.dimensionless, 0.0, r"", False)), @@ -423,6 +455,7 @@ ("lx", ("lux",)), ("degC", ("degree_celsius", "degree_Celsius", "celcius", "celsius", "??C")), # Imperial and other non-metric units + ("mil", ("thou", "thousandth")), ("inch", ("in",)), ("ft", ("foot",)), ("yd", ("yard",)), @@ -430,6 +463,7 @@ ("degF", ("degree_fahrenheit", "degree_Fahrenheit", "fahrenheit", "??F")), ("R", ("degree_rankine", "rankine")), ("lbf", ("pound_force",)), + ("kip", ("kilopound", "kipf")), ("lb", ("pound", "pound_mass", "lbm")), ("atm", ("atmosphere",)), ("hp", ("horsepower",)), @@ -437,6 +471,7 @@ ("cal", ("calorie",)), ("BTU", ("british_thermal_unit",)), ("psi", ("pounds_per_square_inch",)), + ("ksi", ("kips_per_square_inch",)), # dimensionless stuff ("dimensionless", ("_", "")), ("B", ("bel",)), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unyt-2.7.2/unyt/_version.py new/unyt-2.8.0/unyt/_version.py --- old/unyt-2.7.2/unyt/_version.py 2020-06-29 20:16:45.000000000 +0200 +++ new/unyt-2.8.0/unyt/_version.py 2020-10-05 22:18:10.000000000 +0200 @@ -8,11 +8,11 @@ version_json = ''' { - "date": "2020-06-29T11:03:16-0600", + "date": "2020-10-05T14:17:00-0600", "dirty": false, "error": null, - "full-revisionid": "25100c054af7bdfa692074623aa58156560d5f59", - "version": "v2.7.2" + "full-revisionid": "eeefa00a2fddbf0dba6ab854e968ef43e31f851e", + "version": "v2.8.0" } ''' # END VERSION_JSON diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unyt-2.7.2/unyt/array.py new/unyt-2.8.0/unyt/array.py --- old/unyt-2.7.2/unyt/array.py 2020-02-17 19:27:06.000000000 +0100 +++ new/unyt-2.8.0/unyt/array.py 2020-10-05 21:07:38.000000000 +0200 @@ -123,6 +123,7 @@ UnitOperationError, UnitConversionError, UnitsNotReducible, + SymbolNotFoundError, ) from unyt.equivalencies import equivalence_registry from unyt._on_demand_imports import _astropy, _pint @@ -160,11 +161,32 @@ @lru_cache(maxsize=128, typed=False) def _multiply_units(unit1, unit2): - ret = (unit1 * unit2).simplify() + try: + ret = (unit1 * unit2).simplify() + except SymbolNotFoundError: + # Some operators are not natively commutative when operands are + # defined within different unit registries, and conversion + # is defined one way but not the other. + ret = (unit2 * unit1).simplify() return ret.as_coeff_unit() +TEMPERATURE_WARNING = """ + Ambiguous operation with heterogeneous temperature units. + In the future, such operations will generate UnitOperationError. + Use delta_degC or delta_degF to avoid the ambiguity. +""" + + +@lru_cache(maxsize=128, typed=False) def _preserve_units(unit1, unit2=None): + if unit2 is None or unit1.dimensions is not temperature: + return 1, unit1 + if unit1.base_offset == 0.0 and unit2.base_offset != 0.0: + if str(unit1.expr) in ["K", "R"]: + warnings.warn(TEMPERATURE_WARNING, FutureWarning, stacklevel=3) + return 1, unit1 + return 1, unit2 return 1, unit1 @@ -180,7 +202,10 @@ @lru_cache(maxsize=128, typed=False) def _divide_units(unit1, unit2): - ret = (unit1 / unit2).simplify() + try: + ret = (unit1 / unit2).simplify() + except SymbolNotFoundError: + ret = (1 / (unit2 / unit1).simplify()).units return ret.as_coeff_unit() @@ -1408,7 +1433,7 @@ data = dataset[:] units = dataset.attrs.get("units", "") unit_lut = default_unit_symbol_lut.copy() - unit_lut_load = pickle.loads(dataset.attrs["unit_registry"].tostring()) + unit_lut_load = pickle.loads(dataset.attrs["unit_registry"].tobytes()) unit_lut.update(unit_lut_load) f.close() registry = UnitRegistry(lut=unit_lut, add_default_symbols=False) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unyt-2.7.2/unyt/mpl_interface.py new/unyt-2.8.0/unyt/mpl_interface.py --- old/unyt-2.7.2/unyt/mpl_interface.py 2020-02-06 23:06:28.000000000 +0100 +++ new/unyt-2.8.0/unyt/mpl_interface.py 2020-10-05 21:13:18.000000000 +0200 @@ -178,11 +178,11 @@ @property def label_style(self): """str: One of the following set, ``{'()', '[]', '/'}``. - These choices correspond to the following unit labels: + These choices correspond to the following unit labels: - * ``'()'`` -> ``'(unit)'`` - * ``'[]'`` -> ``'[unit]'`` - * ``'/'`` -> ``'q_x / unit'`` + * ``'()'`` -> ``'(unit)'`` + * ``'[]'`` -> ``'[unit]'`` + * ``'/'`` -> ``'q_x / unit'`` """ return self._labelstyle diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unyt-2.7.2/unyt/tests/test_unit_registry.py new/unyt-2.8.0/unyt/tests/test_unit_registry.py --- old/unyt-2.7.2/unyt/tests/test_unit_registry.py 2020-06-23 04:14:59.000000000 +0200 +++ new/unyt-2.8.0/unyt/tests/test_unit_registry.py 2020-07-10 04:01:30.000000000 +0200 @@ -19,10 +19,11 @@ from numpy.testing import assert_allclose -from unyt.dimensions import length, energy +from unyt.dimensions import length, energy, mass, time, temperature from unyt.exceptions import SymbolNotFoundError, UnitParseError from unyt.unit_object import Unit from unyt.unit_registry import UnitRegistry +from unyt.unit_systems import UnitSystem def test_add_modify_error(): @@ -92,9 +93,46 @@ assert reg.lut["tayne"][1] is length +OLD_JSON_PATH = os.sep.join([os.path.dirname(__file__), "data/old_json_registry.txt"]) + + +def test_old_registry_multiple_load(): + # See Issue #157 for details + reg1 = UnitRegistry() + reg1.add("code_length", 1.0, length) + reg1.add("code_mass", 1.0, mass) + reg1.add("code_time", 1.0, time) + reg1.add("code_temperature", 1.0, temperature) + UnitSystem( + reg1.unit_system_id, + "code_length", + "code_mass", + "code_time", + "code_temperature", + registry=reg1, + ) + + cm = Unit("code_mass", registry=reg1) + cl = Unit("code_length", registry=reg1) + + (cm / cl).latex_representation() + + with open(OLD_JSON_PATH) as f: + json_data = f.read() + + reg2 = UnitRegistry.from_json(json_data) + UnitSystem( + reg2.unit_system_id, + "code_length", + "code_mass", + "code_time", + "code_temperature", + registry=reg2, + ) + + def test_old_registry_json(): - path = os.sep.join([os.path.dirname(__file__), "data/old_json_registry.txt"]) - with open(path) as f: + with open(OLD_JSON_PATH) as f: json_text = f.read() reg = UnitRegistry.from_json(json_text) default_reg = UnitRegistry() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unyt-2.7.2/unyt/tests/test_units.py new/unyt-2.8.0/unyt/tests/test_units.py --- old/unyt-2.7.2/unyt/tests/test_units.py 2020-06-29 19:00:01.000000000 +0200 +++ new/unyt-2.8.0/unyt/tests/test_units.py 2020-10-05 21:07:38.000000000 +0200 @@ -28,6 +28,7 @@ import pytest from sympy import Symbol +from unyt.array import unyt_quantity from unyt.testing import assert_allclose_units from unyt.unit_registry import UnitRegistry from unyt.dimensions import ( @@ -857,6 +858,11 @@ assert str(a) == "1 ??C" +def test_delta_degC(): + a = 1 * Unit("delta_degC") + assert str(a) == "1 ????C" + + def test_degF(): assert Unit("degree_fahrenheit") == Unit("degF") assert Unit("degree_Fahrenheit") == Unit("degF") @@ -864,3 +870,22 @@ assert Unit("??F") == Unit("degF") a = 1 * Unit("degF") assert str(a) == "1 ??F" + + +def test_delta_degF(): + a = 1 * Unit("delta_degF") + assert str(a) == "1 ????F" + + +def test_mixed_registry_operations(): + + reg = UnitRegistry(unit_system="cgs") + reg.add("fake_length", 0.001, length) + a = unyt_quantity(1, units="fake_length", registry=reg) + b = unyt_quantity(1, "cm") + + assert_almost_equal(a + b, b + a) + assert_almost_equal(a - b, -(b - a)) + assert_almost_equal(a * b, b * a) + assert_almost_equal(b / a, b / a.in_units("km")) + assert_almost_equal(a / b, a / b.in_units("km")) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unyt-2.7.2/unyt/tests/test_unyt_array.py new/unyt-2.8.0/unyt/tests/test_unyt_array.py --- old/unyt-2.7.2/unyt/tests/test_unyt_array.py 2020-02-17 19:27:06.000000000 +0100 +++ new/unyt-2.8.0/unyt/tests/test_unyt_array.py 2020-10-05 21:07:38.000000000 +0200 @@ -63,7 +63,7 @@ from unyt.unit_registry import UnitRegistry from unyt._on_demand_imports import _astropy, _h5py, _pint, NotAModule from unyt._physical_ratios import metallicity_sun, speed_of_light_cm_per_s -from unyt import dimensions, Unit +from unyt import dimensions, Unit, degC, K, delta_degC, degF, R, delta_degF def operate_and_compare(a, b, op, answer): @@ -2379,3 +2379,47 @@ unyt_array([0, 20], "dB") ** 2 with pytest.raises(InvalidUnitOperation): np.power(unyt_array([0, 20], "dB"), -2) + + +def test_delta_degC(): + t1 = 10 * degC + t2 = 1 * K + assert t1 + t2 == 11 * degC + # In the current implementation 1*K + 10*degC = 11*K + # In the future, this will generate UnitOperationError + with pytest.warns(FutureWarning): + t2 + t1 + assert t2 + t1 == 11 * K + t3 = 1 * delta_degC + assert t1 + t3 == 11 * degC + assert t3 + t1 == 11 * degC + assert 1 * delta_degC + 2 * delta_degC == 3 * delta_degC + assert 2 * delta_degC == unyt_quantity(2, "delta_degC") + + +def test_delta_degF(): + t1 = 10 * degF + t2 = 1 * R + assert t1 + t2 == 11 * degF + # In the current implementation 1*R + 10*degF = 11*R + # In the future, this will generate UnitOperationError + with pytest.warns(FutureWarning): + t2 + t1 + assert t2 + t1 == 11 * R + t3 = 1 * delta_degF + assert t1 + t3 == 11 * degF + assert t3 + t1 == 11 * degF + assert 1 * delta_degF + 2 * delta_degF == 3 * delta_degF + assert 2 * delta_degF == unyt_quantity(2, "delta_degF") + + +def test_mil(): + assert_allclose_units(unyt_quantity(1, "mil"), unyt_quantity(0.001, "inch")) + + +def test_kip(): + assert_allclose_units(unyt_quantity(1, "lbf"), unyt_quantity(0.001, "kip")) + + +def test_ksi(): + assert_allclose_units(unyt_quantity(1, "lbf/inch**2"), unyt_quantity(0.001, "ksi")) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unyt-2.7.2/unyt/unit_object.py new/unyt-2.8.0/unyt/unit_object.py --- old/unyt-2.7.2/unyt/unit_object.py 2020-06-23 04:14:59.000000000 +0200 +++ new/unyt-2.8.0/unyt/unit_object.py 2020-10-05 21:07:38.000000000 +0200 @@ -334,8 +334,12 @@ unit_str = self.expr.__str__() if unit_str == "degC": return "??C" + if unit_str == "delta_degC": + return "????C" if unit_str == "degF": return "??F" + if unit_str == "delta_degF": + return "????F" # @todo: don't use dunder method? return unit_str diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unyt-2.7.2/unyt/unit_registry.py new/unyt-2.8.0/unyt/unit_registry.py --- old/unyt-2.7.2/unyt/unit_registry.py 2020-02-17 19:27:06.000000000 +0100 +++ new/unyt-2.8.0/unyt/unit_registry.py 2020-07-10 04:01:30.000000000 +0200 @@ -340,7 +340,10 @@ unsan_v[1] = cached_sympify(v[1]) if len(unsan_v) == 4: # old unit registry so we need to add SI-prefixability to the registry - # entry and correct the base_value to be in MKS units + # entry, correct the base_value to be in MKS units, and swap dimensions to + # use unyt's dimension singletons + + # add SI-prefixability to LUT entry if k in default_unit_symbol_lut: unsan_v.append(default_unit_symbol_lut[k][4]) else: @@ -348,10 +351,27 @@ dims = unsan_v[1] for dim_factor in dims.as_ordered_factors(): dim, power = dim_factor.as_base_exp() + + # Swap dimensions in the LUT entry to use unyt's dimension singletons + for base_dim in unyt_dims.base_dimensions: + # If they're *equal* but not *identical*, swap them + if base_dim == dim and base_dim is not dim: + if power != 1: + unsan_v[1] /= dim ** power + unsan_v[1] *= base_dim ** power + else: + # need a special case for power == 1 because id(symbol ** 1) + # is not necessarily the same as id(symbol) + unsan_v[1] /= dim + unsan_v[1] *= base_dim + break + + # correct base value to be in MKS units if dim == unyt_dims.mass: unsan_v[0] /= 1000 ** float(power) if dim == unyt_dims.length: unsan_v[0] /= 100 ** float(power) + lut[k] = tuple(unsan_v) for k in default_unit_symbol_lut: if k not in lut: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unyt-2.7.2/unyt.egg-info/PKG-INFO new/unyt-2.8.0/unyt.egg-info/PKG-INFO --- old/unyt-2.7.2/unyt.egg-info/PKG-INFO 2020-06-29 20:16:45.000000000 +0200 +++ new/unyt-2.8.0/unyt.egg-info/PKG-INFO 2020-10-05 22:18:10.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: unyt -Version: 2.7.2 +Version: 2.8.0 Summary: A package for handling numpy arrays with units Home-page: https://github.com/yt-project/unyt Author: The yt project @@ -112,6 +112,28 @@ History ======= + 2.8.0 (2020-10-05) + ------------------ + + * Dropped support for Python 3.5. + * Add ``delta_degC`` and ``delta_degF`` units to support temperature difference + arithmetic. See `PR #152 + <https://github.com/yt-project/unyt/pull/152>`_. Thank you to Lee Johnston + (@l-johnston on GitHub) for the contribution. + * Fix an issue where a subsequent load of the unit registry with units that are + equal but not identical leads to a crash. See `PR #158 + <https://github.com/yt-project/unyt/pull/158>`_. Thank you to Matthew Turk + (@matthewturk on GitHub) for the initial bug report and fix. + * Add force unit ``kip`` and pressure unit ``psi``. Thank you to P. Talley + (@otaithleigh on GitHub) for the contribution. See `PR #162 + <https://github.com/yt-project/unyt/pull/162>`_. + * Fix an issue where arithmetic operations on units defined in different + registries and having the conversion defined in one direction would lead to a + crash. See `PR #164 <https://github.com/yt-project/unyt/pull/164>`_. Thank + you to Cl??ment Robert (@neutrinoceros on GitHub) for the initial bug report + and fix. + + 2.7.2 (2020-06-29) ------------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unyt-2.7.2/unyt.egg-info/SOURCES.txt new/unyt-2.8.0/unyt.egg-info/SOURCES.txt --- old/unyt-2.7.2/unyt.egg-info/SOURCES.txt 2020-06-29 20:16:45.000000000 +0200 +++ new/unyt-2.8.0/unyt.egg-info/SOURCES.txt 2020-10-05 22:18:10.000000000 +0200 @@ -4,7 +4,6 @@ LICENSE MANIFEST.in README.rst -pyproject.toml setup.cfg setup.py versioneer.py @@ -19,22 +18,6 @@ docs/make.bat docs/unit_listing.rst docs/usage.rst -docs/_build/html/_images/mpl_fig1.png -docs/_build/html/_images/mpl_fig2.png -docs/_build/html/_images/mpl_fig3.png -docs/_build/html/_images/mpl_fig4.png -docs/_build/html/_images/mpl_fig5.png -docs/_build/html/_static/file.png -docs/_build/html/_static/minus.png -docs/_build/html/_static/mpl_fig1.png -docs/_build/html/_static/mpl_fig2.png -docs/_build/html/_static/mpl_fig3.png -docs/_build/html/_static/mpl_fig4.png -docs/_build/html/_static/mpl_fig5.png -docs/_build/html/_static/plus.png -docs/_build/html/_static/yt_icon.png -docs/_build/html/_static/yt_logo.png -docs/_build/html/_static/yt_logo_small.png docs/_static/mpl_fig1.png docs/_static/mpl_fig2.png docs/_static/mpl_fig3.png @@ -43,18 +26,6 @@ docs/_static/yt_icon.png docs/_static/yt_logo.png docs/_static/yt_logo_small.png -docs/modules/unyt.array.rst -docs/modules/unyt.dimensions.rst -docs/modules/unyt.equivalencies.rst -docs/modules/unyt.exceptions.rst -docs/modules/unyt.mpl_interface.rst -docs/modules/unyt.physical_constants.rst -docs/modules/unyt.rst -docs/modules/unyt.testing.rst -docs/modules/unyt.unit_object.rst -docs/modules/unyt.unit_registry.rst -docs/modules/unyt.unit_symbols.rst -docs/modules/unyt.unit_systems.rst unyt/__init__.py unyt/_on_demand_imports.py unyt/_parsing.py
