From 9f157bcb795b2d10ecef9f86fa292c93479d1895 Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Sat, 22 Aug 2026 15:44:32 -0400 Subject: [PATCH] upgrade pygments to v2.21.0 removing hacks for identifiers starting with "set" (since the issue was fixed upstream). --- changelog.md | 8 ++++++++ mycli/lexer.py | 4 +--- pyproject.toml | 4 ++-- test/pytests/test_lexer.py | 10 ---------- 4 files changed, 11 insertions(+), 15 deletions(-) delete mode 100644 test/pytests/test_lexer.py diff --git a/changelog.md b/changelog.md index 07fae2cc8..5e080b8c6 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,11 @@ +Upcoming (TBD) +============== + +Internal +--------- +* Upgrade `pygments` to v2.21.0, removing hacks for `set*` identifiers. + + 2.16.0 (2026/08/22) ============== diff --git a/mycli/lexer.py b/mycli/lexer.py index 19fb79749..4caac56d2 100644 --- a/mycli/lexer.py +++ b/mycli/lexer.py @@ -1,6 +1,6 @@ from pygments.lexer import inherit from pygments.lexers.sql import MySqlLexer -from pygments.token import Keyword, Name +from pygments.token import Keyword class MyCliLexer(MySqlLexer): @@ -8,8 +8,6 @@ class MyCliLexer(MySqlLexer): tokens = { "root": [ - # TODO: Remove once Pygments is upgraded above v2.20.0. - (r"\bset[\w$]+\b", Name), (r"\brepair\b", Keyword), (r"\boffset\b", Keyword), inherit, diff --git a/pyproject.toml b/pyproject.toml index 20d47544f..040d6cd05 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,7 +30,7 @@ dependencies = [ "click ~= 8.3.3", "clickdc ~= 0.1.1", "cryptography ~= 50.0.0", - "Pygments ~= 2.20.0", + "Pygments ~= 2.21.0", "prompt_toolkit >= 3.0.41,<4.0.0", "PyMySQL ~= 1.1.2", "sqlparse >= 0.3.0,<0.6.0", @@ -101,7 +101,7 @@ include = ["mycli*"] [tool.uv] exclude-newer = '1 week' -exclude-newer-package = { cli_helpers = false, cryptography = false } +exclude-newer-package = { cli_helpers = false, pygments = false } [tool.ruff] target-version = 'py310' diff --git a/test/pytests/test_lexer.py b/test/pytests/test_lexer.py deleted file mode 100644 index 264964585..000000000 --- a/test/pytests/test_lexer.py +++ /dev/null @@ -1,10 +0,0 @@ -from pygments.token import Keyword, Name - -from mycli.lexer import MyCliLexer - - -def test_mysql_lexer_keeps_identifiers_starting_with_set_together(): - tokens = list(MyCliLexer().get_tokens("SELECT * FROM settings_123 WHERE id = 123;")) - - assert (Name, "settings_123") in tokens - assert (Keyword, "set") not in tokens