make import of pandas or polars optional #34
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements fully dynamic DataFrame library support, allowing users to install daffy with just pandas, just polars, or both, without forcing both libraries as hard dependencies.
Problem
Previously, daffy required both pandas and polars as hard dependencies, meaning users had to install both libraries even if they only used one. This increased package size and complexity for users who only needed one DataFrame library.
Solution
Core Changes
1. Lazy imports with graceful fallbacks (
daffy/utils.py)2. Dynamic type checking
3. Removed hard dependencies (
pyproject.toml)4. Comprehensive CI testing (
.github/workflows/main.yml)uv run --withfor isolated dependency testing5. Automated test suite (
tests/test_optional_dependencies.py)6. Manual testing script (
scripts/test_isolated_deps.py)Benefits
pip install daffy pandas)