Skip to content

Commit

Permalink
build: drop support for Python 3.6 (#132)
Browse files Browse the repository at this point in the history
* build: drop support for Python 3.6
* fix: update links to AmpForm API on RTD
* style: rewrite type hints with PEP563
  https://peps.python.org/pep-0563
  • Loading branch information
redeboer committed Apr 19, 2022
1 parent 2901ce5 commit cdd4e63
Show file tree
Hide file tree
Showing 22 changed files with 115 additions and 317 deletions.
202 changes: 0 additions & 202 deletions .constraints/py3.6.txt

This file was deleted.

1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@
"pandoc",
"pcolormesh",
"pdg's",
"phasespace",
"phsp",
"pmatrix",
"preorder",
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/requirements-cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ jobs:
fail-fast: false
matrix:
python-version:
- "3.6"
- "3.7"
- "3.8"
- "3.9"
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/requirements-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ jobs:
fail-fast: false
matrix:
python-version:
- "3.6"
- "3.7"
- "3.8"
- "3.9"
Expand Down
6 changes: 4 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,12 @@ repos:
additional_dependencies:
- black>=22.1.0
- id: nbqa-flake8
additional_dependencies:
- flake8-future-annotations
- id: nbqa-isort
- id: nbqa-pyupgrade
args:
- --py36-plus
- --py37-plus

- repo: https://github.com/kynan/nbstripout
rev: 0.5.0
Expand Down Expand Up @@ -145,7 +147,7 @@ repos:
hooks:
- id: pyupgrade
args:
- --py36-plus
- --py37-plus

# The following tools have to be install locally, because they can also be
# used by code editors (e.g. linting and format-on-save).
Expand Down
10 changes: 5 additions & 5 deletions docs/adr/001/operators.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@
"\n",
"Here's a rough sketch with `tensorwaves` in mind.\n",
"```python\n",
"from typing import Dict, Generator, List\n",
"from typing import Generator\n",
"\n",
"import attr\n",
"\n",
Expand Down Expand Up @@ -483,18 +483,18 @@
"\n",
" def __init__(self, model: AmplitudeModel) -> None:\n",
" self.__model: AmplitudeModel\n",
" self.__parameter_couplings: Dict[str, str]\n",
" self.__parameter_couplings: dict[str, str]\n",
"\n",
" @property\n",
" def parameters(self) -> List[FitParameter]:\n",
" def parameters(self) -> list[FitParameter]:\n",
" initial_parameters = list(__yield_parameter(self.__model))\n",
" self.__apply_couplings()\n",
" return self.__convert(initial_parameters)\n",
"\n",
" def couple_parameters(self, parameter1: str, parameter2: str) -> None:\n",
" pass\n",
"\n",
" def __convert(self, params: List[InitialParameter]) -> List[FitParameter]:\n",
" def __convert(self, params: list[InitialParameter]) -> list[FitParameter]:\n",
" pass\n",
"\n",
"\n",
Expand Down Expand Up @@ -530,7 +530,7 @@
"builder = IntensityBuilder(kinematics)\n",
"\n",
"intensity = builder.create(amp_model) # this would call amp_model.parameters\n",
"parameters: Dict[str, float] = intensity.parameters\n",
"parameters: dict[str, float] = intensity.parameters\n",
"# PROBLEM?: fix status is lost at this point\n",
"\n",
"data_sample = generate_data(...)\n",
Expand Down
6 changes: 3 additions & 3 deletions docs/adr/001/sympy.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,16 @@
},
"outputs": [],
"source": [
"from typing import Dict\n",
"from __future__ import annotations\n",
"\n",
"import attr\n",
"import sympy as sp\n",
"\n",
"\n",
"@attr.s\n",
"class AmplitudeModel:\n",
" initial_values: Dict[sp.Symbol, float] = attr.ib(default={})\n",
" dynamics: Dict[sp.Symbol, sp.Function] = attr.ib(default={})\n",
" initial_values: dict[sp.Symbol, float] = attr.ib(default={})\n",
" dynamics: dict[sp.Symbol, sp.Function] = attr.ib(default={})\n",
" intensity: sp.Expr = attr.ib(default=None)"
]
},
Expand Down
8 changes: 4 additions & 4 deletions docs/adr/002/composition.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
},
"outputs": [],
"source": [
"from typing import Tuple\n",
"from __future__ import annotations\n",
"\n",
"import attr\n",
"import sympy as sp\n",
Expand Down Expand Up @@ -94,8 +94,8 @@
"source": [
"@attr.s(frozen=True)\n",
"class DynamicsExpression:\n",
" variables: Tuple[sp.Symbol, ...] = attr.ib()\n",
" parameters: Tuple[sp.Symbol, ...] = attr.ib()\n",
" variables: tuple[sp.Symbol, ...] = attr.ib()\n",
" parameters: tuple[sp.Symbol, ...] = attr.ib()\n",
" expression: sp.Expr = attr.ib()\n",
"\n",
" def substitute(self) -> sp.Expr:\n",
Expand Down Expand Up @@ -2020,7 +2020,7 @@
"outputs": [],
"source": [
"def expression(\n",
" variables: Tuple[sp.Symbol, ...], parameters: Tuple[sp.Symbol, ...]\n",
" variables: tuple[sp.Symbol, ...], parameters: tuple[sp.Symbol, ...]\n",
") -> sp.Expr:\n",
" pass"
]
Expand Down
Loading

0 comments on commit cdd4e63

Please sign in to comment.