Skip to content

Commit

Permalink
don't require typed-ast
Browse files Browse the repository at this point in the history
  • Loading branch information
KotlinIsland committed Mar 20, 2021
1 parent 5446a92 commit 9e81b0b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
3 changes: 2 additions & 1 deletion setup.py
Expand Up @@ -71,7 +71,7 @@ def get_long_description() -> str:
"click>=7.1.2",
"appdirs",
"toml>=0.10.1",
"typed-ast>=1.4.2",
"typed-ast>=1.4.2; python_version < '3.8'",
"regex>=2020.1.8",
"pathspec>=0.6, <1",
"dataclasses>=0.6; python_version < '3.7'",
Expand All @@ -81,6 +81,7 @@ def get_long_description() -> str:
extras_require={
"d": ["aiohttp>=3.3.2", "aiohttp-cors"],
"colorama": ["colorama>=0.4.3"],
'python2': ['typed-ast>=1.4.2'],
},
test_suite="tests.test_black",
classifiers=[
Expand Down
15 changes: 14 additions & 1 deletion src/black/__init__.py
Expand Up @@ -48,7 +48,20 @@
from dataclasses import dataclass, field, replace
import click
import toml
from typed_ast import ast3, ast27

if sys.version_info < (3, 8):
try:
from typed_ast import ast3, ast27
except ImportError:
print(
"The typed_ast package is not installed.\n"
"You must install typed_ast with `python3 -m pip install typed-ast`.",
file=sys.stderr,
)
sys.exit(1)
else:
ast3 = ast27 = ast

from pathspec import PathSpec

# lib2to3 fork
Expand Down

0 comments on commit 9e81b0b

Please sign in to comment.