Skip to content

Commit

Permalink
Require Click 7.0+ in Dask (#9595)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakirkham committed Oct 28, 2022
1 parent f4e772e commit 6d9252c
Show file tree
Hide file tree
Showing 13 changed files with 17 additions and 39 deletions.
1 change: 1 addition & 0 deletions continuous_integration/environment-3.10.yaml
Expand Up @@ -45,6 +45,7 @@ dependencies:
# Need recent version of s3fs to support newer aiobotocore versions
# https://github.com/dask/s3fs/issues/514
- s3fs>=2021.8.0
- click
- cloudpickle
- crick
- cytoolz
Expand Down
1 change: 1 addition & 0 deletions continuous_integration/environment-3.8.yaml
Expand Up @@ -45,6 +45,7 @@ dependencies:
# Need recent version of s3fs to support newer aiobotocore versions
# https://github.com/dask/s3fs/issues/514
- s3fs>=2021.8.0
- click
- cloudpickle
- crick
- cytoolz
Expand Down
1 change: 1 addition & 0 deletions continuous_integration/environment-3.9.yaml
Expand Up @@ -45,6 +45,7 @@ dependencies:
# Need recent version of s3fs to support newer aiobotocore versions
# https://github.com/dask/s3fs/issues/514
- s3fs>=2021.8.0
- click
- cloudpickle
- crick
- cytoolz
Expand Down
1 change: 1 addition & 0 deletions continuous_integration/environment-mindeps-array.yaml
Expand Up @@ -6,6 +6,7 @@ dependencies:
- packaging=20.0
- python=3.8
- pyyaml>=5.3.1
- click=7.0
- cloudpickle=1.1.1
- partd=0.3.10
- fsspec=0.6.0
Expand Down
1 change: 1 addition & 0 deletions continuous_integration/environment-mindeps-dataframe.yaml
Expand Up @@ -6,6 +6,7 @@ dependencies:
- packaging=20.0
- python=3.8
- pyyaml>=5.3.1
- click=7.0
- cloudpickle=1.1.1
- partd=0.3.10
- fsspec=0.6.0
Expand Down
Expand Up @@ -6,6 +6,7 @@ dependencies:
- packaging=20.0
- python=3.8
- pyyaml>=5.3.1
- click=7.0
- cloudpickle=1.5.0 # this is in the min from distributed
- partd=0.3.10
- fsspec=0.6.0
Expand Down
Expand Up @@ -6,6 +6,7 @@ dependencies:
- packaging=20.0
- python=3.8
- pyyaml>=5.3.1
- click=7.0
- cloudpickle=1.1.1
- partd=0.3.10
- fsspec=0.6.0
Expand Down
2 changes: 1 addition & 1 deletion continuous_integration/recipe/meta.yaml
Expand Up @@ -25,6 +25,7 @@ requirements:

run:
- python >=3.8
- click >=7.0
- cloudpickle >=1.1.1
- fsspec >=0.6.0
- packaging >=20.0
Expand All @@ -42,7 +43,6 @@ test:
- dask info versions --help
requires:
- pip
- click

about:
home: https://github.com/dask/dask/
Expand Down
2 changes: 1 addition & 1 deletion continuous_integration/scripts/test_imports.sh
Expand Up @@ -5,7 +5,7 @@ set -o errexit
test_import () {
echo "Create environment: python=$PYTHON_VERSION $1"
# Create an empty environment
mamba create -q -y -n test-imports -c conda-forge python=$PYTHON_VERSION packaging pyyaml fsspec toolz partd cloudpickle $1
mamba create -q -y -n test-imports -c conda-forge python=$PYTHON_VERSION packaging pyyaml fsspec toolz partd click cloudpickle $1
conda activate test-imports
if [[ $1 =~ "distributed" ]]; then
# dask[distributed] depends on the latest version of distributed
Expand Down
20 changes: 1 addition & 19 deletions dask/__main__.py
@@ -1,25 +1,7 @@
import sys

try:
import click
except ImportError:
click = None
from dask.cli import run_cli


def main():

if click is None:
msg = (
"The dask command requires click to be installed.\n\n"
"Install with conda or pip:\n\n"
" conda install click\n"
" pip install click\n"
)
print(msg, file=sys.stderr)
return 1

from dask.cli import run_cli

run_cli()


Expand Down
14 changes: 2 additions & 12 deletions dask/cli.py
@@ -1,20 +1,10 @@
import warnings

import click

from dask import __version__
from dask.compatibility import entry_points

try:
import click
except ImportError as e:
msg = (
"The dask.cli module requires click to be installed.\n\n"
"Install with conda or pip:\n\n"
" conda install click\n"
" pip install click\n"
)
raise ImportError(msg) from e


CONTEXT_SETTINGS = {
"help_option_names": ["-h", "--help"],
"max_content_width": 88,
Expand Down
10 changes: 4 additions & 6 deletions dask/tests/test_cli.py
@@ -1,14 +1,12 @@
import pytest

click = pytest.importorskip("click")

import json
import platform
import sys

# FIXME importing importlib.metadata fails when running the entire test suite with UPSTREAM_DEV=1
from importlib import metadata as importlib_metadata

import click
import pytest
from click.testing import CliRunner

import dask
Expand Down Expand Up @@ -44,7 +42,7 @@ def test_info_versions():
assert table["distributed"] == distributed_version


@click.group
@click.group()
def dummy_cli():
pass

Expand Down Expand Up @@ -86,7 +84,7 @@ def test_register_command_ep():
assert dummy_cli.commands["good"] is good_command


@click.group
@click.group()
def dummy_cli_2():
pass

Expand Down
1 change: 1 addition & 0 deletions setup.py
Expand Up @@ -33,6 +33,7 @@
]

install_requires = [
"click >= 7.0",
"cloudpickle >= 1.1.1",
"fsspec >= 0.6.0",
"packaging >= 20.0",
Expand Down

0 comments on commit 6d9252c

Please sign in to comment.