-
Notifications
You must be signed in to change notification settings - Fork 8
refactor: Prepare nullable column by default #31
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?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #31 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 36 38 +2
Lines 1788 1849 +61
=========================================
+ Hits 1788 1849 +61 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
I think most of the tests would be fine with nullable=False, so adding the new value there now will mean removal again soon (and it's a lot of lines). I would propose to add import os
import warnings
from collections.abc import Callable
from functools import wraps
TRUTHY_VALUES = ["1", "true"]
def skip_if(env: str) -> Callable:
"""Decorator to skip warnings based on environment variable.
If the environment variable is equivalent to any of TRUTHY_VALUES, the wrapped
function is skipped.
"""
def decorator(fun: Callable) -> Callable:
@wraps(fun)
def wrapper() -> None:
should_skip = os.getenv(env, "").lower() in TRUTHY_VALUES
if should_skip:
return
fun()
return wrapper
return decorator
@skip_if(env="DATAFRAMELY_IGNORE_NULLABLE_DEFAULT")
def warn_nullable_default_change() -> None:
# the actual warning goes here and then we can import
WDYT? |
I don't know, I have no strong feeling, but more i think about it more I think that we should go for the simplest solution: Ignoring the warning in the test from the |
I'm in favor of @AndreasAlbertQC's suggestion as I think it's a nice pattern for future deprecations and it's easy to implement and control. |
@@ -83,6 +83,7 @@ module = ["pyarrow.*"] | |||
addopts = "--import-mode=importlib" | |||
filterwarnings = [ | |||
"ignore:datetime.datetime.utcfromtimestamp\\(\\) is deprecated.*:DeprecationWarning", | |||
"ignore:The 'nullable' argument was not explicitly set.*:FutureWarning", |
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.
I don't want our tests to generate warnings. I know this is a bit of work and please let us know if we can support this effort but we should adapt all of our tests 😅
Motivation
towards #20
Changes
Changing to
nullable=False
by default would be a breaking change. For now, this setnullable
to None and warn if nullable is not explicitly set.Question, how to handle warning in tests, should I ignore them ? should I explicitly set nullable=True, nullable=False everywhere ?