Skip to content

Commit

Permalink
remove check_python_3 (broken with click>=8.1.0)
Browse files Browse the repository at this point in the history
fixes dask#6013
  • Loading branch information
graingert committed Mar 29, 2022
1 parent fb78273 commit 00d81dc
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 73 deletions.
6 changes: 3 additions & 3 deletions continuous_integration/recipes/distributed/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ outputs:
track_features: # [cython_enabled]
- cythonized-scheduler # [cython_enabled]
entry_points:
- dask-scheduler = distributed.cli.dask_scheduler:go
- dask-ssh = distributed.cli.dask_ssh:go
- dask-worker = distributed.cli.dask_worker:go
- dask-scheduler = distributed.cli.dask_scheduler:main
- dask-ssh = distributed.cli.dask_ssh:main
- dask-worker = distributed.cli.dask_worker:main
requirements:
build:
- {{ compiler('c') }} # [cython_enabled]
Expand Down
9 changes: 2 additions & 7 deletions distributed/cli/dask_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from tornado.ioloop import IOLoop

from distributed import Scheduler
from distributed.cli.utils import check_python_3, install_signal_handlers
from distributed.cli.utils import install_signal_handlers
from distributed.preloading import validate_preload_argv
from distributed.proctitle import (
enable_proctitle_on_children,
Expand Down Expand Up @@ -212,10 +212,5 @@ async def run():
logger.info("End scheduler at %r", scheduler.address)


def go():
check_python_3()
main()


if __name__ == "__main__":
go() # pragma: no cover
main() # pragma: no cover
8 changes: 1 addition & 7 deletions distributed/cli/dask_ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import click

from distributed.cli.utils import check_python_3
from distributed.deploy.old_ssh import SSHCluster

logger = logging.getLogger("distributed.dask_ssh")
Expand Down Expand Up @@ -223,10 +222,5 @@ def main(
print("[ dask-ssh ]: Remote processes have been terminated. Exiting.")


def go():
check_python_3()
main()


if __name__ == "__main__":
go() # pragma: no cover
main() # pragma: no cover
9 changes: 2 additions & 7 deletions distributed/cli/dask_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from dask.system import CPU_COUNT

from distributed import Nanny
from distributed.cli.utils import check_python_3, install_signal_handlers
from distributed.cli.utils import install_signal_handlers
from distributed.comm import get_address_host_port
from distributed.deploy.utils import nprocesses_nthreads
from distributed.preloading import validate_preload_argv
Expand Down Expand Up @@ -486,10 +486,5 @@ async def run():
logger.info("End worker")


def go():
check_python_3()
main()


if __name__ == "__main__":
go() # pragma: no cover
main() # pragma: no cover
46 changes: 0 additions & 46 deletions distributed/cli/utils.py
Original file line number Diff line number Diff line change
@@ -1,51 +1,5 @@
import click
from packaging.version import parse as parse_version
from tornado.ioloop import IOLoop

CLICK_VERSION = parse_version(click.__version__)

py3_err_msg = """
Warning: Your terminal does not set locales.
If you use unicode text inputs for command line options then this may cause
undesired behavior. This is rare.
If you don't use unicode characters in command line options then you can safely
ignore this message. This is the common case.
You can support unicode inputs by specifying encoding environment variables,
though exact solutions may depend on your system:
$ export LC_ALL=C.UTF-8
$ export LANG=C.UTF-8
For more information see: http://click.pocoo.org/5/python3/
""".lstrip()


def check_python_3():
"""Ensures that the environment is good for unicode on Python 3."""
# https://github.com/pallets/click/issues/448#issuecomment-246029304
import click.core

# TODO: Remove use of internal click functions
if CLICK_VERSION < parse_version("8.0.0"):
click.core._verify_python3_env = lambda: None
else:
click.core._verify_python_env = lambda: None

try:
from click import _unicodefun

if CLICK_VERSION < parse_version("8.0.0"):
_unicodefun._verify_python3_env()
else:
_unicodefun._verify_python_env()
except (TypeError, RuntimeError):
import click

click.echo(py3_err_msg, err=True)


def install_signal_handlers(loop=None, cleanup=None):
"""
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@
],
entry_points="""
[console_scripts]
dask-ssh=distributed.cli.dask_ssh:go
dask-scheduler=distributed.cli.dask_scheduler:go
dask-worker=distributed.cli.dask_worker:go
dask-ssh=distributed.cli.dask_ssh:main
dask-scheduler=distributed.cli.dask_scheduler:main
dask-worker=distributed.cli.dask_worker:main
""",
# https://mypy.readthedocs.io/en/latest/installed_packages.html
zip_safe=False,
Expand Down

0 comments on commit 00d81dc

Please sign in to comment.