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: Pre-compute plugin_path before defining plugin #18503

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docs/user-guide/expressions/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,12 @@ import polars as pl
from polars.plugins import register_plugin_function
from polars._typing import IntoExpr

PLUGIN_PATH = Path(__file__).parent

def pig_latinnify(expr: IntoExpr) -> pl.Expr:
"""Pig-latinnify expression."""
return register_plugin_function(
plugin_path=Path(__file__).parent,
plugin_path=PLUGIN_PATH,
function_name="pig_latinnify",
args=expr,
is_elementwise=True,
Expand Down Expand Up @@ -190,7 +191,7 @@ def append_args(
This example shows how arguments other than `Series` can be used.
"""
return register_plugin_function(
plugin_path=Path(__file__).parent,
plugin_path=PLUGIN_PATH,
function_name="append_kwargs",
args=expr,
kwargs={
Expand Down
2 changes: 1 addition & 1 deletion py-polars/polars/series/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def kde(
**kwargs: Unpack[EncodeKwds],
) -> alt.Chart:
"""
Draw kernel dentity estimate plot.
Draw kernel density estimate plot.

Polars does not implement plotting logic itself but instead defers to
`Altair <https://altair-viz.github.io/>`_.
Expand Down