diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 253a4febd..a07353e3f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -804,7 +804,7 @@ changes - `CoordinateSystemManager.plot_graph` now renders static and time-dependent edges differently [:pull:`291`] -- use `pint` compatible array syntax in +- use ``pint`` compatible array syntax in `welding.groove.iso_9692_1.IsoBaseGroove.to_profile` methods [:pull:`189`] - CSM and LCS plot function get a ``scale_vectors`` parameter. It @@ -975,7 +975,7 @@ dependencies added ===== -- Added `util.ureg_check_class` class decorator to enable `pint` +- Added `util.ureg_check_class` class decorator to enable ``pint`` dimensionality checks with ``@dataclass`` [:pull:`179`]. - Made coordinates and orientations optional for LCS schema. Missing @@ -1070,7 +1070,7 @@ changes - `util.xr_interp_like` now accepts non-iterable scalar inputs for interpolation. [:pull:`97`] -- add `pint` compatibility to some `geometry` classes +- add ``pint`` compatibility to some `geometry` classes (**experimental**) - when passing quantities to constructors (and some functions), @@ -1128,7 +1128,7 @@ fixes - fix propagating the ``name`` attribute when reading an ndarray `TimeSeries` object back from ASDF files [:pull:`104`] -- fix `pint` regression in `TimeSeries` when mixing integer and float +- fix ``pint`` regression in `TimeSeries` when mixing integer and float values [:pull:`121`] ******************** diff --git a/doc/conf.py b/doc/conf.py index 7490d9f61..999c29783 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -60,8 +60,7 @@ def _prevent_sphinx_circular_imports_bug(): except ModuleNotFoundError: # fallback for local use sys.path.insert(0, os.path.abspath("../")) import weldx -except Exception as ex: - raise + import weldx.visualization # load visualization (currently no auto-import in pkg). @@ -84,12 +83,6 @@ def _copy_tut_files(): _copy_tut_files() -# TODO: git move tutorial files to tutorials_dir! -tutorial_files = pathlib.Path("./../tutorials/").glob("*.ipynb") -for f in tutorial_files: - shutil.copy(f, tutorials_dir) - - # -- Project information ----------------------------------------------------- _now = datetime.datetime.now().year diff --git a/weldx/constants.py b/weldx/constants.py index 67bb4054c..be84fc487 100644 --- a/weldx/constants.py +++ b/weldx/constants.py @@ -32,8 +32,6 @@ WELDX_QUANTITY = WELDX_UNIT_REGISTRY.Quantity Q_ = WELDX_QUANTITY -Q_.__name__ = "Q_" -Q_.__module__ = "pint.quantity" # skipcq: PYL-W0212 Q_.__doc__ = """Create a quantity from a scalar or array. The quantity class supports lots of physical units and will combine them during @@ -63,8 +61,6 @@ __test__ = {"Q": Q_.__doc__} # enable doctest checking. U_ = WELDX_UNIT_REGISTRY.Unit -U_.__name__ = "U_" -U_.__module__ = "pint.unit" # skipcq: PYL-W0212 U_.__doc__ = """For details on working with quantities and units, please see the `pint documentation `_ """ diff --git a/weldx/tags/units/pint_quantity.py b/weldx/tags/units/pint_quantity.py index b31b291e4..9e0fe25a5 100644 --- a/weldx/tags/units/pint_quantity.py +++ b/weldx/tags/units/pint_quantity.py @@ -17,7 +17,7 @@ class PintQuantityConverter(WeldxConverter): "tag:stsci.edu:asdf/unit/quantity-1.*", ] types = [ - "pint.quantity.Quantity", # pint >= 0.20 + "pint.util.Quantity", # pint >= 0.20 "pint.quantity.build_quantity_class..Quantity", # pint < 0.20 "weldx.constants.Q_", ] @@ -55,7 +55,7 @@ class PintUnitConverter(WeldxConverter): tags = ["asdf://weldx.bam.de/weldx/tags/units/units-0.1.*"] types = [ - "pint.unit.Unit", # pint >= 0.20 + "pint.util.Unit", # pint >= 0.20 "pint.unit.build_unit_class..Unit", # pint < 0.20 "weldx.constants.U_", ] diff --git a/weldx/tests/asdf_tests/test_asdf_groove.py b/weldx/tests/asdf_tests/test_asdf_groove.py index c1830db4e..69705f2ba 100644 --- a/weldx/tests/asdf_tests/test_asdf_groove.py +++ b/weldx/tests/asdf_tests/test_asdf_groove.py @@ -1,11 +1,9 @@ """Test all ASDF groove implementations.""" import pytest from decorator import contextmanager -from matplotlib import pylab from weldx.asdf.util import write_read_buffer -from weldx.constants import Q_ -from weldx.constants import WELDX_UNIT_REGISTRY as UREG +from weldx.constants import _DEFAULT_LEN_UNIT, Q_ from weldx.geometry import Profile from weldx.welding.groove.iso_9692_1 import ( IsoBaseGroove, @@ -13,7 +11,19 @@ get_groove, ) -_DEFAULT_LEN_UNIT = UREG.millimeters + +@contextmanager +def _close_plot(): + try: + from matplotlib import pylab + except ImportError: + yield + else: + try: + yield + finally: + pylab.close() + test_params = _create_test_grooves() @@ -50,10 +60,8 @@ def test_asdf_groove(groove: IsoBaseGroove, expected_dtype): ), f"Error calling plot function of {type(groove)} " # call plot function - try: + with _close_plot(): groove.plot() - finally: - pylab.close() def test_asdf_groove_exceptions():