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
Require Click 7.0+ in Dask #9595
Conversation
This looks good to me! Looks like test failures are related to #9597 |
Yeah was looking at that. Looks like it could be related to a recent |
Maybe fixed by this cc @jrbourbeau (for awareness) |
Seeing only one CI failure, which doesn't appear related. Raised as issue ( #9598 ) |
CI is passing 🟢 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jakirkham!
IIUC the motivation behind this PR is the pain we went through getting the new dask
CLI set up on conda-forge. Is that correct, or am I missing something? Since things are now working on conda-forge, I'm wondering how much this change is needed.
To be clear, I don't have a strong objections to adding click
-- it's a small, popular, pure Python library. I also suspect many (most?) Dask users today already install click
because pip install dask[complete]
and conda install dask
pull in click
. I'm just trying to get a better understanding for what problem gets solved by adding click
as a dependency.
cc @jacobtomlinson as I believe he had some reservations around making click
a required dependency (xref #9283 (comment))
My reservations were around insisting folks use click to implement the downstream plugins. Tools like I'm not against this change 😃 |
Co-authored-by: James Bourbeau <jrbourbeau@users.noreply.github.com>
It seems the mindeps changes are causing CI issues. Are we attached to those changes @jrbourbeau? |
I'd suggest we keep the tight pin and update the minimum version of |
Sure we can give that a try. Just curious why 7.1.2 was chosen? |
It's much newer than |
Gotcha Took a deeper look and think the issue is that The first version of |
Looks like CI was cancelled? In any event it appears the installs in mindeps worked. |
🎉 glad the install is working now. Though it looks like there are now related test failures ___________________________ test_register_command_ep ___________________________
def test_register_command_ep():
from dask.cli import _register_command_ep
bad_ep = importlib.metadata.EntryPoint(
name="bad",
value="dask.tests.test_cli:bad_command",
group="dask_cli",
)
good_ep = importlib.metadata.EntryPoint(
name="good",
value="dask.tests.test_cli:good_command",
group="dask_cli",
)
with pytest.warns(UserWarning, match="must be instances of"):
_register_command_ep(dummy_cli, bad_ep)
> _register_command_ep(dummy_cli, good_ep)
dask/tests/test_cli.py:80:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
interface = <function command.<locals>.decorator at 0x7fc89050b1f0>
entry_point = EntryPoint(name='good', value='dask.tests.test_cli:good_command', group='dask_cli')
def _register_command_ep(interface, entry_point):
"""Add `entry_point` command to `interface`.
Parameters
----------
interface : click.Command or click.Group
The click interface to augment with `entry_point`.
entry_point : importlib.metadata.EntryPoint
The entry point which loads to a ``click.Command`` or
``click.Group`` instance to be added as a sub-command or
sub-group in `interface`.
"""
command = entry_point.load()
if not isinstance(command, (click.Command, click.Group)):
warnings.warn(
"entry points in 'dask_cli' must be instances of "
f"click.Command or click.Group, not {type(command)}."
)
return
> if command.name in interface.commands:
E AttributeError: 'function' object has no attribute 'commands'
dask/cli.py:64: AttributeError |
|
Thanks for looking into it @douglasdavis |
Ah it's because my "dummy" CLI's are bad in the test file :) (Click pre v8 requires parens on the decorators) necessary fix: diff --git a/dask/tests/test_cli.py b/dask/tests/test_cli.py
index a7e2d5f86..2adab2b77 100644
--- a/dask/tests/test_cli.py
+++ b/dask/tests/test_cli.py
@@ -40,7 +40,7 @@ def test_info_versions():
assert table["distributed"] == distributed_version
-@click.group
+@click.group()
def dummy_cli():
pass
@@ -82,7 +82,7 @@ def test_register_command_ep():
assert dummy_cli.commands["good"] is good_command
-@click.group
+@click.group()
def dummy_cli_2():
pass
|
Awesome thanks Doug and James! 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we bump the click
requirement to 7.0 in setup.py
& meta.yaml
too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just trying to get a better understanding for what problem gets solved by adding click as a dependency.
Circling back to this point, one thing I'd like to do is update our issue template to use dask info versions
instead of asking separately for dask
, distributed
, and python
versions as running dask info versions
is less of an ask for users. Having click
installed already will reduce barriers for this. I'll admit I only see this as moderate motivation for adding click
as a dependency, but I also think that's probably okay in this case.
I'll propose we give a bit more time for others to weigh in (@jakirkham asked for feedback here dask/community#283 (comment) a few days ago) and then merge prior to releasing today.
Since this is what we test with and we can be sure it works.
Thanks James! 🙏 |
Given we are using Click 7.0+ in Dask, thought it would make sense to align on that minimum version in Distributed. Submitted PR ( dask/distributed#7226 ) to do that. Feedback welcome :) |
Given the recent pain around the move to the new entry points ( dask/distributed#7176 ) and discussion in the fix ( conda-forge/dask-core-feedstock#146 ), would like to propose making Click a hard requirement in Dask.
pre-commit run --all-files