Skip to content

Commit fae5c11

Browse files
⬆️ UPGRADE: Autoupdate pre-commit config (#373)
* ⬆️ UPGRADE: Autoupdate pre-commit config * 🧹 Fix issues due to tool updates * 🩹 Pin 'matplotlib-inline' version to be compatible with pinned matplotlib min version --------- Co-authored-by: s-weigand <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Sebastian Weigand <s.weigand.phy@gmail.com>
1 parent d2e4666 commit fae5c11

7 files changed

Lines changed: 30 additions & 28 deletions

File tree

.gitattributes

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
* text=lf
2-
*.bat text eol=crlf

.github/requirements_min.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
cycler==0.10.0
44
docstring-parser==0.16
55
matplotlib==3.3.0
6+
matplotlib-inline==0.1.0
67
numpy==1.22.0
78
packaging==23.1
89
pydantic==2.7.0

.pre-commit-config.yaml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,26 @@ ci:
44
repos:
55
# Formatters
66
- repo: https://github.com/pre-commit/pre-commit-hooks
7-
rev: v5.0.0
7+
rev: v6.0.0
88
hooks:
99
- id: check-ast
1010
- id: check-builtin-literals
1111
- id: check-merge-conflict
1212
- id: end-of-file-fixer
1313
- id: trailing-whitespace
1414
- id: debug-statements
15-
- id: fix-encoding-pragma
16-
args: [--remove]
15+
- id: mixed-line-ending
16+
args: [--fix=lf]
1717

1818
- repo: https://github.com/PyCQA/docformatter
19-
rev: 06907d0
19+
rev: v1.7.7
2020
hooks:
2121
- id: docformatter
2222
additional_dependencies: [tomli]
2323
args: [--in-place, --config, ./pyproject.toml]
2424

2525
- repo: https://github.com/tox-dev/pyproject-fmt
26-
rev: "v2.5.1"
26+
rev: "v2.11.1"
2727
hooks:
2828
- id: pyproject-fmt
2929

@@ -32,22 +32,21 @@ repos:
3232
hooks:
3333
- id: absolufy-imports
3434

35-
- repo: https://github.com/pre-commit/mirrors-prettier
36-
rev: v4.0.0-alpha.8 # Use the sha or tag you want to point at
35+
- repo: https://github.com/pycontribs/mirrors-prettier
36+
rev: "v3.6.2"
3737
hooks:
3838
- id: prettier
39-
additional_dependencies: ["prettier@3.3.3"]
4039

4140
# Notebook tools
4241
- repo: https://github.com/kynan/nbstripout
43-
rev: 0.8.1
42+
rev: 0.8.2
4443
hooks:
4544
- id: nbstripout
4645
args: [--drop-empty-cells]
4746

4847
- repo: https://github.com/astral-sh/ruff-pre-commit
4948
# Ruff version.
50-
rev: v0.9.10
49+
rev: v0.14.10
5150
hooks:
5251
- id: ruff
5352
name: "ruff sort imports notebooks"
@@ -73,7 +72,7 @@ repos:
7372
# Linters
7473

7574
- repo: https://github.com/pre-commit/mirrors-mypy
76-
rev: v1.15.0
75+
rev: v1.19.1
7776
hooks:
7877
- id: mypy
7978
exclude: ^docs
@@ -89,7 +88,7 @@ repos:
8988

9089
- repo: https://github.com/astral-sh/ruff-pre-commit
9190
# Ruff version.
92-
rev: v0.9.10
91+
rev: v0.14.10
9392
hooks:
9493
- id: ruff
9594
name: "ruff sort imports"
@@ -104,7 +103,7 @@ repos:
104103
name: "ruff lint"
105104

106105
- repo: https://github.com/PyCQA/flake8
107-
rev: 7.1.2
106+
rev: 7.3.0
108107
hooks:
109108
- id: flake8
110109
alias: flake8-docs
@@ -128,7 +127,7 @@ repos:
128127
args: ["--ignore-words-list=doas"]
129128

130129
- repo: https://github.com/rhysd/actionlint
131-
rev: "v1.7.7"
130+
rev: "v1.7.10"
132131
hooks:
133132
- id: actionlint
134133

pyglotaran_extras/config/plot_config.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def serialize(self) -> dict[str, Any]:
205205
serialized["default_args_override"] = self.default_args_override
206206
if len(self.axis_label_override) > 0:
207207
serialized["axis_label_override"] = cast(
208-
PlotLabelOverrideMap, self.axis_label_override
208+
"PlotLabelOverrideMap", self.axis_label_override
209209
).model_dump()
210210
return serialized
211211

@@ -270,7 +270,7 @@ def update_axes_labels(self, axes: Axes | Iterable[Axes]) -> None:
270270
if isinstance(ax, Axes):
271271
orig_x_label = ax.get_xlabel()
272272
orig_y_label = ax.get_ylabel()
273-
axis_label_override = cast(PlotLabelOverrideMap, self.axis_label_override)
273+
axis_label_override = cast("PlotLabelOverrideMap", self.axis_label_override)
274274

275275
if (
276276
override_label := axis_label_override.find_axis_label(orig_x_label, "x")
@@ -362,19 +362,21 @@ def merge(self, other: PlotConfig) -> PlotConfig: # noqa: C901
362362
updated: dict[str, PerFunctionPlotConfig] = {}
363363
# Update general field
364364
for key in self.model_fields_set:
365-
updated[key] = cast(PerFunctionPlotConfig, getattr(self, key))
365+
updated[key] = cast("PerFunctionPlotConfig", getattr(self, key))
366366
if key in other.model_fields_set:
367-
updated[key] = updated[key].merge(cast(PerFunctionPlotConfig, getattr(other, key)))
367+
updated[key] = updated[key].merge(
368+
cast("PerFunctionPlotConfig", getattr(other, key))
369+
)
368370
for key in other.model_fields_set:
369371
if key not in updated:
370372
updated[key] = getattr(other, key)
371373
# Update model_extra
372374
if self.model_extra is not None:
373375
for key, value in self.model_extra.items():
374-
updated[key] = cast(PerFunctionPlotConfig, value)
376+
updated[key] = cast("PerFunctionPlotConfig", value)
375377
if other.model_extra is not None and key in other.model_extra:
376378
updated[key] = updated[key].merge(
377-
cast(PerFunctionPlotConfig, other.model_extra[key])
379+
cast("PerFunctionPlotConfig", other.model_extra[key])
378380
)
379381
if other.model_extra is not None:
380382
for key, value in other.model_extra.items():
@@ -525,8 +527,8 @@ def wrapper(*args: Param.args, **kwargs: Param.kwargs) -> RetType: # noqa: DOC
525527
function_config = CONFIG.plotting.get_function_config(func.__name__)
526528
override_kwargs = function_config.find_override_kwargs(not_user_provided_kwargs)
527529
updated_kwargs = kwargs | override_kwargs
528-
arg_axes = find_axes(getcallargs(func, *args, **updated_kwargs).values())
529-
return_values = func(*args, **updated_kwargs)
530+
arg_axes = find_axes(getcallargs(func, *args, **updated_kwargs).values()) # type: ignore[arg-type]
531+
return_values = func(*args, **updated_kwargs) # type: ignore[arg-type]
530532
function_config.update_axes_labels(arg_axes)
531533

532534
if isinstance(return_values, Iterable):

pyglotaran_extras/plotting/plot_irf_dispersion_center.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from typing import cast
77

88
import matplotlib.pyplot as plt
9-
import xarray as xr
109

1110
from pyglotaran_extras.config.plot_config import use_plot_config
1211
from pyglotaran_extras.io.utils import result_dataset_mapping
@@ -17,6 +16,7 @@
1716
if TYPE_CHECKING:
1817
from typing import Literal
1918

19+
import xarray as xr
2020
from cycler import Cycler
2121
from matplotlib.axes import Axes
2222
from matplotlib.figure import Figure
@@ -104,7 +104,7 @@ def _plot_irf_dispersion_center(
104104
If it is None the time axis will not be shifted. Defaults to None.
105105
"""
106106
add_cycler_if_not_none(ax, cycler)
107-
irf = cast(xr.DataArray, extract_irf_dispersion_center(res, as_dataarray=True))
107+
irf = cast("xr.DataArray", extract_irf_dispersion_center(res, as_dataarray=True))
108108
if irf_location is not None:
109109
(irf - irf_location).plot(ax=ax, label=label, **{spectral_axis: "spectral"})
110110
else:

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ classifiers = [
2525
"Programming Language :: Python :: 3.11",
2626
"Programming Language :: Python :: 3.12",
2727
"Programming Language :: Python :: 3.13",
28+
"Programming Language :: Python :: 3.14",
2829
"Topic :: Scientific/Engineering",
2930
"Topic :: Scientific/Engineering :: Chemistry",
3031
"Topic :: Scientific/Engineering :: Physics",

tests/deprecation/test_deprecation_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ def test_warn_deprecated():
117117
to_be_removed_in_version="0.6.0",
118118
)
119119

120-
assert len(record) == 1
121-
assert record[0].message.args[0] == DEPRECATION_WARN_MESSAGE
122-
assert Path(record[0].filename) == Path(__file__)
120+
assert len(record) == 1
121+
assert record[0].message.args[0] == DEPRECATION_WARN_MESSAGE
122+
assert Path(record[0].filename) == Path(__file__)
123123

124124

125125
@pytest.mark.usefixtures("_pyglotaran_extras_1_0_0")

0 commit comments

Comments
 (0)