narwhals-dev / narwhals

Lightweight and extensible compatibility layer between dataframe libraries!
https://narwhals-dev.github.io/narwhals/
MIT License
440 stars 76 forks source link

Use IntoDataFrame in docs #386

Open MarcoGorelli opened 3 months ago

MarcoGorelli commented 3 months ago

We now have a IntoDataFrame type hint, which means "either a Narwhals dataframe, or something convertible to a Narwhals DataFrame"

I think we should use it in the tutorial / user guide

I'm not totally sure what whether we should use it in docstrings

Given that this tool is aimed at library maintainers, perhaps we should err on the side of including static typing in as many docs as possible?

cc @baggiponte the typing expert for thoughts?

baggiponte commented 2 months ago

Ciao Marco, sorry for the late reply.

I'm not totally sure what whether we should use it in docstrings

Why so?

MarcoGorelli commented 2 months ago

it would require an extra from narwhals.typing import IntoDataFrame, and to people who don't like type annotations it might be it look more complicated than it needs to be

dunno, maybe it'd still be better though, people who don't like type hints can just ignore them, if they don't want their IDE to help them it's on them

baggiponte commented 2 months ago

dunno, maybe it'd still be better though, people who don't like type hints can just ignore them, if they don't want their IDE to help them it's on them

I agree with this one. It'd offer a superior experience to the end user. After all, it's just a single type hint, is it not?

luke396 commented 3 weeks ago

I'd like to start and work on this.