Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- name: πŸ›ŽοΈ Checkout repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
os: [ubuntu-latest, windows-latest, macOS-latest]
arch: [x64]
defaults:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: 🐍 Set up Python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6
with:
python-version: "3.13"
python-version: "3.14"
- name: πŸ“¦ Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
- name: 🐍 Setup Python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6
with:
python-version: "3.13"
python-version: "3.14"
- name: πŸ› οΈ Install uv
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
with:
Expand Down
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: python:3.13
image: python:3.14

include:
- template: Security/Secret-Detection.gitlab-ci.yml
Expand Down
2 changes: 1 addition & 1 deletion .gitlab/ci/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build_check:
stage: deploy
tags:
- shared
image: python:3.13
image: python:3.14
before_script:
- python -m pip install --upgrade pip
- pip install build
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ repos:
rev: v3.20.0
hooks:
- id: pyupgrade
args: [--py39-plus, --keep-percent-format]
args: [--py310-plus, --keep-percent-format]
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "SpectraFit"
version = "1.4.0"
description = "Fast fitting of 2D- and 3D-Spectra with established routines"
authors = [{ name = "Anselm Hahn", email = "anselm.hahn@gmail.com" }]
requires-python = ">=3.9,<3.14"
requires-python = ">=3.10,<3.15"
readme = "README.md"
license = "BSD-3-Clause"
maintainers = [{ name = "Anselm Hahn", email = "anselm.hahn@gmail.com" }]
Expand All @@ -23,11 +23,11 @@ classifiers = [
"Framework :: Matplotlib",
"Framework :: Jupyter :: JupyterLab",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Scientific/Engineering :: Physics",
"Topic :: Scientific/Engineering :: Chemistry",
Expand Down Expand Up @@ -161,7 +161,7 @@ build-backend = "hatchling.build"
fix = true
include = ["*.py"]
src = ["spectrafit"]
target-version = "py39"
target-version = "py310"

[tool.ruff.lint]
select = ["ALL"]
Expand Down
2 changes: 1 addition & 1 deletion spectrafit/api/file_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from __future__ import annotations

from collections.abc import Callable
from pathlib import Path
from typing import Callable

from pydantic import BaseModel
from pydantic import Field
Expand Down
13 changes: 6 additions & 7 deletions spectrafit/api/model_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

from __future__ import annotations

from typing import Optional
from typing import cast

from spectrafit.api.moessbauer_model import AmplitudeAPI
Expand Down Expand Up @@ -37,7 +36,7 @@

if "expr" in data:
expr_value = data.get("expr")
expr = cast("Optional[str]", expr_value)
expr = cast("str | None", expr_value)

Check failure on line 39 in spectrafit/api/model_utils.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Define a constant instead of duplicating this literal "str | None" 6 times.

See more on https://sonarcloud.io/project/issues?id=Anselmoo_spectrafit&issues=AZq_N85-TIL0c17YXAdg&open=AZq_N85-TIL0c17YXAdg&pullRequest=2032

return AmplitudeAPI(
max=data.get("max"),
Expand Down Expand Up @@ -68,7 +67,7 @@

if "expr" in data:
expr_value = data.get("expr")
expr = cast("Optional[str]", expr_value)
expr = cast("str | None", expr_value)

return IsomerShiftAPI(
max=data.get("max"),
Expand Down Expand Up @@ -99,7 +98,7 @@

if "expr" in data:
expr_value = data.get("expr")
expr = cast("Optional[str]", expr_value)
expr = cast("str | None", expr_value)

return FwhmlAPI(
max=data.get("max"),
Expand Down Expand Up @@ -130,7 +129,7 @@

if "expr" in data:
expr_value = data.get("expr")
expr = cast("Optional[str]", expr_value)
expr = cast("str | None", expr_value)

return BackgroundAPI(
max=data.get("max"),
Expand Down Expand Up @@ -161,7 +160,7 @@

if "expr" in data:
expr_value = data.get("expr")
expr = cast("Optional[str]", expr_value)
expr = cast("str | None", expr_value)

return QuadrupoleSplittingAPI(
max=data.get("max"),
Expand Down Expand Up @@ -192,7 +191,7 @@

if "expr" in data:
expr_value = data.get("expr")
expr = cast("Optional[str]", expr_value)
expr = cast("str | None", expr_value)

return HyperfineFieldAPI(
max=data.get("max"),
Expand Down
2 changes: 1 addition & 1 deletion spectrafit/api/models_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing import Callable
from collections.abc import Callable

from pydantic import BaseModel
from pydantic import Field
Expand Down
2 changes: 1 addition & 1 deletion spectrafit/api/notebook_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class ColorAPI(BaseModel):
description="Color of the components, mainly peaks.",
)
bars: list[str] = Field(
default=[i for j in zip(Teal_r, Purp_r) for i in j],
default=[i for j in zip(Teal_r, Purp_r, strict=False) for i in j],
description="Color of the bar plot of the metrics.",
)
lines: list[str] = Field(
Expand Down
2 changes: 1 addition & 1 deletion spectrafit/api/test/test_utils_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from __future__ import annotations

from collections.abc import Callable
from typing import Any
from typing import Callable

import numpy as np
import pytest
Expand Down
5 changes: 5 additions & 0 deletions spectrafit/models/builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1404,6 +1404,7 @@ def define_parameters_auto(self) -> None: # noqa: C901
self.x[positions],
properties["peak_heights"],
properties["widths"],
strict=False,
),
start=1,
):
Expand Down Expand Up @@ -1434,6 +1435,7 @@ def define_parameters_auto(self) -> None: # noqa: C901
self.x[positions],
properties["peak_heights"],
properties["widths"],
strict=False,
),
start=1,
):
Expand Down Expand Up @@ -1464,6 +1466,7 @@ def define_parameters_auto(self) -> None: # noqa: C901
self.x[positions],
properties["peak_heights"],
properties["widths"],
strict=False,
),
start=1,
):
Expand Down Expand Up @@ -1494,6 +1497,7 @@ def define_parameters_auto(self) -> None: # noqa: C901
self.x[positions],
properties["peak_heights"],
properties["widths"],
strict=False,
),
start=1,
):
Expand Down Expand Up @@ -1524,6 +1528,7 @@ def define_parameters_auto(self) -> None: # noqa: C901
self.x[positions],
properties["peak_heights"],
properties["widths"],
strict=False,
),
start=1,
):
Expand Down
2 changes: 1 addition & 1 deletion spectrafit/models/moessbauer.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def moessbauer_sextet(

# Calculate each line and sum them
spectrum = np.zeros_like(x, dtype=np.float64)
for pos, amp in zip(positions, relative_amplitudes):
for pos, amp in zip(positions, relative_amplitudes, strict=False):
line_center = center + isomer_shift + pos
# For test compatibility - use positive amplitude (absorption peaks)
# instead of negative (transmission dips)
Expand Down
1 change: 1 addition & 0 deletions spectrafit/plugins/notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,7 @@ def get_current_metric(self) -> pd.DataFrame:
for key, val in zip(
self.get_regression_metrics["index"],
self.get_regression_metrics["data"],
strict=False,
)
}
metric = {**gof, **reg}
Expand Down
2 changes: 1 addition & 1 deletion spectrafit/plugins/test/test_notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def mulit_index() -> pd.DataFrame:
["bar", "bar", "baz", "baz", "foo", "foo", "qux", "qux"],
["one", "two", "one", "two", "one", "two", "one", "two"],
]
tuples = list(zip(*arrays))
tuples = list(zip(*arrays, strict=False))
index = pd.MultiIndex.from_tuples(tuples, names=["first", "second"])
df = pd.DataFrame(
{"A": [1, 2, 3, 4, 5, 6, 7, 8], "B": [10, 20, 30, 40, 50, 60, 70, 80]},
Expand Down
4 changes: 2 additions & 2 deletions spectrafit/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

from typing import TYPE_CHECKING
from typing import Any
from typing import Callable
from warnings import warn

import numpy as np
Expand Down Expand Up @@ -39,6 +38,7 @@
VERBOSE_DETAILED = 2 # Detailed/verbose output mode

if TYPE_CHECKING:
from collections.abc import Callable
from collections.abc import Hashable

from numpy.typing import NDArray
Expand Down Expand Up @@ -170,7 +170,7 @@ def __call__(self) -> dict[Hashable, Any]:
metric_dict: dict[Hashable, Any] = {}
for fnc in metrics_fnc:
metric_dict[fnc.__name__] = []
for y_true, y_pred in zip(self.y_true.T, self.y_pred.T):
for y_true, y_pred in zip(self.y_true.T, self.y_pred.T, strict=False):
try:
metric_dict[fnc.__name__].append(fnc(y_true, y_pred))
except ValueError as err:
Expand Down
5 changes: 2 additions & 3 deletions tools/analyze_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

from __future__ import annotations


import json
import logging
import subprocess
Expand Down Expand Up @@ -78,8 +77,8 @@ def run_coverage_test() -> None:
logger.info("%s", result.stdout)
except subprocess.CalledProcessError as e:
logger.exception("Error running pytest")
logger.error("stdout: %s", e.stdout)
logger.error("stderr: %s", e.stderr)
logger.exception("stdout: %s", e.stdout)
logger.exception("stderr: %s", e.stderr)
sys.exit(1)


Expand Down
Loading
Loading