Skip to content

Commit 341ef14

Browse files
committed
Bump supported Python interval to [3.10, 3.14], and updated ruff version target to 3.10.
1 parent 1cb87a4 commit 341ef14

6 files changed

Lines changed: 18 additions & 15 deletions

File tree

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
- uses: actions/checkout@v5
4848
- uses: actions/setup-python@v6
4949
with:
50-
python-version: "3.12"
50+
python-version: "3.14"
5151
- uses: py-actions/flake8@v2
5252

5353
cython-lint:
@@ -58,7 +58,7 @@ jobs:
5858
- name: Setup Python
5959
uses: actions/setup-python@v6
6060
with:
61-
python-version: "3.12"
61+
python-version: "3.14"
6262
- name: Install Python packages
6363
run: python -m pip install cython-lint
6464
- name: cython-lint

.github/workflows/python.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
1111
strategy:
1212
matrix:
13-
python-version: ['3.9', '3.13']
13+
python-version: ['3.10', '3.14']
1414

1515
steps:
1616
- uses: actions/checkout@v5
@@ -39,7 +39,7 @@ jobs:
3939
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
4040
strategy:
4141
matrix:
42-
python-version: ['3.13']
42+
python-version: ['3.14']
4343

4444
steps:
4545
- uses: actions/checkout@v4
@@ -64,7 +64,7 @@ jobs:
6464
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
6565
strategy:
6666
matrix:
67-
python-version: ['3.13']
67+
python-version: ['3.14']
6868

6969
steps:
7070
- uses: actions/checkout@v4
@@ -89,7 +89,7 @@ jobs:
8989
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
9090
strategy:
9191
matrix:
92-
python-version: ['3.13']
92+
python-version: ['3.14']
9393

9494
steps:
9595
- uses: actions/checkout@v5

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name = "pygambit"
77
version = "16.4.0"
88
description = "The package for computation in game theory"
99
readme = "src/README.rst"
10-
requires-python = ">=3.9"
10+
requires-python = ">=3.10"
1111
license = "GPL-2.0-or-later"
1212
authors = [
1313
{name = "Theodore Turocy", email = "ted.turocy@gmail.com"},
@@ -17,11 +17,11 @@ keywords = ["game theory", "Nash equilibrium"]
1717
classifiers=[
1818
"Development Status :: 5 - Production/Stable",
1919
"Intended Audience :: Science/Research",
20-
"Programming Language :: Python :: 3.9",
2120
"Programming Language :: Python :: 3.10",
2221
"Programming Language :: Python :: 3.11",
2322
"Programming Language :: Python :: 3.12",
2423
"Programming Language :: Python :: 3.13",
24+
"Programming Language :: Python :: 3.14",
2525
"Programming Language :: Python :: Implementation :: CPython",
2626
"Topic :: Scientific/Engineering :: Mathematics"
2727
]
@@ -41,7 +41,7 @@ Changelog = "https://github.com/gambitproject/gambit/blob/master/ChangeLog"
4141
[tool.ruff]
4242
line-length = 99
4343
indent-width = 4
44-
target-version = "py39"
44+
target-version = "py310"
4545
include = ["setup.py", "src/pygambit/**/*.py", "tests/**/*.py, doc/tutorials/*.ipynb"]
4646

4747
[tool.ruff.lint]

src/pygambit/levelk.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def fit_coghier(game, data, min_tau, max_tau, min_lam, max_lam,
9797
points, to polish the maximizer.
9898
"""
9999
def log_like(profile, data):
100-
return sum(math.log(p) * d for (p, d) in zip(profile, data))
100+
return sum(math.log(p) * d for (p, d) in zip(profile, data, strict=True))
101101

102102
def objective(params, game, data):
103103
penalty = 0.0

src/pygambit/qre.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,15 @@ def _empirical_log_logit_probs(lam: float, regrets: list) -> list:
195195
math.log(sum([math.exp(lam*r) for r in infoset]))
196196
for infoset in regrets
197197
]
198-
return [lam*a - s for (r, s) in zip(regrets, log_sums) for a in r]
198+
return [lam*a - s for (r, s) in zip(regrets, log_sums, strict=True) for a in r]
199199

200200

201201
def _empirical_log_like(lam: float, regrets: list, flattened_data: list) -> float:
202202
"""Given empirical choice regrets and a list of frequencies of choices, compute
203203
the log-likelihood of the choices given the regrets and assuming the logit
204204
choice model with lambda `lam`."""
205-
return sum([f*p for (f, p) in zip(flattened_data, _empirical_log_logit_probs(lam, regrets))])
205+
return sum([f*p for (f, p) in zip(flattened_data, _empirical_log_logit_probs(lam, regrets),
206+
strict=True)])
206207

207208

208209
def _estimate_strategy_empirical(
@@ -219,7 +220,8 @@ def _estimate_strategy_empirical(
219220
)
220221
profile = data.game.mixed_strategy_profile()
221222
for strategy, log_prob in zip(data.game.strategies,
222-
_empirical_log_logit_probs(res.x[0], regrets)):
223+
_empirical_log_logit_probs(res.x[0], regrets),
224+
strict=True):
223225
profile[strategy] = math.exp(log_prob)
224226
return LogitQREMixedStrategyFitResult(
225227
data, "empirical", res.x[0], profile, -res.fun
@@ -239,7 +241,8 @@ def _estimate_behavior_empirical(
239241
bounds=((0.0, None),)
240242
)
241243
profile = data.game.mixed_behavior_profile()
242-
for action, log_prob in zip(data.game.actions, _empirical_log_logit_probs(res.x[0], regrets)):
244+
for action, log_prob in zip(data.game.actions, _empirical_log_logit_probs(res.x[0], regrets),
245+
strict=True):
243246
profile[action] = math.exp(log_prob)
244247
return LogitQREMixedBehaviorFitResult(
245248
data, "empirical", res.x[0], profile, -res.fun

src/pygambit/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77
@contextlib.contextmanager
8-
def make_temporary(content: typing.Optional[str] = None) -> pathlib.Path:
8+
def make_temporary(content: str | None = None) -> typing.Generator[pathlib.Path, None, None]:
99
"""Context manager to create a temporary file containing `content', and
1010
provide the path to the temporary file.
1111

0 commit comments

Comments
 (0)