great-tables
great-tables copied to clipboard
Pandas is a ghost requirement?
This test fails with a ModuleNotFound error.
`def test_one_column_table_no_lib() -> None: sys.modules["pandas"] = None
with pytest.raises(ModuleNotFoundError):
import pandas
vals = [1, 2, 3]
_make_one_col_table(vals=vals)
`
I dug into the code and I believe the the issue is a type checking block blindly imports some libraries if an instance check is triggered. Most of the instance checks seem to happen when a method is wrapped with single dispatch. Below is the block in question in this file great_tables/_tbl_data.py.
if TYPE_CHECKING: import numpy as np import pandas as pd import polars as pl import pyarrow as pa
I tried to fix it myself but the scope of it felt pretty large. Is this even a bug? From my understand Pandas was not a requirement?