Skip to content

Require NumPy 1.18+ & Pandas 1.0+ - #7939

Merged
jrbourbeau merged 16 commits into
dask:mainfrom
jakirkham:req_np17_pd1
Jul 30, 2021
Merged

jrbourbeau merged 16 commits into
dask:mainfrom
jakirkham:req_np17_pd1

Conversation

@jakirkham

@jakirkham jakirkham commented Jul 26, 2021 •

Copy link
Copy Markdown
Member

Following up on the discussion in issue ( #7378 ), this bumps the minimums to NumPy 1.18+ and Pandas 1.0+.

  • Closes #xxxx
  • Tests added / passed
  • Passes black dask / flake8 dask / isort dask

@jrbourbeau jrbourbeau left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @jakirkham!

Comment thread setup.py Resolved
@jakirkham jakirkham changed the title Require NumPy 1.17+ & Pandas 1.0+ Require NumPy 1.18+ & Pandas 1.0+ Jul 26, 2021
Comment thread setup.py Resolved
@jakirkham

Copy link
Copy Markdown
Member Author

cc @jsignell @pentschev (in case either of you have thoughts here)

@jakirkham
jakirkham force-pushed the req_np17_pd1 branch 5 times, most recently from 22e3531 to 0698898 Compare July 26, 2021 19:48
@jakirkham

Copy link
Copy Markdown
Member Author

Have dropped a bunch of compatibility code. Please let me know if I missed any 🙂

@github-actions github-actions Bot added dispatch Related to `Dispatch` extension objects io labels Jul 26, 2021
Comment thread dask/dataframe/rolling.py
Comment on lines 402 to 407
if has_keyword(meta.apply, "engine"):
# PANDAS_GT_100
compat_kwargs = dict(engine=engine, engine_kwargs=engine_kwargs)
elif engine != "cython" or engine_kwargs is not None:
raise NotImplementedError(
f"Specifying the engine requires pandas>=1.0.0. Version '{PANDAS_VERSION}' installed."
)
if raw is None:
# PANDAS_GT_100: The default changed from None to False
raw = inspect.signature(meta.apply).parameters["raw"]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Looks like the middle branch can be dropped. Not sure if there are other things needed to cleanup this code

@jrbourbeau jrbourbeau left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Similar to the other conda environment files you already updated, we'll need to update our array/dataframe minimum dependencies environment here:

# optional dependencies pulled in by pip install dask[array, dataframe]
- numpy=1.16
- pandas=0.25.0

@jakirkham
jakirkham force-pushed the req_np17_pd1 branch 4 times, most recently from 36d4aab to d4f3d5d Compare July 26, 2021 22:27
Comment on lines 180 to 186
# Regression test for __array_function__ becoming default in numpy 1.17
# dask has no sort function, so ensure that this still calls np.sort
x = da.from_array(np.array([1, 2, 4, 3]), chunks=(2,))
if IS_NEP18_ACTIVE:
with pytest.warns(
FutureWarning, match="The `numpy.sort` function is not implemented by Dask"
):
assert list(np.sort(x)) == [1, 2, 3, 4]
else:
with pytest.warns(
FutureWarning, match="The `numpy.sort` function is not implemented by Dask"
):
assert list(np.sort(x)) == [1, 2, 3, 4]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Left the comment above in and kept the test as these seem to still make sense. Though please let me know if not

@jrbourbeau

Copy link
Copy Markdown
Member

Just wanted to note that the documentation build failure is totally unrelated to the changes here and is being addressed over in #7943

@jrbourbeau

Copy link
Copy Markdown
Member

Taking a look now. Would you mind merging main to resolve the documentation build failure?

@jakirkham

Copy link
Copy Markdown
Member Author

Taking a look now.

Thanks James! 😄

Would you mind merging main to resolve the documentation build failure?

Right forgot about that. Have now merged it in 🙂

@jrbourbeau jrbourbeau left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for handling all this @jakirkham! Overall these changes look good. I do have a question about whether we should keep the existing IS_NEP18_ACTIVE logic or not

Comment thread dask/array/utils.py Resolved
Comment thread dask/dataframe/_compat.py Resolved
Comment thread docs/source/install.rst Resolved
Comment thread setup.py Resolved
@jakirkham

Copy link
Copy Markdown
Member Author

Thanks James! 😄

Included a few changes that should address those concerns. Had some more thoughts on the environment variable

@jrbourbeau jrbourbeau left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The only lingering topic here is whether or not we're okay bumping our minimum pyarrow version to 1.0. Generally folks seem on board with this, so I'll suggest we move forward with the minimum version bump. I think the only things left to do are:

  1. Updating our minimum listed pyarrow version to 1.0 in docs/source/install.rst
  2. Remove the corresponding pyarrow compatibility code. Grepping for _pa_version, pa.__version__, pyarrow <, and pyarrow > revealed a few lines we can remove

@jakirkham

Copy link
Copy Markdown
Member Author

Sounds good James. Have pushed those changes. There was one check for pyarrow 1.0.1, which I left in, but the rest should be removed. Please let me know if there's anything else

@jakirkham
jakirkham requested a review from jrbourbeau July 29, 2021 18:06

@jrbourbeau jrbourbeau left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for all your work on this @jakirkham! This looks good to merge

There were some surprising test failures that looked totally unrelated to the changes here, so I pushed an empty commit to rerun CI. Will merge if CI passes

@jakirkham

Copy link
Copy Markdown
Member Author

Given it sounds like we are doing a hot-fix release ( dask/community#173 ) do we want to merge this after that?

@jrbourbeau

Copy link
Copy Markdown
Member

Ha, I had the opposite thought about when to merge this PR relative to the release (dask/community#173 (comment)). It's probably not a big deal either way, happy to merge this after the release 👍

@jakirkham

Copy link
Copy Markdown
Member Author

Yeah was just thinking of the user that needs the bug fix, but isn't quite ready to upgrade yet. Though Idk if it matters much, they will still need to upgrade at some point :)

IOW ok either way

@jrbourbeau jrbourbeau changed the title Require NumPy 1.18+ & Pandas 1.0+ [DO NOT MERGE] Require NumPy 1.18+ & Pandas 1.0+ Jul 29, 2021
@jrbourbeau jrbourbeau changed the title [DO NOT MERGE] Require NumPy 1.18+ & Pandas 1.0+ [DO NOT MERGE YET] Require NumPy 1.18+ & Pandas 1.0+ Jul 29, 2021
@jakirkham jakirkham changed the title [DO NOT MERGE YET] Require NumPy 1.18+ & Pandas 1.0+ Require NumPy 1.18+ & Pandas 1.0+ Jul 30, 2021
@jrbourbeau
jrbourbeau merged commit d3bf07c into dask:main Jul 30, 2021
@jakirkham
jakirkham deleted the req_np17_pd1 branch July 31, 2021 00:32
@jakirkham

Copy link
Copy Markdown
Member Author

Thanks all! 😄 Hoping this simplifies maintenance going forward 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

array dataframe dispatch Related to `Dispatch` extension objects io

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants