biocore / biom-format

The Biological Observation Matrix (BIOM) Format Project
http://biom-format.org
Other
89 stars 95 forks source link

pytest, Pandas and NumPy deprecation warnings #912

Closed peterjc closed 1 year ago

peterjc commented 1 year ago

From the current master branch, on macOS, multiple deprecations (cross reference #908 which was just the most obvious one until now):

$ make
...
running pytest
WARNING: Testing via this command is deprecated and will be removed in a future version. Users looking for a generic test entry point independent of test runner are encouraged to use tox.
running egg_info
...
x86_64-apple-darwin13.4.0-clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/xxx/opt/miniconda3/include -fPIC -O2 -isystem /Users/xxx/opt/miniconda3/include -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -isystem /Users/xxx/opt/miniconda3/include -D_FORTIFY_SOURCE=2 -isystem /Users/xxx/opt/miniconda3/include -I/Users/xxx/opt/miniconda3/lib/python3.9/site-packages/numpy/core/include -I/Users/xxx/opt/miniconda3/lib/python3.9/site-packages/numpy/core/include -I/Users/xxx/opt/miniconda3/include/python3.9 -I/Users/xxx/opt/miniconda3/include/python3.9 -c biom/_filter.c -o build/temp.macosx-10.9-x86_64-cpython-39/biom/_filter.o
In file included from biom/_filter.c:768:
In file included from /Users/xxx/opt/miniconda3/lib/python3.9/site-packages/numpy/core/include/numpy/arrayobject.h:5:
In file included from /Users/xxx/opt/miniconda3/lib/python3.9/site-packages/numpy/core/include/numpy/ndarrayobject.h:12:
In file included from /Users/xxx/opt/miniconda3/lib/python3.9/site-packages/numpy/core/include/numpy/ndarraytypes.h:1940:
/Users/xxx/opt/miniconda3/lib/python3.9/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: "Using deprecated NumPy API, disable it with "          "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
#warning "Using deprecated NumPy API, disable it with " \
 ^
1 warning generated.
...
=============================================== warnings summary ================================================
biom/tests/test_table.py:19
  /Users/xxx/repositories/biom-format/biom/tests/test_table.py:19: FutureWarning: pandas.util.testing is deprecated. Use the functions in the public API at pandas.testing instead.
    import pandas.util.testing as pdt

biom/tests/test_table.py::SupportTests::test_remove_empty_both
biom/tests/test_table.py::SupportTests::test_remove_empty_obs
biom/tests/test_table.py::SupportTests::test_remove_empty_sample
  /Users/xxx/opt/miniconda3/lib/python3.9/site-packages/scipy/sparse/_index.py:146: SparseEfficiencyWarning: Changing the sparsity structure of a csr_matrix is expensive. lil_matrix is more efficient.
    self._set_arrayXarray(i, j, x)

biom/tests/test_table.py::TableTests::test_from_hdf5_observation_subset
biom/tests/test_table.py::TableTests::test_from_hdf5_sample_subset
biom/tests/test_cli/test_subset_table.py::TestSubsetTable::test_subset_observations_hdf5
biom/tests/test_cli/test_subset_table.py::TestSubsetTable::test_subset_samples_hdf5
  /Users/xxx/repositories/biom-format/biom/table.py:4213: FutureWarning: arrays to stack must be passed as a "sequence" type such as list or tuple. Support for non-sequence iterables such as generators is deprecated as of NumPy 1.16 and will raise an error in the future.
    data = np.hstack(h5_data[start:end]

biom/tests/test_table.py::TableTests::test_from_hdf5_observation_subset
biom/tests/test_table.py::TableTests::test_from_hdf5_sample_subset
biom/tests/test_cli/test_subset_table.py::TestSubsetTable::test_subset_observations_hdf5
biom/tests/test_cli/test_subset_table.py::TestSubsetTable::test_subset_samples_hdf5
  /Users/xxx/repositories/biom-format/biom/table.py:4215: FutureWarning: arrays to stack must be passed as a "sequence" type such as list or tuple. Support for non-sequence iterables such as generators is deprecated as of NumPy 1.16 and will raise an error in the future.
    indices = np.hstack(h5_indices[start:end]
...

I'm assuming the SparseEfficiencyWarning is harmless (and perhaps expected), in which case it would be nice to silence this explicitly in the test.

(Edited to mask username)

wasade commented 1 year ago

Thanks, @peterjc! Aggregating this is very helpful