From 55460b368a33b6541d0c7e8e20e19c2f1ba53140 Mon Sep 17 00:00:00 2001
From: joncrall <jon.crall@kitware.com>
Date: Fri, 18 Oct 2024 14:19:21 -0400
Subject: [PATCH] Keep rich optional

---
 scriptconfig/config.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/scriptconfig/config.py b/scriptconfig/config.py
index 571361e..2ae50ba 100644
--- a/scriptconfig/config.py
+++ b/scriptconfig/config.py
@@ -441,10 +441,13 @@ class Config(ub.NiceRepr, DictLike, metaclass=MetaConfig):
             verbose = not self.get('silent', not verbose)
 
         if verbose:
-            import rich
-            from rich.markup import escape
-            rich.print('config = ' + escape(ub.urepr(self, nl=1)))
-
+            try:
+                import rich
+                from rich.markup import escape
+            except ImportError:
+                print('config = ' + ub.urepr(self, nl=1))
+            else:
+                rich.print('config = ' + escape(ub.urepr(self, nl=1)))
         return self
 
     @classmethod
-- 
GitLab