diff --git a/.ruff.toml b/.ruff.toml index f6d0285ea..1979526df 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -77,5 +77,5 @@ required-imports = [ "from __future__ import annotations", ] -[flake8-import-conventions] +[lint.flake8-import-conventions] extend-aliases = { xarray = "xr" } diff --git a/CHANGELOG.md b/CHANGELOG.md index e6def3bce..eae44edb2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,11 +6,12 @@ - rename (fix typo) argument to `lcs_child_in_parent` in `CoordinateSystemManager.add_cs` \[{pull}`936`\]. -- replace usages of ``pkg_resources`` with ``importlib.metadata`` [#941] +- replace usages of `pkg_resources` with `importlib.metadata` \[{pull}`941`\]. ### Dependencies - pin `weldx-widgets>=0.2.3` for viz \[{pull}`939`\]. +- pin `pint>=0.21` \[{pull}`941`\]. ## 0.6.8 (07.06.2024) diff --git a/pyproject.toml b/pyproject.toml index c78d5081b..4a33a85dd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,7 +51,7 @@ dependencies = [ "networkx>=2.8.2", "numpy>=1.20,<2", "pandas>=1.5", - "pint>=0.18", + "pint>=0.21", "pint-xarray>=0.3", "psutil", "scipy>=1.6.2", diff --git a/weldx/config.py b/weldx/config.py index ec3fd18b6..5afe2958d 100644 --- a/weldx/config.py +++ b/weldx/config.py @@ -2,10 +2,10 @@ from __future__ import annotations +import importlib.metadata from pathlib import Path import asdf -import importlib.metadata import yaml from asdf.config import ResourceMappingProxy from asdf.versioning import AsdfVersion, split_tag_version diff --git a/weldx/constants.py b/weldx/constants.py index 1fe816d2c..fedb49a1f 100644 --- a/weldx/constants.py +++ b/weldx/constants.py @@ -16,7 +16,6 @@ WELDX_UNIT_REGISTRY = pint.UnitRegistry( preprocessors=[ - lambda string: string.replace("%", "percent"), # allow %-sign lambda string: string.replace("Δ°", "delta_deg"), # parse Δ° for temperature ], force_ndarray_like=True, diff --git a/weldx/tests/_helpers.py b/weldx/tests/_helpers.py index 1a06c4161..661388d55 100644 --- a/weldx/tests/_helpers.py +++ b/weldx/tests/_helpers.py @@ -1,10 +1,10 @@ """Provides some utility functions for tests.""" +import importlib.metadata from typing import Any import numpy as np import pint -import importlib.metadata from weldx.constants import Q_ from weldx.geometry import _vector_is_close as vector_is_close @@ -130,7 +130,9 @@ def matrix_is_close(mat_a, mat_b, abs_tol=1e-9) -> bool: return False atol_unit = 1.0 - if isinstance(mat_b, pint.Quantity) and tuple(int(part) for part in importlib.metadata.version("pint").split(".")) >= (0, 21): + if isinstance(mat_b, pint.Quantity) and tuple( + int(part) for part in importlib.metadata.version("pint").split(".") + ) >= (0, 21): atol_unit = mat_b.u return np.all(np.isclose(mat_a, mat_b, atol=abs_tol * atol_unit)).__bool__() diff --git a/weldx/tests/transformations/_util.py b/weldx/tests/transformations/_util.py index 41afaab8c..904a456f7 100644 --- a/weldx/tests/transformations/_util.py +++ b/weldx/tests/transformations/_util.py @@ -3,7 +3,6 @@ from typing import Any import numpy as np -import importlib.metadata from xarray import DataArray import weldx.transformations as tf @@ -78,9 +77,7 @@ def check_coordinate_system( lcs.orientation, orientation_expected, positive_orientation_expected ) - atol_unit = 1.0 - if tuple(int(part) for part in importlib.metadata.version("pint").split(".")) >= (0, 21): - atol_unit = coordinates_expected.u + atol_unit = coordinates_expected.u assert np.allclose( lcs.coordinates.data, coordinates_expected, atol=1e-9 * atol_unit