Fix local dataframe extension detection#779
Conversation
Linked Issue CheckThis PR does not reference an issue. External contributions must link to Add one of the following to your PR description:
If no issue exists yet, open one See CONTRIBUTING.md |
|
All contributors have signed the DCO ✍️ ✅ |
|
I have read the DCO document and I hereby sign the DCO. |
|
Thanks for catching this and adding real local-file regression coverage. Your diagnosis is correct: Path.suffix includes the leading dot. We decided in #791 to remove smart_load_dataframe because it is undocumented, unexported, and has no production callers. That cleanup supersedes this fix. We should have linked this PR sooner. Thank you for the contribution. |
Summary
Path.suffixbehaves like a real path.csv,.json, and.parquetinputs via bothPathandstrWhy
The local-file branch of
smart_load_dataframe()usedPath.suffix.lower(), which returns values like.csv. The loader dispatch compared that againstcsv,json, andparquet, so valid local files could fall through toUnsupported file format.The existing test mocked
suffix.lower()to returncsvwithout the dot, which masked the bug. The new regression test writes actual files and exercises the real path behavior.Testing
uv run --package data-designer-config pytest packages/data-designer-config/tests/config/utils/test_io_helpers.pyuv run ruff check packages/data-designer-config/src/data_designer/config/utils/io_helpers.py packages/data-designer-config/tests/config/utils/test_io_helpers.pyuv run ruff format --check packages/data-designer-config/src/data_designer/config/utils/io_helpers.py packages/data-designer-config/tests/config/utils/test_io_helpers.py