Skip to content

Commit

Permalink
Ignore pandas pyarrow warning (napari#6609)
Browse files Browse the repository at this point in the history
# Description

The napari#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]>
  • Loading branch information
3 people authored Jan 22, 2024
1 parent 0f85200 commit 41dcb89
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion napari/layers/utils/layer_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,7 @@ def set_currents(
self._defaults = _validate_features(currents, num_data=1)
if update_indices is not None:
for k in self._defaults:
self._values[k][update_indices] = self._defaults[k][0]
self._values.loc[update_indices, k] = self._defaults[k][0]

def resize(
self,
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ filterwarnings = [
"ignore:Alternative shading modes are only available in 3D, defaulting to none",
"ignore:distutils Version classes are deprecated::",
"ignore:There is no current event loop:DeprecationWarning:",
"ignore:(?s).*Pyarrow will become a required dependency of pandas:DeprecationWarning", # pandas pyarrow (pandas<3.0),
]
markers = [
"examples: Test of examples",
Expand Down
2 changes: 1 addition & 1 deletion resources/constraints/constraints_py3.10.txt
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ packaging==23.2
# superqt
# vispy
# xarray
pandas==2.1.4 ; python_version >= "3.9"
pandas==2.2.0 ; python_version >= "3.9"
# via
# napari (napari_repo/setup.cfg)
# xarray
Expand Down
2 changes: 1 addition & 1 deletion resources/constraints/constraints_py3.10_docs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ packaging==23.2
# superqt
# vispy
# xarray
pandas==2.1.4 ; python_version >= "3.9"
pandas==2.2.0 ; python_version >= "3.9"
# via
# napari (napari_repo/setup.cfg)
# nilearn
Expand Down
2 changes: 1 addition & 1 deletion resources/constraints/constraints_py3.10_pydantic_1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ packaging==23.2
# superqt
# vispy
# xarray
pandas==2.1.4 ; python_version >= "3.9"
pandas==2.2.0 ; python_version >= "3.9"
# via
# napari (napari_repo/setup.cfg)
# xarray
Expand Down
2 changes: 1 addition & 1 deletion resources/constraints/constraints_py3.11.txt
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ packaging==23.2
# superqt
# vispy
# xarray
pandas==2.1.4 ; python_version >= "3.9"
pandas==2.2.0 ; python_version >= "3.9"
# via
# napari (napari_repo/setup.cfg)
# xarray
Expand Down
2 changes: 1 addition & 1 deletion resources/constraints/constraints_py3.11_pydantic_1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ packaging==23.2
# superqt
# vispy
# xarray
pandas==2.1.4 ; python_version >= "3.9"
pandas==2.2.0 ; python_version >= "3.9"
# via
# napari (napari_repo/setup.cfg)
# xarray
Expand Down
2 changes: 1 addition & 1 deletion resources/constraints/constraints_py3.9.txt
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ packaging==23.2
# superqt
# vispy
# xarray
pandas==2.1.4 ; python_version >= "3.9"
pandas==2.2.0 ; python_version >= "3.9"
# via
# napari (napari_repo/setup.cfg)
# xarray
Expand Down
2 changes: 1 addition & 1 deletion resources/constraints/constraints_py3.9_examples.txt
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ packaging==23.2
# superqt
# vispy
# xarray
pandas==2.1.4 ; python_version >= "3.9"
pandas==2.2.0 ; python_version >= "3.9"
# via
# napari (napari_repo/setup.cfg)
# nilearn
Expand Down
2 changes: 1 addition & 1 deletion resources/constraints/constraints_py3.9_pydantic_1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ packaging==23.2
# superqt
# vispy
# xarray
pandas==2.1.4 ; python_version >= "3.9"
pandas==2.2.0 ; python_version >= "3.9"
# via
# napari (napari_repo/setup.cfg)
# xarray
Expand Down

0 comments on commit 41dcb89

Please sign in to comment.