Describe the bug A clear and concise description of what the bug is.
Running black in the console generates a traceback.
To Reproduce Steps to reproduce the behavior:
Running black directly in the console gives me the following traceback.
Traceback (most recent call last):
File "/Users/jonathan/projects/recorded/integrations/splunk/venv/bin/black", line 7, in <module>
from black import patched_main
File "/Users/jonathan/projects/recorded/integrations/splunk/venv/lib/python3.6/site-packages/black/__init__.py", line 57, in <module>
from blib2to3 import pygram, pytree
File "/Users/jonathan/projects/recorded/integrations/splunk/venv/lib/python3.6/site-packages/blib2to3/pygram.py", line 13, in <module>
from .pgen2 import driver
File "/Users/jonathan/projects/recorded/integrations/splunk/venv/lib/python3.6/site-packages/blib2to3/pgen2/driver.py", line 39, in <module>
from . import grammar, parse, token, tokenize, pgen
File "/Users/jonathan/projects/recorded/integrations/splunk/venv/lib/python3.6/site-packages/blib2to3/pgen2/pgen.py", line 7, in <module>
from typing import (
ImportError: cannot import name 'NoReturn'
Expected behavior A clear and concise description of what you expected to happen.
Shouldn't have any error.
Environment (please complete the following information):
typing.NoReturn was added in 3.6.2 (https://docs.python.org/3/library/typing.html#typing.NoReturn). I'd accept a PR that falls back to typing_extensions.NoReturn for 3.6.0 and 3.6.1. Maybe it's time to upgrade though :)
Thanks for the heads up. :) Perhaps an update of the documentation will do? Dropping 3.6.1
Please see PR https://github.com/psf/black/pull/1668 to update the README, and the black.vim and setup.py checks.
I mildly prefer continuing to support 3.6.0/1 by adding a fallback to typing_extensions.NoReturn, especially since we already require typing-extensions (https://github.com/psf/black/blob/master/setup.py#L78). I could live with dropping support for 3.6.0/1 too, though, if that's what other developers prefer.
I vote either way. I feel 3.6.2 is very accessible these days (with most distros defaulting to > 3.6.2 these days). Since the backport is easy, we already have the dependency and it's only for typing, I see no big reason to not support 3.6.0. But I expect a reason to eventually come to need > 3.6.1 ...
I feel like given how easy it is to work around this (implementation & maintenance wise), I'd rather not drop support for 3.6.0 and 3.6.1 just because of this issue.
(from experience) when adjusting python_requires>=3.6 to python_requires>=3.6.1 (or whatever) -- you're usually best to make one final release which supports the old versions before dropping such that pip will resolve to that instead of installing a broken thing
as for linting / preventing something like this in the future, I've created a flake8 plugin for this: flake8-typing-imports
Most helpful comment
typing.NoReturnwas added in 3.6.2 (https://docs.python.org/3/library/typing.html#typing.NoReturn). I'd accept a PR that falls back totyping_extensions.NoReturnfor 3.6.0 and 3.6.1. Maybe it's time to upgrade though :)