Skip to content
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

Fix building doc following depreciation in Pandas 2.2.0 #8633

Merged
merged 1 commit into from
Jan 21, 2024

Conversation

nameloCmaS
Copy link
Contributor

Fixes
./doc
make html

Following Pandas 2.2.0 release, pd.date_range freq arguments were depreciated.

Question why old releases in doc/whats-new.rst are compiled and not static to avoid breaking changes for old releases.

Error from building doc:

WARNING:
>>>-------------------------------------------------------------------------
Warning in /Users/sam/Documents/GitHub/xarray/doc/whats-new.rst at block ending on line 7231
Specify :okwarning: as an option in the ipython:: block to suppress this message
----------------------------------------------------------------------------
<ipython-input-92-be0529fe0129>:1: FutureWarning: 'M' is deprecated and will be removed in a future version, please use 'ME' instead.
  ds = xray.Dataset({"t": pd.date_range("2000-01-01", periods=12, freq="M")})
<<<-------------------------------------------------------------------------

Exception occurred:
  File "/Users/sam/miniconda3/envs/xarray-docs/lib/python3.10/site-packages/IPython/sphinxext/ipython_directive.py", line 602, in process_input
    raise RuntimeError(
RuntimeError: Unexpected warning in `/Users/sam/Documents/GitHub/xarray/doc/whats-new.rst` line 7231

Copy link

welcome bot commented Jan 21, 2024

Thank you for opening this pull request! It may take us a few days to respond here, so thank you for being patient.
If you have questions, some answers may be found in our contributing guidelines.

@nameloCmaS
Copy link
Contributor Author

There are possibly 81 of these warnings. They will need fixing one day; do we start now? Pandas 2.2.0 release seems to be causing other pull requests to fail, possibly due to this issue also.

sam@R2D3 xarray % conda activate xarray-tests
(xarray-tests) sam@R2D3 xarray % python -m pytest --doctest-modules xarray --ignore xarray/tests -Werror
============================= test session starts ==============================
platform darwin -- Python 3.10.13, pytest-7.4.4, pluggy-1.3.0
rootdir: /Users/sam/Documents/GitHub/xarray
configfile: pyproject.toml
plugins: hypothesis-6.96.2, timeout-2.2.0, env-1.1.3, cov-4.1.0, xdist-3.5.0
collected 302 items                                                            

xarray/backends/api.py .F                                                [  0%]
xarray/backends/common.py ..                                             [  1%]
xarray/coding/cftime_offsets.py .                                        [  1%]
xarray/coding/cftimeindex.py ....                                        [  2%]
xarray/coding/strings.py .                                               [  3%]
xarray/coding/variables.py ..                                            [  3%]
xarray/core/_aggregations.py FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF [ 18%]
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF                                      [ 29%]
xarray/core/accessor_dt.py ..F                                           [ 30%]
xarray/core/accessor_str.py .............................                [ 40%]
xarray/core/alignment.py ..                                              [ 41%]
xarray/core/combine.py ..                                                [ 41%]
xarray/core/common.py OMP: Info #276: omp_set_nested routine deprecated, please use omp_set_max_active_levels instead.
...........                                        [ 45%]
xarray/core/computation.py ......                                        [ 47%]
xarray/core/concat.py .                                                  [ 47%]
xarray/core/coordinates.py ..                                            [ 48%]
xarray/core/dataarray.py ..........F.................................... [ 63%]
.........                                                                [ 66%]
xarray/core/dataset.py .............................................     [ 81%]
xarray/core/extensions.py .                                              [ 82%]
xarray/core/groupby.py .                                                 [ 82%]
xarray/core/indexing.py ...                                              [ 83%]
xarray/core/merge.py .                                                   [ 83%]
xarray/core/options.py .                                                 [ 84%]
xarray/core/parallel.py .                                                [ 84%]
xarray/core/rolling.py ....                                              [ 85%]
xarray/core/rolling_exp.py ......                                        [ 87%]
xarray/core/utils.py .                                                   [ 88%]
xarray/core/variable.py ...                                              [ 89%]
xarray/namedarray/_aggregations.py .............                         [ 93%]
xarray/namedarray/_array_api.py ....                                     [ 94%]
xarray/namedarray/core.py .                                              [ 95%]
xarray/plot/dataarray_plot.py .                                          [ 95%]
xarray/plot/facetgrid.py ..                                              [ 96%]
xarray/plot/utils.py ..........                                          [ 99%]
xarray/testing/strategies.py ss                                          [100%]

=================================== FAILURES ===================================
_________________ [doctest] xarray.backends.api.save_mfdataset _________________
1424     compute : bool
1425         If true compute immediately, otherwise return a
1426         ``dask.delayed.Delayed`` object that can be computed later.
1427 
1428     Examples
1429     --------
1430 
1431     Save a dataset into one netCDF per year of data:
1432 
1433     >>> ds = xr.Dataset(
UNEXPECTED EXCEPTION: FutureWarning("'M' is deprecated and will be removed in a future version, please use 'ME' instead.")

/continues

@max-sixty
Copy link
Collaborator

max-sixty commented Jan 21, 2024

Thanks for fixing that one. Could we add a TODO to the code and link back to this issue?


More generally:

Assuming we can't quickly fix the tests, I would vote to ignore them in the meantime, so we can have the other tests passing. This PR is an example of that approach. That also lowers the urgency on those who work on the cftime part of the package.

@max-sixty max-sixty merged commit a268eaa into pydata:main Jan 21, 2024
16 of 29 checks passed
Copy link

welcome bot commented Jan 21, 2024

Congratulations on completing your first pull request! Welcome to Xarray! We are proud of you, and hope to see you again! celebration gif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants