-
Notifications
You must be signed in to change notification settings - Fork 136
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
fix: sqlframe false positives in compliance checks #2011
fix: sqlframe false positives in compliance checks #2011
Conversation
tests/translate/from_native_test.py
Outdated
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.
@MarcoGorelli for the coverage is there a preference among
- Add
sqlframe
to the pytest GitHub CI - Remove this test
pragma: nocover
the tests
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.
Just FYI, I am taking a look for how to fully support sqlframe - it's still missing a few features (not many) to pass all our tests. I would say that for now it's ok to pragma: no cover
it
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.
definitely interested in testing sqlframe in CI, last time i checked it was too far to being passing - but they've resolved a lot of issues recently, so if we can run them in ci now then that would be great
else for now we can no cover
the test
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 @camriddell π Left a couple of suggestion and (maybe) addressed your question
tests/translate/from_native_test.py
Outdated
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.
Just FYI, I am taking a look for how to fully support sqlframe - it's still missing a few features (not many) to pass all our tests. I would say that for now it's ok to pragma: no cover
it
narwhals/translate.py
Outdated
@@ -765,6 +741,30 @@ def _from_native_impl( # noqa: PLR0915 | |||
level="lazy", | |||
) | |||
|
|||
# SQLFrame | |||
# This one needs checking before extensions as `hasattr` always returns `True`. |
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.
not applicable anymore π
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.
pending on #2011 (comment) π |
failing downstream tests seem to be unrelated. I know that |
Cool thanks! pointblank also just merged a new feature, we can update its dependency on another PR |
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
In the
narwhals.from_native
function,sqlframe
had to be explicitly checked before theis_compliant*
checks due to false positives fromhasattr(sqlframe_df, "__narwhals_dataframe__")
.Instead we can use
inspect.getattr_static
(thanks for the suggestion @dangotbanned) to avoid this addition and we can move thesqlframe
specific code to be in line with the other backends.I also added a test to ensure
sqlframe
cases are handled properly.I removed a test that will break in the future, this test was passing due to a side effect caused by
hasattr
on apandas
DataFrame enabling the use of nonhashable values as column names (raised as an issue in pandas BUG:Index.drop_duplicates()
is inconsistent for unhashable valuesΒ pandas-dev/pandas#60925)