great-tables icon indicating copy to clipboard operation
great-tables copied to clipboard

DateStyle and TimeStyle are not part of the public API

Open BenGale93 opened this issue 1 year ago • 4 comments

Hi, thanks for the great library!

I'm writing a wrapper function for gt.fmt_datetime, gt.fmt_date etc. but I need to import DateStyle and TimeStyle from great_tables._formats to type hint the function correctly.

Have you considered re-exporting these Literals so they are accessible from the public API? Happy to make the PR myself, as well as re-export any other type hints that are in the public API if you agree this should be done.

BenGale93 avatar Nov 29 '24 11:11 BenGale93

Thanks for bringing this up.

@machow and @rich-iannone, do you think we should consider exposing some literals to make it easier for users to adopt type hints?

In the meantime, this could be a good opportunity to reflect on how we might enhance our type hints. I understand that the linter struggles with interpreting our databackend logic, and ensuring smooth compatibility with mypy remains a significant challenge for us.

jrycw avatar Dec 14 '24 15:12 jrycw

@jrycw @BenGale93 Sorry for the long delay in responding to this. I do think we should more publicly expose literal values (for all the advantages listed above).

rich-iannone avatar Mar 18 '25 17:03 rich-iannone

@BenGale93 Would it work for DateStyle and TimeStyle to be exposed in a new great_tables.types module?

rich-iannone avatar Mar 31 '25 17:03 rich-iannone

Sounds good to me

BenGale93 avatar Mar 31 '25 18:03 BenGale93