Skip to content

Remove enter on begin of warnign message #57003

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

Closed
wants to merge 2 commits into from

Conversation

Czaki
Copy link

@Czaki Czaki commented Jan 22, 2024

Closes #57082

With current code, it is not possible to filter pandas warning about PyArrow that leads to crash of test suite with the rule to treat warning as error.

It looks like the source of the problem is that warnigns library compile pattern with only IgnoreCase flag.

https://github.com/python/cpython/blob/d1b031cc58516e1aba823fd613528417a996f50d/Lib/warnings.py#L160

And then is using match instead of search so it matches to initial line.

With this change, it this warning will be possible to ignore this using:

"ignore:Pyarrow will become a required dependency of pandas in the next major release of pandas.*:DeprecationWarning"

In napari we meet it here: napari/napari#6609

cPython issue about problem with empty line python/cpython#114426

@Czaki
Copy link
Author

Czaki commented Jan 22, 2024

Numpy failure looks unrelated

Czaki added a commit to napari/napari that referenced this pull request Jan 22, 2024
# Description

The #6608 shows that new pandas warning crash our tests. 
```
  /tmp/.tox/py39-linux-pyqt5/lib/python3.9/site-packages/_pytest/assertion/rewrite.py:186: in exec_module
      exec(co, module.__dict__)
  napari/layers/base/base.py:28: in <module>
      from napari.layers.utils.layer_utils import (
  <frozen importlib._bootstrap>:1007: in _find_and_load
      ???
  <frozen importlib._bootstrap>:986: in _find_and_load_unlocked
      ???
  <frozen importlib._bootstrap>:680: in _load_unlocked
      ???
  /tmp/.tox/py39-linux-pyqt5/lib/python3.9/site-packages/_pytest/assertion/rewrite.py:186: in exec_module
      exec(co, module.__dict__)
  napari/layers/utils/layer_utils.py:10: in <module>
      import pandas as pd
  /tmp/.tox/py39-linux-pyqt5/lib/python3.9/site-packages/pandas/__init__.py:221: in <module>
      warnings.warn(
  E   DeprecationWarning: 
  E   Pyarrow will become a required dependency of pandas in the next major release of pandas (pandas 3.0),
  E   (to allow more performant data types, such as the Arrow string type, and better interoperability with other libraries)
  E   but was not found to be installed on your system.
  E   If this would cause problems for you,
  E   please provide us feedback at pandas-dev/pandas#54466
```

This PR adds filter warnings to prevent this failure. Because warnings
start with an empty line, this fix is fragile and heavily depends on the
order of imports.

Pull request to fix warning message in pandas 
pandas-dev/pandas#57003

cPython issue:
python/cpython#114426

This PR also fixes usage of chained assignment.

---------

Co-authored-by: Peter Sobolewski <[email protected]>
Co-authored-by: Lorenzo Gaifas <[email protected]>
Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm @lithomas1

@WillAyd WillAyd added this to the 2.2.1 milestone Jan 22, 2024
Czaki added a commit to napari/napari that referenced this pull request Jan 23, 2024
# Description

The #6608 shows that new pandas warning crash our tests. 
```
  /tmp/.tox/py39-linux-pyqt5/lib/python3.9/site-packages/_pytest/assertion/rewrite.py:186: in exec_module
      exec(co, module.__dict__)
  napari/layers/base/base.py:28: in <module>
      from napari.layers.utils.layer_utils import (
  <frozen importlib._bootstrap>:1007: in _find_and_load
      ???
  <frozen importlib._bootstrap>:986: in _find_and_load_unlocked
      ???
  <frozen importlib._bootstrap>:680: in _load_unlocked
      ???
  /tmp/.tox/py39-linux-pyqt5/lib/python3.9/site-packages/_pytest/assertion/rewrite.py:186: in exec_module
      exec(co, module.__dict__)
  napari/layers/utils/layer_utils.py:10: in <module>
      import pandas as pd
  /tmp/.tox/py39-linux-pyqt5/lib/python3.9/site-packages/pandas/__init__.py:221: in <module>
      warnings.warn(
  E   DeprecationWarning: 
  E   Pyarrow will become a required dependency of pandas in the next major release of pandas (pandas 3.0),
  E   (to allow more performant data types, such as the Arrow string type, and better interoperability with other libraries)
  E   but was not found to be installed on your system.
  E   If this would cause problems for you,
  E   please provide us feedback at pandas-dev/pandas#54466
```

This PR adds filter warnings to prevent this failure. Because warnings
start with an empty line, this fix is fragile and heavily depends on the
order of imports.

Pull request to fix warning message in pandas 
pandas-dev/pandas#57003

cPython issue:
python/cpython#114426

This PR also fixes usage of chained assignment.

---------

Co-authored-by: Peter Sobolewski <[email protected]>
Co-authored-by: Lorenzo Gaifas <[email protected]>
@rhshadrach rhshadrach added Deprecate Functionality to remove in pandas Arrow pyarrow functionality labels Jan 26, 2024
@lithomas1
Copy link
Member

Let's hold on this for now, since we might just revert the deprecation entirely for 2.2.1.

@mimizone
Copy link

mimizone commented Feb 9, 2024

Please consider my comment for the PR, thanks.
#57082 (comment)

@simonjayhawkins simonjayhawkins added the Warnings Warnings that appear or should be added to pandas label Feb 9, 2024
robomics added a commit to paulsengroup/hictkpy that referenced this pull request Feb 11, 2024
Pandas 2.2.0 raises an annoying warning upon import that
cannot be ignored when running pytest.
See pandas-dev/pandas#57003
@mroeschke
Copy link
Member

Thanks for the start here but the warning ended up getting removed in #57556 so closing

@mroeschke mroeschke closed this Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arrow pyarrow functionality Deprecate Functionality to remove in pandas Warnings Warnings that appear or should be added to pandas
Projects
None yet
7 participants