Coverage for src/lilbee/crawler/availability.py: 100%

8 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-11-06 08:17 +0000

1"""Whether the ``crawler`` extra is installed.""" 

2 

3from __future__ import annotations 

4 

5import functools 

6import importlib.util 

7 

8# The modules of the crawler extra a crawl imports: the crawler, and the URL parser of saved names. 

9_CRAWLER_MODULES = ("crawlberg", "ada_url") 

10CRAWLER_MISSING_MESSAGE = "Web crawling requires: pip install 'lilbee[crawler]'" 

11 

12 

13@functools.cache 

14def crawler_available() -> bool: 

15 """Whether every module of the crawler extra is installed, checked without importing one.""" 

16 return all(importlib.util.find_spec(module) is not None for module in _CRAWLER_MODULES)