Skip to content

Commit

Permalink
MAINT: drop Python 3.8 support due to EOL (#365)
Browse files Browse the repository at this point in the history
* DX: exclude `.constraints` dir from VS Code search
* DX: remove `python.analysis.typeCheckingMode` VS Code setting
* FIX: set correct Python version for GitLab CI
* MAINT: modernize Python syntax to Python 3.9
* MAINT: ignore links to PRD
* MAINT: update links to `TypeVar`
  • Loading branch information
redeboer authored Oct 11, 2024
1 parent 47bd4fb commit d029231
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 248 deletions.
231 changes: 0 additions & 231 deletions .constraints/py3.8.txt

This file was deleted.

2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ documentation:
before_script:
- apt-get update -y
- apt-get install -y cm-super dvipng inkscape latexmk texlive-fonts-extra texlive-latex-extra texlive-xetex xindy
- python3 -m pip install .[doc] tox -c .constraints/py3.8.txt
- python3 -m pip install .[doc] tox -c .constraints/py3.9.txt
- version=$(sed -n '3p' julia/Manifest.toml)
- version=${version:17:-1}
- major_version=${version:0:-2}
Expand Down
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
"notebook.gotoSymbols.showAllSymbols": true,
"python.analysis.autoImportCompletions": false,
"python.analysis.inlayHints.pytestParameters": true,
"python.analysis.typeCheckingMode": "strict",
"python.terminal.activateEnvironment": false,
"python.testing.pytestArgs": ["--color=no"],
"python.testing.pytestEnabled": true,
Expand All @@ -65,6 +64,9 @@
"ruff.enable": true,
"ruff.importStrategy": "fromEnvironment",
"ruff.organizeImports": true,
"search.exclude": {
"**/.constraints/py*.txt": true
},
"telemetry.telemetryLevel": "off",
"yaml.schemas": {
"https://citation-file-format.github.io/1.2.0/schema.json": "CITATION.cff",
Expand Down
4 changes: 2 additions & 2 deletions docs/appendix/widget.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"\n",
"import logging\n",
"import os\n",
"from functools import lru_cache\n",
"from functools import cache\n",
"from textwrap import dedent\n",
"from warnings import filterwarnings\n",
"\n",
Expand Down Expand Up @@ -170,7 +170,7 @@
"FIXED_PARAMETERS = {s: v for s, v in PARAMETERS.items() if s not in FREE_PARAMETERS}\n",
"\n",
"\n",
"@lru_cache(maxsize=None)\n",
"@cache\n",
"def unfold_and_substitute(expr: sp.Expr, reference_subsystem: int = 1) -> sp.Expr:\n",
" expr = perform_cached_doit(expr)\n",
" expr = perform_cached_doit(expr.xreplace(MODELS[reference_subsystem].amplitudes))\n",
Expand Down
6 changes: 5 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ def print(self) -> None:
add_module_names = False
api_github_repo = f"{ORGANIZATION}/{REPO_NAME}"
api_target_substitutions = {
"_T": "typing.TypeVar",
"AmplitudeModel": "ampform_dpd.AmplitudeModel",
"Artist": "matplotlib.artist.Artist",
"Axes": "matplotlib.axes.Axes",
Expand All @@ -255,7 +256,6 @@ def print(self) -> None:
"Particle": "ampform_dpd.decay.Particle",
"Path": "pathlib.Path",
"Pattern": "typing.Pattern",
"polarimetry.lhcb._T": "typing.TypeVar",
"PoolSum": "ampform.sympy.PoolSum",
"PositionalArgumentFunction": "tensorwaves.function.PositionalArgumentFunction",
"QuadContourSet": "matplotlib.contour.QuadContourSet",
Expand Down Expand Up @@ -443,9 +443,13 @@ def print(self) -> None:
}
latex_engine = "xelatex" # https://tex.stackexchange.com/a/570691
latex_show_pagerefs = True
linkcheck_anchors_ignore_for_url = [
"https://github.com/ComPWA/polarimetry/issues",
]
linkcheck_ignore = [
"https://arxiv.org/pdf/2208.03262.pdf",
"https://arxiv.org/pdf/hep-ex/0510019.pdf",
"https://doi.org/10.1103/PhysRevD.101.034033",
"https://journals.aps.org/prd/pdf/10.1103/PhysRevD.101.034033",
"https://www.bookfinder.com",
]
Expand Down
10 changes: 5 additions & 5 deletions docs/cross-check.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"import json\n",
"import logging\n",
"import os\n",
"from functools import lru_cache\n",
"from functools import cache\n",
"from textwrap import dedent\n",
"\n",
"import numpy as np\n",
Expand All @@ -55,7 +55,7 @@
"from polarimetry.lhcb.particle import load_particles\n",
"\n",
"\n",
"@lru_cache(maxsize=None)\n",
"@cache\n",
"def load_model_cached(model_id: int | str) -> AmplitudeModel:\n",
" return load_model(MODEL_FILE, PARTICLES, model_id)\n",
"\n",
Expand Down Expand Up @@ -265,7 +265,7 @@
},
"outputs": [],
"source": [
"@lru_cache(maxsize=None)\n",
"@cache\n",
"def create_amplitude_functions(\n",
" model_id: int | str,\n",
") -> dict[tuple[sp.Rational, sp.Rational], sp.Expr]:\n",
Expand All @@ -287,7 +287,7 @@
" }\n",
"\n",
"\n",
"@lru_cache(maxsize=None)\n",
"@cache\n",
"def formulate_amplitude_expressions(\n",
" model_id: int | str,\n",
") -> dict[tuple[sp.Rational, sp.Rational], sp.Expr]:\n",
Expand All @@ -305,7 +305,7 @@
" }\n",
"\n",
"\n",
"@lru_cache(maxsize=None)\n",
"@cache\n",
"def get_production_couplings(model_id: int | str) -> dict[sp.Indexed, complex]:\n",
" model = load_model(MODEL_FILE, PARTICLES, model_id)\n",
" return {\n",
Expand Down
4 changes: 2 additions & 2 deletions docs/resonance-polarimetry.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"import logging\n",
"import os\n",
"from collections import defaultdict\n",
"from functools import lru_cache\n",
"from functools import cache\n",
"from math import ceil, sqrt\n",
"from textwrap import dedent, wrap\n",
"from typing import Literal\n",
Expand Down Expand Up @@ -86,7 +86,7 @@
" logging.getLogger(\"polarimetry.io\").setLevel(logging.ERROR)\n",
"\n",
"\n",
"@lru_cache(maxsize=None)\n",
"@cache\n",
"def doit(expr: PoolSum) -> sp.Expr:\n",
" return perform_cached_doit(expr)"
]
Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python",
"Topic :: Scientific/Engineering :: Physics",
Expand All @@ -45,7 +44,7 @@ description = "Symbolic expressions that describe an aligned polarimeter vector
dynamic = ["version"]
license = {file = "LICENSE"}
name = "polarimetry-lc2pkpi"
requires-python = ">=3.8"
requires-python = ">=3.9"

[project.optional-dependencies]
dev = [
Expand Down Expand Up @@ -221,7 +220,7 @@ src = [
"src",
"tests",
]
target-version = "py38"
target-version = "py39"

[tool.ruff.format]
docstring-code-format = true
Expand Down
Loading

0 comments on commit d029231

Please sign in to comment.