posit-dev / great-tables

Make awesome display tables using Python.
https://posit-dev.github.io/great-tables/
MIT License
1.44k stars 50 forks source link

Refactor rm pandas #261

Closed machow closed 2 months ago

machow commented 3 months ago

This PR removes pandas as a dependency, making it optional. (Great Tables will still support pandas DataFrames as an input!)

Notes:

Details:

codecov-commenter commented 3 months ago

Codecov Report

Attention: Patch coverage is 88.77551% with 22 lines in your changes are missing coverage. Please review.

Project coverage is 77.01%. Comparing base (af6bd14) to head (ece39e8). Report is 102 commits behind head on main.

Files Patch % Lines
great_tables/_formats.py 86.11% 5 Missing :warning:
great_tables/_tbl_data.py 78.26% 5 Missing :warning:
great_tables/_utils_nanoplots.py 81.81% 4 Missing :warning:
great_tables/__init__.py 71.42% 2 Missing :warning:
great_tables/_data_color/base.py 50.00% 2 Missing :warning:
great_tables/data/__init__.py 89.47% 2 Missing :warning:
great_tables/_formats_vals.py 87.50% 1 Missing :warning:
great_tables/_utils.py 50.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #261 +/- ## ========================================== + Coverage 75.26% 77.01% +1.75% ========================================== Files 41 40 -1 Lines 4180 4229 +49 ========================================== + Hits 3146 3257 +111 + Misses 1034 972 -62 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

Yasin197 commented 3 months ago

Is this PR related to removing pandas as a hard dependency?

machow commented 3 months ago

Is this PR related to removing pandas as a hard dependency?

Yes! I'm going to have this ready for review by EOW 🤞🏼

Yasin197 commented 3 months ago

The mizani package dependency forces pandas in great-tables to be >=2.1.0?

Would this mean even though you are making pandas not a hard dependency, the mizani package will still exhibit this?

machow commented 3 months ago

The mizani package dependency forces pandas in great-tables to be >=2.1.0?

Shoot, I forgot about this piece. I'll restrict this PR to removing direct pandas imports from our codebase, and adding safeguards against people accidentally adding them in the future. We've talked through our use of mizani's gradient_n_pal(). We should be able to roll a stripped down version of that logic into Great Tables for now (but will do that in a separate PR).

Yasin197 commented 3 months ago

Thanks, this new PR will still be apart of your upcoming release right? It would make great-tables more pleasant to work with.

machow commented 3 months ago

@rich-iannone WDYT of release timing? If we release with this PR only, then we can have pandas as an optional dependency for most everything (except datasets, val.fmt_* funcs, and nanoplots). But I definitely want to remove it from nanoplots, so whatever the release cadence, will plan to start the next PR right after this!

rich-iannone commented 3 months ago

@rich-iannone WDYT of release timing? If we release with this PR only, then we can have pandas as an optional dependency for most everything (except datasets, val.fmt_* funcs, and nanoplots). But I definitely want to remove it from nanoplots, so whatever the release cadence, will plan to start the next PR right after this!

I’m thinking we keep going (through additional PRs) to work away at the final goal of Pandas as optional before the next release.