Skip to content

Commit 7fbfe50

Browse files
Carreauclaude
andcommitted
Require pygments >= 2.14 and test the lower bound
The dependency had no lower bound, although the module does not even import on old Pygments (Python2Lexer is missing in 2.4). Require 2.14 (January 2023), the first version that emits Token.Text.Whitespace where the tests expect it, and drop the pre-2.14 shim in the tests. Add a CI job that runs the tests on Python 3.11 with pygments==2.14.0 so the floor stays accurate. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
1 parent d31ae57 commit 7fbfe50

3 files changed

Lines changed: 12 additions & 6 deletions

File tree

‎.github/workflows/test.yml‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,18 @@ jobs:
4444
run: python3 -m mypy
4545

4646
tests:
47+
name: tests (Python ${{ matrix.python-version }}${{ matrix.pygments && format(', pygments{0}', matrix.pygments) || '' }})
4748
runs-on: ubuntu-latest
4849
strategy:
4950
fail-fast: false
5051
matrix:
5152
python-version: ["3.11", "3.12", "3.13", "3.14", "3.15"]
53+
pygments: [""] # latest
54+
include:
55+
# Oldest supported Pygments, to keep the lower bound honest. This is
56+
# a separate job because it differs from the [""] axis value.
57+
- python-version: "3.11"
58+
pygments: "==2.14.0"
5259

5360
steps:
5461
- name: Checkout
@@ -62,9 +69,11 @@ jobs:
6269
python-version: ${{ matrix.python-version }}
6370

6471
- name: Install dependencies
72+
env:
73+
PYGMENTS_SPEC: ${{ matrix.pygments }}
6574
run: |
6675
python3 -m pip install --upgrade pip
67-
python3 -m pip install . --group test
76+
python3 -m pip install . --group test "pygments${PYGMENTS_SPEC}"
6877
6978
- name: Test with pytest
7079
run: |

‎pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ classifiers = [
2323
]
2424
requires-python=">=3.11"
2525
dependencies = [
26-
"pygments"
26+
"pygments>=2.14",
2727
]
2828
dynamic=["version", "description"]
2929

‎test_ipython_pygments_lexers.py‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,12 @@
55

66
import pygments.lexers
77
import pytest
8-
from pygments import __version__ as pygments_version
98
from pygments.lexers import BashLexer
109
from pygments.token import Token
1110

1211
import ipython_pygments_lexers as lexers
1312

14-
pyg214 = tuple(int(x) for x in pygments_version.split(".")[:2]) >= (2, 14)
15-
16-
TOKEN_WS = Token.Text.Whitespace if pyg214 else Token.Text
13+
TOKEN_WS = Token.Text.Whitespace
1714

1815
EXPECTED_LEXER_NAMES = [
1916
cls.name for cls in [lexers.IPythonConsoleLexer, lexers.IPython3Lexer]

0 commit comments

Comments
 (0)