Skip to content
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

docs: add from/to_native in documentation examples #1461

Merged
merged 1 commit into from
Nov 29, 2024

Conversation

FBruzzesi
Copy link
Member

What type of PR is this? (check all applicable)

  • πŸ’Ύ Refactor
  • ✨ Feature
  • πŸ› Bug Fix
  • πŸ”§ Optimization
  • πŸ“ Documentation
  • βœ… Test
  • 🐳 Other

Related issues

Checklist

  • Code follows style guide (ruff)
  • Tests added
  • Documented the changes

If you have comments or can explain your changes, please do so below

Adds both options in all the documentation examples by using tabs

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Nov 29, 2024
```python
import narwhals.stable.v1 as nw
from narwhals.typing import FrameT
=== "from/to_native"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I called this tab from/to_native everywhere - let's figure out a better title

Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, really like this - just left a really minor comment on types

Comment on lines +231 to +235
from narwhals.typing import DataFrameT


@nw.narwhalify(eager_only=True)
def func(df: nw.DataFrame[Any], s: nw.Series, col_name: str) -> int:
def func(df: DataFrameT, s: nw.Series, col_name: str) -> int:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we be using a TypeVar when it's only used in one place? I think this one might be better staying as nw.DataFrame[Any]?

def my_func(df: nw.DataFrame) -> float | None:
return df["a"].mean()
```
def my_func(df: IntoDataFrameT) -> float | None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment about typevar



@nw.narwhalify(eager_only=True)
def my_func(df: DataFrameT) -> float | None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @FBruzzesi

sorry, updating my verdict on typevars, if mypy doesn't complain then I shouldn't be bothering with commenting on it in reviews

Feel free to merge if you're happy with the "from/to_native" title (personally I think it's good)

@FBruzzesi FBruzzesi merged commit ea1a64f into main Nov 29, 2024
23 of 24 checks passed
@FBruzzesi FBruzzesi deleted the docs/from-to-and-narwhalify branch November 29, 2024 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DOC Maybe have other ways than narwhalify in the tutorial?
2 participants