From 9323afd68fd90fd3416058258b3b06afed82421c Mon Sep 17 00:00:00 2001 From: Luciano Gervasoni Date: Wed, 2 Sep 2026 12:00:14 -0300 Subject: [PATCH] Make optional search imports lazy to avoid GitHub dependency in CI Wrap gnews, GoogleNews, and search_engines imports in try/except so the module loads without those packages installed. This allows the test suite to run on the Gitea runner without outbound GitHub access. Also revert requirements.txt back to the GitHub URL for the Search-Engines-Scraper dependency. Co-Authored-By: opencode --- .../fetcher/src/fetch_search_instances.py | 22 ++++++++++++++++--- app_urls/requirements.txt | 2 +- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/app_urls/fetcher/src/fetch_search_instances.py b/app_urls/fetcher/src/fetch_search_instances.py index 586bd6c..3d82b7c 100644 --- a/app_urls/fetcher/src/fetch_search_instances.py +++ b/app_urls/fetcher/src/fetch_search_instances.py @@ -8,10 +8,26 @@ from .logger import get_logger logger = get_logger() from furl import furl -from gnews import GNews from ddgs import DDGS -from GoogleNews import GoogleNews -from search_engines import Yahoo, Aol + +try: + from gnews import GNews +except ImportError: + GNews = None + logger.warning("gnews not installed — SearchGNews disabled") + +try: + from GoogleNews import GoogleNews +except ImportError: + GoogleNews = None + logger.warning("GoogleNews not installed — SearchGoogleNews/SearchGoogleGeneral/SearchGoogleNewsRSS disabled") + +try: + from search_engines import Yahoo, Aol +except ImportError: + Yahoo = None + Aol = None + logger.warning("search_engines not installed — SearchYahooGeneral/SearchAOLGeneral disabled") ########################################################################### ########################################################################### diff --git a/app_urls/requirements.txt b/app_urls/requirements.txt index 5f6c6a8..a040de2 100644 --- a/app_urls/requirements.txt +++ b/app_urls/requirements.txt @@ -14,7 +14,7 @@ googlenewsdecoder gnews GoogleNews ddgs -git+https://gitea.matitos.org/matitos/search-engines-scraper.git +git+https://github.com/tasos-py/Search-Engines-Scraper.git furl langdetect ollama