Fix module_available() crash when version metadata is missing
Problem
module_available() raises TypeError when importlib.metadata.version() returns None for packages without proper version metadata (e.g., packages installed via QGIS's embedded Python).
TypeError: expected string or bytes-like object, got 'NoneType'
Fixes #11344
Root Cause
In xarray/namedarray/utils.py, module_available() calls importlib.metadata.version(module) which can return None for packages without proper metadata. The result is passed directly to Version() which expects a string.
Fix
Add a None check after importlib.metadata.version() and return False when version metadata is unavailable (since we can't verify the minimum version requirement).
Testing
Added regression test test_module_available_with_none_version that mocks importlib.metadata.version to return None and verifies module_available() handles it gracefully.
Hi @C1-BA-B1-F3 . Thanks for taking the time to open PRs here.
However, many of these issues already had existing open PRs, and it appears you are using AI agents to do it (I can't believe a new contributor can contribute to so many different areas of the codebase so quickly). You also appear to have open 2 PRs to fix the same issue :/ . Please refrain from doing so. We cannot keep up with this pace.