Skip to content

DOC: rm np import - #4949

Merged
mathause merged 2 commits into
pydata:masterfrom
raybellwaves:patch-2
Feb 25, 2021
Merged

DOC: rm np import#4949
mathause merged 2 commits into
pydata:masterfrom
raybellwaves:patch-2

Conversation

@raybellwaves

Copy link
Copy Markdown
Contributor

No description provided.

Comment threadxarray/core/common.py Outdated

Examples
--------
>>> import xarray as xr

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I had thought we didn't do this by convention (neither for numpy, which is in the line below, contradicting that convention), because it would be everywhere.

Is that the case? I don't have a particularly strong view either way, though we could decide on the convention now.

@keewiskeewisFeb 24, 2021

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

that's what I was thinking, too: technically we don't need any imports of numpy, pandas or xarray:

xarray/conftest.py

Lines 26 to 41 in 351b0aa

@pytest.fixture(autouse=True)
defadd_standard_imports(doctest_namespace, tmpdir):
importnumpyasnp
importpandasaspd
importxarrayasxr
doctest_namespace["np"] =np
doctest_namespace["pd"] =pd
doctest_namespace["xr"] =xr
# always seed numpy.random to make the examples deterministic
np.random.seed(0)
# always switch to the temporary directory, so files get written there
tmpdir.chdir()
so I would lean towards removing all of those. That said, it would probably be good to have some obvious part of the docs (api.rst?) explain that all examples assume these imports.

@raybellwaves

Copy link
Copy Markdown
ContributorAuthor

Thanks for the FYI. Guessed it would go one way or the other.

@raybellwavesraybellwaves changed the title DOC: add xr importDOC: rm np importFeb 25, 2021
@mathause

Copy link
Copy Markdown
Collaborator

I guess that's good to go, then. thanks @raybellwaves

@mathause
mathause merged commit 835a53e into pydata:masterFeb 25, 2021
dcherian added a commit to dcherian/xarray that referenced this pull request Mar 8, 2021
* upstream/master: (46 commits)
pin netCDF4=1.5.3 in min-all-deps (pydata#4982)
fix matplotlib errors for single level discrete colormaps (pydata#4256)
Adapt exception handling in CFTimeIndex.__sub__ and __rsub__ (pydata#5006)
Update options.py (pydata#5000)
Adjust tests to use updated pandas syntax for offsets (pydata#4537)
add a combine_attrs parameter to Dataset.merge (pydata#4895)
Support for dask.graph_manipulation (pydata#4965)
raise on passing axis to Dataset.reduce methods (pydata#4940)
Whatsnew for 0.17.1 (pydata#4963)
Refinements to how-to-release (pydata#4964)
DOC: add example for reindex (pydata#4956)
DOC: rm np import (pydata#4949)
Add 0.17.0 release notes (pydata#4953)
document update as inplace (pydata#4932)
bump the dependencies (pydata#4942)
Upstream CI: limit runtime (pydata#4946)
typing for numpy 1.20 (pydata#4878)
Use definition of DTypeLike from Numpy if found (pydata#4941)
autoupdate mypy (pydata#4943)
Add DataArrayCoarsen.reduce and DatasetCoarsen.reduce methods (pydata#4939)
...
Sign up for freeto 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.

4 participants

@raybellwaves@mathause@max-sixty@keewis