From 8b0fb01697bdd64190c42fb72f5065bb9fa9ea3d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 31 Mar 2024 16:35:34 +0200 Subject: [PATCH 1/5] Bump codecov/codecov-action from 4.1.0 to 4.1.1 (#920) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4.1.0 to 4.1.1. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v4.1.0...v4.1.1) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/pytest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index e4345a5a0..56f0be0d3 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -120,7 +120,7 @@ jobs: - name: codecov.io if: matrix.py == '3.10' - uses: codecov/codecov-action@v4.1.0 + uses: codecov/codecov-action@v4.1.1 compat: name: pytest From 50f38b7b17393b1f3155d37ff98928256111c80d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 2 Apr 2024 20:00:59 +0200 Subject: [PATCH 2/5] [pre-commit.ci] pre-commit autoupdate (#921) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/asottile/pyupgrade: v3.15.0 → v3.15.2](https://github.com/asottile/pyupgrade/compare/v3.15.0...v3.15.2) - [github.com/psf/black: 24.1.1 → 24.3.0](https://github.com/psf/black/compare/24.1.1...24.3.0) - [github.com/astral-sh/ruff-pre-commit: v0.2.0 → v0.3.5](https://github.com/astral-sh/ruff-pre-commit/compare/v0.2.0...v0.3.5) - [github.com/nbQA-dev/nbQA: 1.7.1 → 1.8.5](https://github.com/nbQA-dev/nbQA/compare/1.7.1...1.8.5) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e283621ea..573520d19 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,16 +29,16 @@ repos: - mdformat-config # ----- Python formatting ----- - repo: https://github.com/asottile/pyupgrade - rev: v3.15.0 + rev: v3.15.2 hooks: - id: pyupgrade args: [--py39-plus] - repo: https://github.com/psf/black - rev: 24.1.1 + rev: 24.3.0 hooks: - id: black - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.2.0 + rev: v0.3.5 hooks: - id: ruff args: @@ -50,7 +50,7 @@ repos: - id: validate-pyproject # ----- Jupyter Notebooks ----- - repo: https://github.com/nbQA-dev/nbQA - rev: 1.7.1 + rev: 1.8.5 hooks: - id: nbqa-black - id: nbqa-ruff # ruff handles isort From d40dddce0843fb648defed05c0452e8aa7739cd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87a=C4=9Ftay=20Fabry?= Date: Wed, 3 Apr 2024 12:40:16 +0200 Subject: [PATCH 3/5] Update .pre-commit-config.yaml (#922) * Update .pre-commit-config.yaml * Update pyproject.toml * Update pyproject.toml * fmt * remove setup.cfg * up ruff python target * add pyproject fmt --- .pre-commit-config.yaml | 26 +- doc/json_mime_render_plugin/pyproject.toml | 3 +- pyproject.toml | 271 ++++++++++----------- setup.cfg | 2 - weldx/asdf/file.py | 3 +- weldx/asdf/util.py | 4 +- weldx/core/generic_series.py | 7 +- weldx/util/xarray.py | 2 +- weldx/welding/groove/iso_9692_1.py | 3 +- 9 files changed, 156 insertions(+), 165 deletions(-) delete mode 100644 setup.cfg diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 573520d19..2c6f0d9a4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,22 +28,20 @@ repos: - mdformat-black - mdformat-config # ----- Python formatting ----- - - repo: https://github.com/asottile/pyupgrade - rev: v3.15.2 - hooks: - - id: pyupgrade - args: [--py39-plus] - - repo: https://github.com/psf/black - rev: 24.3.0 - hooks: - - id: black - - repo: https://github.com/astral-sh/ruff-pre-commit + - repo: https://github.com/charliermarsh/ruff-pre-commit rev: v0.3.5 hooks: - - id: ruff - args: - - --quiet - - --fix + # Run ruff linter. + - id: ruff + args: + - --quiet + - --fix + # Run ruff formatter. + - id: ruff-format + - repo: https://github.com/tox-dev/pyproject-fmt + rev: 1.7.0 + hooks: + - id: pyproject-fmt - repo: https://github.com/abravalheri/validate-pyproject rev: v0.16 hooks: diff --git a/doc/json_mime_render_plugin/pyproject.toml b/doc/json_mime_render_plugin/pyproject.toml index 8f25cf4cc..5875593b7 100644 --- a/doc/json_mime_render_plugin/pyproject.toml +++ b/doc/json_mime_render_plugin/pyproject.toml @@ -1,6 +1,5 @@ [project] -name = "myst_nb_json_renderer" +name = "myst-nb-json-renderer" version = "1" - [project.entry-points."myst_nb.mime_renderers"] json_mime = "myst_nb_json_render_plugin:MimeRenderPlugin" diff --git a/pyproject.toml b/pyproject.toml index d06cc4ff9..3c7557100 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,105 +1,93 @@ [project] name = "weldx" -dynamic = [ # see: https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html#dynamic-metadata - "version", # version gets derived from git by setuptools_scm. +description = "Python API for the WelDX file format and standard" +readme = "README.md" +keywords = [ + "bam", # TODO: add more keywords here! think of them as in a journal article. + "welding", + "weldx", ] +license = {file = "LICENSE", name="BSD License"} authors = [ - {name="Cagtay Fabry", email="cagtay.fabry@bam.de"}, + {name="Çağtay Fabry", email="cagtay.fabry@bam.de"}, {name="Volker Hirthammer", email="volker.hirthammer@bam.de"}, {name="Martin K. Scherer", email="martin.scherer@bam.de"}, ] -description = "Python API for the WelDX file format and standard" -readme = "README.md" -license = {file = "LICENSE", name="BSD License"} -keywords = [ - "welding", - "weldx", - "bam", # TODO: add more keywords here! think of them as in a journal article. -] -classifiers = [ - "Development Status :: 4 - Beta", - "Intended Audience :: Science/Research", - "License :: OSI Approved :: BSD License", - "Operating System :: OS Independent", - "Natural Language :: English", - "Programming Language :: Python", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Topic :: Scientific/Engineering :: Physics", # TODO: add more topics here! - "Intended Audience :: Science/Research", - "Intended Audience :: Education", -] - -# Dependencies requires-python = ">=3.9" +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Education", + "Intended Audience :: Science/Research", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: BSD License", + "Natural Language :: English", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Scientific/Engineering :: Physics", # TODO: add more topics here! +] +dynamic = [ + # see: https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html#dynamic-metadata + "version", # version gets derived from git by setuptools_scm. +] dependencies = [ - "numpy >=1.20", - "asdf >=2.15.1", - "pandas >=1.5", - "xarray >=2022.9.0", - "scipy >=1.6.2", - "sympy >=1.6", - "pint >=0.18", - "pint-xarray >=0.3", - "bottleneck >=1.3.3", - "boltons", - "bidict", - "networkx >=2.8.2", - "fs", - "meshio", - "psutil", - "IPython", + "asdf>=2.15.1", + "bidict", + "boltons", + "bottleneck>=1.3.3", + "fs", + "IPython", + "meshio", + "networkx>=2.8.2", + "numpy>=1.20", + "pandas>=1.5", + "pint>=0.18", + "pint-xarray>=0.3", + "psutil", + "scipy>=1.6.2", + "sympy>=1.6", + "xarray>=2022.9", ] - -[project.urls] -documentation = "https://weldx.readthedocs.io" -repository = "https://github.com/BAMweldx/weldx" -bug_tracker = "https://github.com/BAMweldx/weldx/issues" -changelog = "https://github.com/BAMweldx/weldx/blob/master/CHANGELOG.md" - [project.optional-dependencies] +media = [ + "av", + "dask-image", + "pims", + "tifffile", # required by dask-image, but not listed in their requirements +] test = [ - "pytest >=6", - "pytest-cov", - "pytest-xdist", - "nbval", + "nbval", + "pytest>=6", + "pytest-cov", + "pytest-xdist", ] vis = [ - "weldx_widgets >=0.2", -] -media = [ - "pims", - "av", - "dask-image", - # this is actually required by dask-image, but not listed in their requirements: - "tifffile", + "weldx_widgets>=0.2", ] - -# ASDF extension entry points. - +[project.urls] +bug_tracker = "https://github.com/BAMweldx/weldx/issues" +changelog = "https://github.com/BAMweldx/weldx/blob/master/CHANGELOG.md" +documentation = "https://weldx.readthedocs.io" +repository = "https://github.com/BAMweldx/weldx" +[project.scripts] +welding_schema = "weldx.asdf.cli.welding_schema:main" [project.entry-points."asdf.extensions"] weldx = "weldx.asdf.extension:get_extensions" - [project.entry-points."asdf.resource_mappings"] weldx_schemas = "weldx.asdf.extension:get_resource_mappings" -# console scripts -[project.scripts] -welding_schema = "weldx.asdf.cli.welding_schema:main" - -# Build system config, pip creates a temporary env with "requires" pkgs. [build-system] +build-backend = "setuptools.build_meta" requires = [ - "wheel", - "setuptools >= 40.9.0", + "setuptools>=64", "setuptools_scm[toml]>=6.2", + "wheel", ] -build-backend = "setuptools.build_meta" - -# Tool configs [tool.setuptools.packages.find] where = ["."] @@ -107,6 +95,73 @@ where = ["."] write_to = "weldx/_version.py" write_to_template = '__version__ = "{version}"' +[tool.ruff] +target-version = "py39" # designated Python version +line-length = 88 +exclude = [ + "__init__.py", + "doc/src/conf.py", +] + +[tool.ruff.lint] +# TODO: should be the following list, but Ruff does not yet impl all of them. +# W503,W504 +# E203 +# C408 +ignore = [ + "C408", + #"E203", + "E402", + #"W503", + #"W504", + "D203", "D211", "D213", + "UP006", "UP007", # see ruff GH#4427 +] +select = [ + "B", # flake8-bugbear + "C", # flake8-comprehensions + #"D", # note: all relevant D's will be set by setting pydocstyle.convention=numpy! + "E", # pycodestyles + "F", # pyflakes + "W", # pycodestyle warnings + "UP", # pyupgrade + "T2", # flake8-print + "I001", # isort + "ICN", # import conventions, e.g. import numpy as np + #"B950", # not yet implemented by Ruff. + "RUF100", # ensure 'noqa' declarations are still valid. +] + +# Allow pydocstyle violations in certain areas. +per-file-ignores."**/{tests,tags,asdf,devtools}/**" = ["D"] +per-file-ignores."conftest.py" = ["D"] +per-file-ignores."doc/src/tutorials/*" = ["D"] +per-file-ignores."doc/src/conf.py" = ["E501", # ignore long lines. + "RUF100", # do no check if 'noqa' is needed (circular import workaround) +] +# Allow prints in certain areas. +per-file-ignores."**/{cli,tests,tutorials,devtools}/**/*{.py,ipynb}" = ["T2"] + +external = ["B950"] + +[tool.ruff.lint.pydocstyle] +convention = "numpy" + +[tool.ruff.lint.mccabe] +max-complexity = 15 # max branches inside a function. + +[tool.ruff.lint.isort] +known-first-party = ["weldx"] +required-imports = ["from __future__ import annotations"] + +[tool.ruff.lint.flake8-import-conventions] +extend-aliases = {xarray = "xr"} + +[tool.nbqa.addopts] +ruff = [ + "--extend-ignore=B018" +] + [tool.pytest.ini_options] addopts = "--tb=short --color=yes -rsw --cov=weldx --cov-report=term-missing:skip-covered --doctest-modules" #addopts = --tb=short --color=yes -rs -p no:cov @@ -171,65 +226,3 @@ ignore_errors = true module = "xarray" follow_imports = "skip" ignore_errors = true - -[tool.ruff] -target-version = "py38" # designated Python version -exclude = [ - "__init__.py", - "doc/src/conf.py", -] -# TODO: should be the following list, but Ruff does not yet impl all of them. -# W503,W504 -# E203 -# C408 -ignore = [ - "C408", - #"E203", - "E402", - #"W503", - #"W504", - "D203", "D211", "D213", - "UP006", "UP007", # see ruff GH#4427 -] -line-length = 88 -select = [ - "B", # flake8-bugbear - "C", # flake8-comprehensions - #"D", # note: all relevant D's will be set by setting pydocstyle.convention=numpy! - "E", # pycodestyles - "F", # pyflakes - "W", # pycodestyle warnings - "UP", # pyupgrade - "T2", # flake8-print - "I001", # isort - "ICN", # import conventions, e.g. import numpy as np - #"B950", # not yet implemented by Ruff. - "RUF100", # ensure 'noqa' declarations are still valid. -] - -# Allow pydocstyle violations in certain areas. -per-file-ignores."**/{tests,tags,asdf,devtools}/**" = ["D"] -per-file-ignores."conftest.py" = ["D"] -per-file-ignores."doc/src/tutorials/*" = ["D"] -per-file-ignores."doc/src/conf.py" = ["E501", # ignore long lines. - "RUF100", # do no check if 'noqa' is needed (circular import workaround) -] -# Allow prints in certain areas. -per-file-ignores."**/{cli,tests,tutorials,devtools}/**/*{.py,ipynb}" = ["T2"] - -external = ["B950"] -pydocstyle = {convention = "numpy"} - -mccabe = {max-complexity = 15} # max branches inside a function. - -[tool.ruff.isort] -known-first-party = ["weldx"] -required-imports = ["from __future__ import annotations"] - -[tool.ruff.flake8-import-conventions] -extend-aliases = {xarray = "xr"} - -[tool.nbqa.addopts] -ruff = [ - "--extend-ignore=B018" -] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 91a481a2e..000000000 --- a/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -# this is empty on purpose to enable editable (development) installs -# xref: https://stackoverflow.com/questions/69711606/how-to-install-a-package-using-pip-in-editable-mode-with-pyproject-toml diff --git a/weldx/asdf/file.py b/weldx/asdf/file.py index d5cf4fd03..c24dfadfb 100644 --- a/weldx/asdf/file.py +++ b/weldx/asdf/file.py @@ -212,7 +212,8 @@ def __init__( write_kwargs: Mapping = None, tree: Mapping = None, sync: bool = True, - custom_schema: None | ( + custom_schema: None + | ( types_path_like, tuple[None, types_path_like], ) = None, diff --git a/weldx/asdf/util.py b/weldx/asdf/util.py index a608b5de1..5f30d8d9b 100644 --- a/weldx/asdf/util.py +++ b/weldx/asdf/util.py @@ -675,9 +675,7 @@ def __iter__(self): def __contains__(self, item): return item in self.keys() - def update( - self, mapping: Mapping[Hashable, Any], **kwargs: Any - ): # pylint: disable=W0221 + def update(self, mapping: Mapping[Hashable, Any], **kwargs: Any): # pylint: disable=W0221 _mapping = dict(mapping, **kwargs) # merge mapping and kwargs if any(key in self.protected_keys for key in _mapping.keys()): self._warn_protected_keys() diff --git a/weldx/core/generic_series.py b/weldx/core/generic_series.py index 9c8eeb2a9..9c4c315e0 100644 --- a/weldx/core/generic_series.py +++ b/weldx/core/generic_series.py @@ -233,7 +233,10 @@ def __init__( if dims is not None and not isinstance(dims, dict): raise ValueError(f"Argument 'dims' must be dict, not {dims}") self._init_expression( - obj, dims, parameters, {k: U_(v) for k, v in units.items()} # catch str + obj, + dims, + parameters, + {k: U_(v) for k, v in units.items()}, # catch str ) else: raise TypeError(f'The data type "{type(obj)}" is not supported.') @@ -403,7 +406,7 @@ def _test_expr(expr, dims, units: dict[str, pint.Unit]) -> pint.Unit: @staticmethod def _format_expression_params( - parameters: dict[str, pint.Quantity | xr.DataArray] + parameters: dict[str, pint.Quantity | xr.DataArray], ) -> dict[str, pint.Quantity | xr.DataArray]: """Create expression parameters as a valid internal type. diff --git a/weldx/util/xarray.py b/weldx/util/xarray.py index 996a7bbe0..2bb6c22fa 100644 --- a/weldx/util/xarray.py +++ b/weldx/util/xarray.py @@ -239,7 +239,7 @@ def _get_coordinate_quantities(da) -> dict[str, pint.Quantity]: def _coordinates_from_quantities( - q_dict: dict[str, pint.Quantity] + q_dict: dict[str, pint.Quantity], ) -> dict[str, tuple[str, np.ndarray, dict[str, pint.Unit]]]: """Create a dict with unit information that can be passed as coords for xarray.""" return { diff --git a/weldx/welding/groove/iso_9692_1.py b/weldx/welding/groove/iso_9692_1.py index 1e734d774..94b3412e7 100644 --- a/weldx/welding/groove/iso_9692_1.py +++ b/weldx/welding/groove/iso_9692_1.py @@ -1115,7 +1115,8 @@ def to_profile(self, width_default: pint.Quantity = None) -> geo.Profile: segment_list.append("line") x_value = np.append( - x_value, (0, -x_upper, -(s_upper + x_upper), -width) # skipcq: PYL-E1130 + x_value, + (0, -x_upper, -(s_upper + x_upper), -width), # skipcq: PYL-E1130 ) y_value = np.append(y_value, (h2 + c + R, t - (h1 - (R - y_upper)), t, t)) segment_list += ["arc", "line", "line"] From acebe1b5c9f1349c20c0e62a2214426911661f7b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 7 Apr 2024 10:07:48 +0200 Subject: [PATCH 4/5] Bump codecov/codecov-action from 4.1.1 to 4.2.0 (#924) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4.1.1 to 4.2.0. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v4.1.1...v4.2.0) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/pytest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 56f0be0d3..c06d6d5a8 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -120,7 +120,7 @@ jobs: - name: codecov.io if: matrix.py == '3.10' - uses: codecov/codecov-action@v4.1.1 + uses: codecov/codecov-action@v4.2.0 compat: name: pytest From 0e0a9ea15b99f72419a418bf73de469ac96b0d25 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 14 Apr 2024 10:13:50 +0200 Subject: [PATCH 5/5] Bump codecov/codecov-action from 4.2.0 to 4.3.0 (#925) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4.2.0 to 4.3.0. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v4.2.0...v4.3.0) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/pytest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index c06d6d5a8..7213e4b94 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -120,7 +120,7 @@ jobs: - name: codecov.io if: matrix.py == '3.10' - uses: codecov/codecov-action@v4.2.0 + uses: codecov/codecov-action@v4.3.0 compat: name: pytest