Skip to content
Merged
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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ pyvenv*/
# Settings
.idea/
**.code-workspace
/.agents
/.claude/
/.codex
/AGENTS.md
/CLAUDE.md

# Exceptions
!.cspell.json
Expand Down
13 changes: 6 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ repos:
- id: check-useless-excludes

- repo: https://github.com/ComPWA/policy
rev: 0.9.0
rev: 0.9.3
hooks:
- id: check-dev-files

Expand Down Expand Up @@ -60,7 +60,7 @@ repos:
- id: strip-nb-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.21
rev: v0.16.1
hooks:
- id: ruff-check
args: [--fix]
Expand Down Expand Up @@ -96,7 +96,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/tombi-toml/tombi-pre-commit
rev: v1.2.0
rev: v1.2.6
hooks:
- id: tombi-format
- id: tombi-lint
Expand Down Expand Up @@ -124,10 +124,9 @@ repos:
rev: v10.0.1
hooks:
- id: cspell
language_version: 25.9.0

- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: 3.6.1
rev: 3.8.0
hooks:
- id: editorconfig-checker
name: editorconfig
Expand All @@ -138,12 +137,12 @@ repos:
)$

- repo: https://github.com/astral-sh/ty-pre-commit
rev: v0.0.59
rev: v0.0.67
hooks:
- id: ty
args: [--group=types, --no-default-groups]

- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.11.29
rev: 0.12.1
hooks:
- id: uv-lock
16 changes: 8 additions & 8 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,33 +22,29 @@ def create_tensorflow_inventory() -> None:
if os.path.exists("tensorflow.inv"):
return
subprocess.check_call(
("sphobjinv", "convert", "-o", "zlib", "tensorflow.txt"), # noqa: S607
("sphobjinv", "convert", "-o", "zlib", "tensorflow.txt"), # ruff:ignore[start-process-with-partial-path]
)


def get_scipy_url() -> str:
url = f"https://docs.scipy.org/doc/scipy-{pin('scipy')}/"
r = requests.get(url)
if r.status_code != 200: # noqa: PLR2004
if r.status_code != 200: # ruff:ignore[magic-value-comparison]
return "https://docs.scipy.org/doc/scipy"
return url


def get_tensorflow_url() -> str:
url = f"https://www.tensorflow.org/versions/r{pin_minor('tensorflow')}/api_docs/python"
r = requests.get(url + "/tf")
if r.status_code != 200: # noqa: PLR2004
if r.status_code != 200: # ruff:ignore[magic-value-comparison]
url = "https://www.tensorflow.org/api_docs/python"
return url


create_tensorflow_inventory()
set_intersphinx_version_remapping({
"matplotlib": {"3.5.1": "3.5.0"},
"pandas": {
"3.0.2": "3.0.1",
"3.0.3": "3.0.1",
},
"scipy": {"1.7.3": "1.7.1"},
})

Expand Down Expand Up @@ -213,7 +209,10 @@ def get_tensorflow_url() -> str:
"jax": ("https://docs.jax.dev/en/latest", None),
"matplotlib": (f"https://matplotlib.org/{pin('matplotlib')}", None),
"numpy": (f"https://numpy.org/doc/{pin_minor('numpy')}", None),
"pandas": (f"https://pandas.pydata.org/pandas-docs/version/{pin('pandas')}", None),
"pandas": (
f"https://pandas.pydata.org/pandas-docs/version/{pin_minor(package_name='pandas')}",
None,
),
"python": ("https://docs.python.org/3", None),
"qrules": (f"https://qrules.readthedocs.io/{pin('qrules')}", None),
"rich": ("https://rich.readthedocs.io/en/stable", None),
Expand All @@ -226,6 +225,7 @@ def get_tensorflow_url() -> str:
r"pip\-installation\-gpu\-cuda",
]
linkcheck_ignore = [
"https://stackoverflow.com/a/9730706",
"https://unix.stackexchange.com/a/129144",
]
modindex_common_prefix = [f"{PACKAGE}."]
Expand Down
154 changes: 79 additions & 75 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -445,34 +445,36 @@ line-ending = "lf"

[tool.ruff.lint]
ignore = [
"ANN401",
"C408",
"COM812",
"CPY001",
"D101",
"D102",
"D103",
"D105",
"D107",
"D203",
"D213",
"D407",
"D416",
"DOC",
"DTZ005",
"E501",
"FBT00",
"FURB10",
"FURB140",
"G004",
"ISC001",
"PLW1514",
"PT001",
"PTH",
"RUF012",
"RUF067",
"S307",
"SIM108",
"any-type",
"call-datetime-now-without-tzinfo",
"if-else-block-instead-of-if-exp",
"incorrect-blank-line-before-class",
"line-too-long",
"logging-f-string",
"missing-copyright-notice",
"missing-dashed-underline-after-section",
"missing-section-name-colon",
"missing-trailing-comma",
"multi-line-summary-second-line",
"mutable-class-default",
"non-empty-init-module",
"pytest-fixture-incorrect-parentheses-style",
"read-whole-file",
"reimplemented-starmap",
"single-line-implicit-string-concatenation",
"suspicious-eval-usage",
"undocumented-magic-method",
"undocumented-public-class",
"undocumented-public-function",
"undocumented-public-init",
"undocumented-public-method",
"unnecessary-collection-call",
"unspecified-encoding",
"write-whole-file",
]
select = ["ALL"]
task-tags = ["cspell"]
Expand All @@ -497,77 +499,79 @@ split-on-trailing-comma = false
[tool.ruff.lint.per-file-ignores]
"*.ipynb" = [
"ANN",
"ARG002",
"B018",
"C90",
"D",
"E303",
"E402",
"E703",
"F404",
"N806",
"N816",
"PLR09",
"PLR2004",
"PLW0602",
"PLW0603",
"S101",
"S301",
"S403",
"T20",
"TC00",
"assert",
"global-statement",
"global-variable-not-assigned",
"late-future-import",
"magic-value-comparison",
"mixed-case-variable-in-global-scope",
"module-import-not-at-top-of-file",
"non-lowercase-variable-in-function",
"suspicious-pickle-import",
"suspicious-pickle-usage",
"too-many-blank-lines",
"unused-method-argument",
"useless-expression",
"useless-semicolon",
]
"*docs/usage/faster-lambdify.ipynb" = [
"F401",
"F821",
"unused-import",
"undefined-name",
]
"benchmarks/*" = [
"ANN",
"D",
"INP001",
"PLC0415",
"PLC2701",
"PLR0913",
"PLR0917",
"PLR2004",
"PLR6301",
"RUF069",
"S101",
"SLF001",
"T20",
"assert",
"boolean-type-hint-positional-argument",
"float-equality-comparison",
"implicit-namespace-package",
"import-outside-top-level",
"import-private-name",
"magic-value-comparison",
"no-self-use",
"private-member-access",
"too-many-arguments",
"too-many-positional-arguments",
]
"callbacks.py" = ["ARG002"]
"callbacks.py" = ["unused-method-argument"]
"docs/*" = [
"E402",
"INP001",
"S101",
"S113",
"T201",
"assert",
"implicit-namespace-package",
"module-import-not-at-top-of-file",
"print",
"request-without-timeout",
]
"docs/conf.py" = [
"A001",
"D100",
"S404",
"builtin-variable-shadowing",
"suspicious-subprocess-import",
"undocumented-public-module",
]
"setup.py" = ["D100"]
"src/tensorwaves/function/_backend.py" = ["PLC0415"]
"src/tensorwaves/function/sympy/__init__.py" = ["PLC0415"]
"setup.py" = ["undocumented-public-module"]
"src/tensorwaves/function/_backend.py" = ["import-outside-top-level"]
"src/tensorwaves/function/sympy/__init__.py" = ["import-outside-top-level"]
"tests/*" = [
"ANN",
"ARG002",
"D",
"INP001",
"PLC0415",
"PLC2701",
"PLR0913",
"PLR0914",
"PLR0917",
"PLR2004",
"PLR6301",
"RUF069",
"S101",
"SLF001",
"T20",
"assert",
"boolean-type-hint-positional-argument",
"float-equality-comparison",
"implicit-namespace-package",
"import-outside-top-level",
"import-private-name",
"magic-value-comparison",
"no-self-use",
"private-member-access",
"too-many-arguments",
"too-many-locals",
"too-many-positional-arguments",
"unused-method-argument",
]

[tool.ruff.lint.pydocstyle]
Expand Down Expand Up @@ -604,7 +608,7 @@ key-empty = "off"

[[tool.tombi.schemas]]
root = "tool.compwa.policy"
path = "https://raw.githubusercontent.com/ComPWA/policy/0.9.0/compwa-policy.schema.json"
path = "https://raw.githubusercontent.com/ComPWA/policy/0.9.3/compwa-policy.schema.json"
include = ["pyproject.toml"]

[[tool.ty.overrides]]
Expand Down
14 changes: 10 additions & 4 deletions src/tensorwaves/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,17 @@
select_events,
)
from .phasespace import (
TFPhaseSpaceGenerator, # noqa: F401
TFWeightedPhaseSpaceGenerator, # noqa: F401
TFPhaseSpaceGenerator, # ruff:ignore[unused-import]
TFWeightedPhaseSpaceGenerator, # ruff:ignore[unused-import]
)
from .rng import ( # ruff:ignore[unused-import]
NumpyUniformRNG,
TFUniformRealNumberGenerator,
)
from .transform import ( # ruff:ignore[unused-import]
IdentityTransformer,
SympyDataTransformer,
)
from .rng import NumpyUniformRNG, TFUniformRealNumberGenerator # noqa: F401
from .transform import IdentityTransformer, SympyDataTransformer # noqa: F401

_LOGGER = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion src/tensorwaves/data/phasespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def __init__(
final_state_masses: Mapping[int, float],
) -> None:
try:
import phasespace # noqa: PLC0415
import phasespace # ruff:ignore[import-outside-top-level]
except ImportError: # pragma: no cover
raise_missing_module_error("phasespace", extras_require="phsp")
sorted_ids = sorted(final_state_masses)
Expand Down
4 changes: 2 additions & 2 deletions src/tensorwaves/data/rng.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class TFUniformRealNumberGenerator(RealNumberGenerator):

def __init__(self, seed: int | None = None) -> None:
try:
from tensorflow import float64 # noqa: PLC0415
from tensorflow import float64 # ruff:ignore[import-outside-top-level]
except ImportError: # pragma: no cover
raise_missing_module_error("tensorflow", extras_require="tf")
self.seed = seed
Expand Down Expand Up @@ -73,7 +73,7 @@ def _get_tensorflow_rng(seed: SeedLike | None = None) -> tf.random.Generator:
https://github.com/zfit/phasespace/blob/5998e2b/phasespace/random.py#L15-L41
"""
try:
import tensorflow as tf # noqa: PLC0415
import tensorflow as tf # ruff:ignore[import-outside-top-level]
except ImportError: # pragma: no cover
raise_missing_module_error("tensorflow", extras_require="tf")

Expand Down
2 changes: 1 addition & 1 deletion src/tensorwaves/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def gradient_creator(
) -> Callable[[Mapping[str, ParameterValue]], dict[str, ParameterValue]]:
if backend == "jax":
try:
import jax # noqa: PLC0415
import jax # ruff:ignore[import-outside-top-level]
except ImportError: # pragma: no cover
raise_missing_module_error("jax", extras_require="jax")
jax.config.update("jax_enable_x64", True) # ty:ignore[possibly-unresolved-reference]
Expand Down
Loading
Loading