Skip to content

Audit remaining broad except ImportError guards (pandas, pydantic, trans auto-register) #7

Closed

Description

@thorwhalen

Follow-up to #4 / #6. #6 narrowed the ju guard in specs.py so only the absence of ju itself falls back; any other import failure propagates. The same masking pattern remains elsewhere, guarding genuinely optional dependencies:

  • uf/renderers.py (DataFrame renderer can_render): except ImportError: return False. A broken pandas install silently disables DataFrame rendering.
  • uf/pydantic_support.py (is_pydantic_model, validation-error formatting): except ImportError. A broken pydantic install silently treats models as plain objects.
  • uf/trans.py (module-level register_common_types()): except ImportError: pass around the whole registration. Any ImportError raised inside registration is swallowed at import time.

Suggested: one small shared helper, generalized from _import_func_to_form_spec in specs.py (return the module, or None only when ModuleNotFoundError.name is the optional package itself, otherwise re-raise), applied at these sites. Lower stakes than #4 because these really are optional deps, hence deferred.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions