Ouranosinc / xclim

Library of derived climate variables, ie climate indicators, based on xarray.
https://xclim.readthedocs.io/en/stable/
Apache License 2.0
332 stars 59 forks source link

unpin pandas<1.3 #794

Closed raybellwaves closed 3 years ago

raybellwaves commented 3 years ago

Description

I bumped my conda environment today and I realised my pandas version got downgraded. From running mamba repoquery whoneeds pandas I noticed it's pinned to <1.3 https://github.com/Ouranosinc/xclim/blob/master/setup.py#L26 in this repo.

I had a quick look in the issue tracker and couldn't find any issues on this so wanted to raise this here. There may be good reason why it's pinned. Happy to help work on unpinning it if it's desired.

raybellwaves commented 3 years ago

found a PR related to this: https://github.com/Ouranosinc/xclim/pull/763

raybellwaves commented 3 years ago

pytest --nbval docs/notebooks passed with latest pandas pytest --rootdir=xclim/testing/tests --xdoctest xcli gives one failure (https://github.com/Ouranosinc/xclim/blob/master/xclim/testing/tests/test_calendar.py#L57)

FAILED xclim/testing/tests/core/calendar.py::time_bnds:0

Ran pytest --rootdir=xclim/testing/tests --xdoctest xclim --pdb and see

❯ pytest --rootdir=xclim/testing/tests --xdoctest xclim --pdb
==================================================== test session starts =====================================================
platform darwin -- Python 3.9.6, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 -- /Users/ray/miniconda3/envs/xclim/bin/python
cachedir: .pytest_cache
rootdir: /Users/ray/Documents/PYTHON_dev/xclim/xclim/testing/tests, configfile: ../../../setup.cfg
plugins: cov-2.12.1, xdoctest-0.15.6, nbval-0.9.6
collected 1167 items

xclim/testing/tests/core/bootstrapping.py::percentile_bootstrap:0 PASSED                                               [  0%]
xclim/testing/tests/core/calendar.py::time_bnds:0 FAILED                                                               [  0%]
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> traceback >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
* REASON: GotWantException
DOCTEST DEBUG INFO
  XDoc "/Users/ray/Documents/PYTHON_dev/xclim/xclim/core/calendar.py::time_bnds:0", line 5 <- wrt doctest
  File "/Users/ray/Documents/PYTHON_dev/xclim/xclim/core/calendar.py", line 806, <- wrt source file
DOCTEST PART BREAKDOWN
Passed Parts:
    1 >>> from xarray import cftime_range
    2 >>> from xclim.core.calendar import time_bnds
    3 >>> index = cftime_range(start='2000-01-01', periods=3, freq='2QS', calendar='360_day')
Failed Part:
    4 >>> time_bnds(index, '2Q')
DOCTEST TRACEBACK
Expected:
    ((cftime.Datetime360Day(2000, 1, 1, 0, 0, 0, 0), cftime.Datetime360Day(2000, 3, 30, 23, 59, 59, 999999)),
    (cftime.Datetime360Day(2000, 7, 1, 0, 0, 0, 0), cftime.Datetime360Day(2000, 9, 30, 23, 59, 59, 999999)),
    (cftime.Datetime360Day(2001, 1, 1, 0, 0, 0, 0), cftime.Datetime360Day(2001, 3, 30, 23, 59, 59, 999999)))
Got:
    ((cftime.Datetime360Day(2000, 1, 1, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(2000, 3, 30, 23, 59, 59, 999999, has_year_zero=False)), (cftime.Datetime360Day(2000, 7, 1, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(2000, 9, 30, 23, 59, 59, 999999, has_year_zero=False)), (cftime.Datetime360Day(2001, 1, 1, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(2001, 3, 30, 23, 59, 59, 999999, has_year_zero=False)))
Repr Difference:
    got  = '((cftime.Datetime360Day(2000, 1, 1, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(2000, 3, 30, 23, 59, 59, 999999, has_year_zero=False)), (cftime.Datetime360Day(2000, 7, 1, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(2000, 9, 30, 23, 59, 59, 999999, has_year_zero=False)), (cftime.Datetime360Day(2001, 1, 1, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(2001, 3, 30, 23, 59, 59, 999999, has_year_zero=False)))'
    want = '((cftime.Datetime360Day(2000, 1, 1, 0, 0, 0, 0), cftime.Datetime360Day(2000, 3, 30, 23, 59, 59, 999999)),\n(cftime.Datetime360Day(2000, 7, 1, 0, 0, 0, 0), cftime.Datetime360Day(2000, 9, 30, 23, 59, 59, 999999)),\n(cftime.Datetime360Day(2001, 1, 1, 0, 0, 0, 0), cftime.Datetime360Day(2001, 3, 30, 23, 59, 59, 999999)))'
DOCTEST REPRODUCTION
CommandLine:
    pytest /Users/ray/Documents/PYTHON_dev/xclim/xclim/core/calendar.py::time_bnds:0
/Users/ray/Documents/PYTHON_dev/xclim/xclim/core/calendar.py:806: GotWantException
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> entering PDB >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PDB post_mortem (IO-capturing turned off) >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> /Users/ray/miniconda3/envs/xclim/lib/python3.9/site-packages/xdoctest/checker.py(109)check_got_vs_want()
-> raise ex
aulemahal commented 3 years ago

Hi @raybellwaves ! Indeed, I am not sure the pandas pin is still necessary. The error you spotted is due to an update of cftime, and I am surprised it didn't show up elsewhere before... I'll try to unpin and fix that in a PR soon.

aulemahal commented 3 years ago

For the info : The pandas failure was fixed in xarray 0.19, which came out a month ago. (https://github.com/pydata/xarray/pull/5359)