From 2d5e807e7d4ec97bedb8c1cf970503924a5d2d35 Mon Sep 17 00:00:00 2001 From: Sp5rky Date: Tue, 30 Sep 2025 13:55:21 -0600 Subject: [PATCH] fix: suppress tinycss SyntaxWarning by initializing filter before imports Move warnings.filterwarnings() to the very top of __main__.py before any other imports to ensure it takes effect before tinycss is loaded during module discovery. This fixes the SyntaxWarning from the unmaintained tinycss package (a dependency of subby). refs #20 --- unshackle/core/__main__.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/unshackle/core/__main__.py b/unshackle/core/__main__.py index 2e80b53..7aac73e 100644 --- a/unshackle/core/__main__.py +++ b/unshackle/core/__main__.py @@ -1,14 +1,16 @@ +import warnings + +# Suppress SyntaxWarning from unmaintained tinycss package (dependency of subby) +# Must be set before any imports that might trigger tinycss loading +warnings.filterwarnings("ignore", category=SyntaxWarning, module="tinycss") + import atexit import logging -import warnings from pathlib import Path import click import urllib3 from rich import traceback - -# Suppress SyntaxWarning from unmaintained tinycss package (dependency of subby) -warnings.filterwarnings("ignore", category=SyntaxWarning, module="tinycss") from rich.console import Group from rich.padding import Padding from rich.text import Text