-
Notifications
You must be signed in to change notification settings - Fork 20
feat: add Polars support with version-locked dependencies #164
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
base: main
Are you sure you want to change the base?
Changes from all commits
b452c97
75f34fa
55da70d
7932b36
d0a60d8
12dfd34
a65adcd
866d019
d73cc2a
6936efc
0b79e21
67a628b
9b78e6b
703131d
01dd876
03190d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,3 +11,7 @@ docs/generated | |
| docs/gallery_scripts | ||
| docs/_build | ||
| .DS_Store | ||
| venv/ | ||
| .venv/ | ||
| _build/ | ||
| tmpclaude-c0db-cwd | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,7 +1,7 @@ | ||||||
| """ | ||||||
| init | ||||||
| """ | ||||||
|
|
||||||
| from . import _polars_accessor # Import for side effects: registers pandas accessors. noqa: F401 | ||||||
|
||||||
| from . import _polars_accessor # Import for side effects: registers pandas accessors. noqa: F401 | |
| from . import _polars_accessor # Import for side effects: registers Polars namespace accessor. # noqa: F401 |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,30 @@ | ||||||||||
| """ | ||||||||||
| Polars namespace extension for pyopenms_viz. | ||||||||||
| """ | ||||||||||
| try: | ||||||||||
| import polars as pl | ||||||||||
| POLARS_AVAILABLE = True | ||||||||||
| except ImportError: | ||||||||||
| POLARS_AVAILABLE = False | ||||||||||
|
|
||||||||||
| if POLARS_AVAILABLE: | ||||||||||
| @pl.api.register_dataframe_namespace("ms_plot") | ||||||||||
| class PolarsPlotAccessor: | ||||||||||
| def __init__(self, df: pl.DataFrame): | ||||||||||
| self._df = df | ||||||||||
|
|
||||||||||
| def __call__(self, *args, **kwargs): | ||||||||||
| try: | ||||||||||
| # 1. Safety Catch: Use Arrow-backed arrays with a clear error fallback | ||||||||||
| pandas_df = self._df.to_pandas(use_pyarrow_extension_array=True) | ||||||||||
|
Comment on lines
+18
to
+19
|
||||||||||
| # 1. Safety Catch: Use Arrow-backed arrays with a clear error fallback | |
| pandas_df = self._df.to_pandas(use_pyarrow_extension_array=True) | |
| # 1. Safety Catch: Convert to a pandas DataFrame using default dtypes | |
| pandas_df = self._df.to_pandas() |
Copilot
AI
Mar 12, 2026
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.
New Polars plotting entrypoint is introduced here, but there are no tests covering that the ms_plot namespace is registered and that calling it produces the same output as the pandas path (including respecting pd.options.plotting.backend and/or backend='ms_*'). Adding a small pytest covering the conversion + delegation behavior would prevent regressions.
Uh oh!
There was an error while loading. Please reload this page.