From faa2329adf634587fc75e6b56f1e7e6446afba68 Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Wed, 18 Feb 2026 05:15:00 -0500 Subject: [PATCH] Union syntax compatibility with pre- Python 3.10 We probably shouldn't be supporting EOL'd Pythons, but setup.py and CONTRIBUTING.rst both say Python 3.6+ at this time, and the code does not run on Python 3.6. The easy fix for now is to use "from tying import Union"; a better fix for the future would be to advance this project to Python 3.10+. --- CHANGELOG | 5 +++-- cli_helpers/utils.py | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 32dbaf7..f078662 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,11 +1,12 @@ # Changelog -## Upcoming +## Version 2.10.1 -(released on TBD) +(released on 2025-02-18) - Update license dates. - Change `master` branch references to `main`. +- Provisional Python 3.6 compatibility (Union syntax). ## Version 2.10.0 diff --git a/cli_helpers/utils.py b/cli_helpers/utils.py index 921c2bc..5e6646f 100644 --- a/cli_helpers/utils.py +++ b/cli_helpers/utils.py @@ -5,7 +5,7 @@ import os import re from functools import lru_cache -from typing import Dict +from typing import Dict, Union from typing import TYPE_CHECKING @@ -119,7 +119,7 @@ def replace(s, replace): @lru_cache() -def _get_formatter(style) -> Terminal256Formatter | TerminalTrueColorFormatter: +def _get_formatter(style) -> Union[Terminal256Formatter, TerminalTrueColorFormatter]: if "truecolor" in os.getenv("COLORTERM", "").lower(): return TerminalTrueColorFormatter(style=style) else: