Skip to content

Commit

Permalink
update pint version
Browse files Browse the repository at this point in the history
  • Loading branch information
CagtayFabry committed Aug 5, 2024
1 parent e27a7cd commit 3e0dc1a
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,5 @@ required-imports = [
"from __future__ import annotations",
]

[flake8-import-conventions]
[lint.flake8-import-conventions]
extend-aliases = { xarray = "xr" }
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion weldx/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion weldx/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 4 additions & 2 deletions weldx/tests/_helpers.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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__()
5 changes: 1 addition & 4 deletions weldx/tests/transformations/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from typing import Any

import numpy as np
import importlib.metadata
from xarray import DataArray

import weldx.transformations as tf
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3e0dc1a

Please sign in to comment.