-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Improve warnings: use color and sane defaults #4780
Conversation
@tmbo Who is taking this over? |
Can you please take that over as a squad? I think it is unrealistic to set the warnings filter to
|
You mean as production squad? ok |
should have assigned me, sorry for the confusion |
@@ -722,9 +713,6 @@ def keys(self) -> Iterable[Text]: | |||
def retrieve(self, sender_id: Text) -> Optional[DialogueStateTracker]: | |||
"""Create a tracker from all previously stored events.""" | |||
|
|||
import sqlalchemy as sa |
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.
check if this import is needed
intent_keyword_map = None | ||
return cls(meta, intent_keyword_map) | ||
else: | ||
raise Exception( |
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.
converted this to an exception to stay in line with other components
@@ -108,7 +110,12 @@ def train( | |||
|
|||
self.clf = self._create_classifier(num_threads, y) | |||
|
|||
self.clf.fit(X, y) | |||
with warnings.catch_warnings(): |
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.
ignore sklearn warnings
@@ -140,6 +147,7 @@ def _create_classifier( | |||
cv=cv_splits, | |||
scoring=self.component_config["scoring_function"], | |||
verbose=1, | |||
iid=False, |
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.
prevents deprecation warning
@@ -295,3 +299,47 @@ def _lazyprop(self): | |||
return getattr(self, attr_name) | |||
|
|||
return _lazyprop | |||
|
|||
|
|||
def raise_warning( |
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.
implementation for raise_warning
@@ -13,6 +13,7 @@ codestyle_exclude = | |||
rasa/core/policies/__init__.py | |||
filterwarnings = | |||
ignore::ResourceWarning:ruamel[.*] | |||
#error |
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.
this should be activated later on to fail on warnings, doesn't work yet though
|
||
|
||
def test_print_error_and_exit(): | ||
with pytest.raises(SystemExit): | ||
rasa.cli.utils.print_error_and_exit("") | ||
|
||
|
||
def test_logging_capture(caplog: LogCaptureFixture): |
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.
tests removed since that function (assert_log_emitted
) isn't used anywhere
This is ready for review and should go into the 1.7 release (cc @federicotdn). @degiz can you please give this a review? it looks like a lot of changes but most of them are import reorg (thought about adding isort to prevent this from happening, but different story). I've commented on the lines where I did more than just rename |
(@degiz ideally today or early tomorrow so that we can get it into the release - let me know if you have to much on your plate) |
@@ -18,7 +18,7 @@ slots: | |||
name: | |||
type: text | |||
|
|||
templates: | |||
responses: |
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.
leftover from an earlier rename (created a warning that it is deprecated, that is why I changed it)
211226e
to
5a60ea5
Compare
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've left few comments, but non of them is critical. So you can merge it the PR is urgent to get in.
warnings.warn( | ||
"Continue training will be removed in the next release. It won't be " | ||
raise_warning( | ||
"Continue training will be removed in the 2.0 release. It won't be " |
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.
optional: maybe it makes sense to mark the function as deprecated? is it exposed to the users?
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.
mhm not sure what you mean, there isn't a @Deprecated
like in java 😅
pytest has introduced coloured test summaries with we could upgrade to latest v 5.3.4 |
Co-Authored-By: Alexander Khizov <degiz@users.noreply.github.com>
Co-Authored-By: Alexander Khizov <degiz@users.noreply.github.com>
Co-Authored-By: Alexander Khizov <degiz@users.noreply.github.com>
Co-Authored-By: Alexander Khizov <degiz@users.noreply.github.com>
@ricwo that sounds great we should def do that, but would do that after the release 👍 |
Proposed changes:
Status (please check what you already did):
black
(please check Readme for instructions)