-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: make Series
generic
#1412
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for doing this!
i think in stable/v1 you may need to do something like
from narwhals.typing import Series as NwSeries
Series = NwSeries[Any]
to keep it stable for shiny?
Thanks @MarcoGorelli for the review βοΈ shiny is happy now but (the CI error seems unrelated) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, nice one! just got a question
Looking over https://narwhals-dev.github.io/narwhals/backcompat/#exceptions, we did write
we may consider making some type hints more precise.
I feel like we should loop @schloerke into the conversation - would you be OK with us making this type hint more precise? It would only affect Shiny's internal typing and so wouldn't be user-facing, and we would also make the PR to Shiny to get your CI green again
If not, no worries, the stable.v1 mechanism does allow us to only make this change in the main namespace
@MarcoGorelli Correct. https://github.com/narwhals-dev/narwhals/actions/runs/11932852152/job/33258672137?pr=1412 does break When testing locally, I changed the pyproject.yaml narwhals dep to # "narwhals>=1.10.0",
"narwhals@git+https://github.com/EdAbati/narwhals@series-generic", Maybe we could wrap around https://github.com/posit-dev/py-shiny/blob/f6b92d8cf49a90f3b3dbb636cd6d7fdeee244cfd/shiny/render/_data_frame_utils/_types.py#L69 and check the narwhals version and return the appropriate These can probably be done within Shiny before the PR is merged? Please tag me in the py-shiny PR when it is ready π I currently do not have a date as to when shiny would be released after the merge. π |
Yay for stronger typing!! |
859e0d6
to
eea19c6
Compare
i just tried this at it looks like it would break Altair's typing too, so I reverted the extra commit maybe it's OK to just introduce this in the main namespace and leave |
Thanks both! |
What type of PR is this? (check all applicable)
Related issues
Checklist
If you have comments or can explain your changes, please do so below
Last week, I was playing with the idea of having
Series
generic asDataFrame
s for better typing.It may be useful since it is related to the current issues/PRs around documentation/typing.