diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index aed853505..156c4e416 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -54,7 +54,7 @@ jobs: init-shell: >- bash powershell - cache-environment: true + cache-environment: false - name: activate build env run: micromamba activate rtd 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 fc81211b7..eae44edb2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,9 +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` \[{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/doc/rtd_environment.yml b/doc/rtd_environment.yml index 9c6638dc8..a7f689520 100644 --- a/doc/rtd_environment.yml +++ b/doc/rtd_environment.yml @@ -32,5 +32,5 @@ dependencies: # pip packages - pip - pip: - - ../ - - ./json_mime_render_plugin/ + - weldx @ file:/../..// + - json_mime_render_plugin @ file:/..//json_mime_render_plugin diff --git a/pyproject.toml b/pyproject.toml index c78d5081b..4fd4335f2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,13 +51,23 @@ 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", "sympy>=1.6", "xarray>=2022.9", ] +optional-dependencies.docs = [ + "docutils>=0.19", + "numpydoc>=0.5", + "pydata-sphinx-theme<0.15", # parallel-write-unsafe + "sphinx>=4.1.1,==7.2", + "sphinx-autodoc-typehints>=1.21.8,==2", + "sphinx-copybutton==0.5", + "typing-extensions", + "urllib3<2", +] optional-dependencies.media = [ "av", "dask-image", diff --git a/weldx/config.py b/weldx/config.py index 9033225a5..b2a465fb0 100644 --- a/weldx/config.py +++ b/weldx/config.py @@ -2,10 +2,11 @@ from __future__ import annotations +import importlib.metadata +import sys from pathlib import Path import asdf -import pkg_resources import yaml from asdf.config import ResourceMappingProxy from asdf.versioning import AsdfVersion, split_tag_version @@ -175,7 +176,13 @@ def enable_quality_standard(name: str, version: AsdfVersion | str = None): @staticmethod def load_installed_standards(): """Load all standards that are installed to the active virtual environment.""" - for entry_point in pkg_resources.iter_entry_points("weldx.standard"): + if sys.version_info < (3, 10): + entry_points = importlib.metadata.entry_points().get("weldx.standard", []) + else: + entry_points = importlib.metadata.entry_points().select( + group="weldx.standard" + ) + for entry_point in entry_points: standards = entry_point.load()() if not isinstance(standards, list): standards = [standards] 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 d63e25111..e4bc8b80c 100644 --- a/weldx/tests/_helpers.py +++ b/weldx/tests/_helpers.py @@ -4,7 +4,6 @@ import numpy as np import pint -from pkg_resources import get_distribution from weldx.constants import Q_ from weldx.geometry import _vector_is_close as vector_is_close @@ -130,7 +129,7 @@ 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 get_distribution("pint").version >= "0.21": + if isinstance(mat_b, pint.Quantity): 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 86f99a239..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 -from pkg_resources import get_distribution 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 get_distribution("pint").version >= "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