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

Add warning for experimental functionality #12432

Closed
stinodego opened this issue Nov 14, 2023 · 1 comment · Fixed by #13948
Closed

Add warning for experimental functionality #12432

stinodego opened this issue Nov 14, 2023 · 1 comment · Fixed by #13948
Assignees
Labels
accepted Ready for implementation enhancement New feature or an improvement of an existing feature python Related to Python Polars
Milestone

Comments

@stinodego
Copy link
Member

stinodego commented Nov 14, 2023

With 1.0.0 around the corner, we want to more officially indicate experimental functionality. Right now, it's just a comment in the docstring. This is not sufficient.

Definition

If functionality is considered experimental, this means:

  • It may not work exactly the way you would expect it to.
  • The API or implementation may change without it being considered a breaking change.

Examples

  • The Decimal data type works in some parts of our API, but it is largely unimplemented (e.g. arithmetic). It may be fine to use in specific contexts, but is not yet as reliable as other numeric types.
  • The LazyFrame.collect(streaming=True) works and will produce correct results, but it may not fully operate in streaming fashion and consume more memory than expected.

The extent to which functionality is experimental will differ. We can elaborate in the docstring when warranted.

Proposal

  • Users will get a PolarsExperimentalWarning when using experimental functionality.
  • This warning can be turned off globally in the Polars config by setting Config.set_experimental_warning(False).
  • Affected classes/functions/parameters get a warning admonition in the docstring.

Implementation

  • We add a decorator on classes/functions that are considered experimental. This decorator automatically inserts the warning and dynamically updates the docstring.

Comments welcome - especially looking for better names for the Warning / Config setting.

@stinodego stinodego added python Related to Python Polars enhancement New feature or an improvement of an existing feature accepted Ready for implementation labels Nov 14, 2023
@stinodego stinodego added this to the 1.0.0 milestone Nov 14, 2023
@stinodego stinodego self-assigned this Nov 16, 2023
@jmakov
Copy link

jmakov commented Dec 15, 2023

If streaming=True and streaming isn't supported, it would be great to get that info in the warning e.g.

  • streaming not supported at all for the streaming source: PolarsExperimentalWarning("Streaming not yet supported for source 'scan_arrow_dataset'")
  • query can be only partially streamed: PolarsExperimentalWarning("This query can be only partially streamed")
  • no warning if the query can be fully streamed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Ready for implementation enhancement New feature or an improvement of an existing feature python Related to Python Polars
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants