]>
git.madduck.net Git - etc/vim.git/commitdiff
madduck's git repository
Every one of the projects in this repository is available at the canonical
URL git://git.madduck.net/madduck/pub/<projectpath> — see
each project's metadata for the exact URL.
All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@ git. madduck. net .
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
SSH access, as well as push access can be individually
arranged .
If you use my repositories frequently, consider adding the following
snippet to ~/.gitconfig and using the third clone URL listed for each
project:
[url "git://git.madduck.net/madduck/"]
insteadOf = madduck:
summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
c702588 )
- Lines ending with `fmt: skip` will now be not formatted (#1800)
- Lines ending with `fmt: skip` will now be not formatted (#1800)
+- PR #2053: Black no longer relies on typed-ast for Python 3.8 and higher
+
+- PR #2053: Python 2 support is now optional, install with
+ `python3 -m pip install black[python2]` to maintain support.
+
#### _Packaging_
- Self-contained native _Black_ binaries are now provided for releases via GitHub
#### _Packaging_
- Self-contained native _Black_ binaries are now provided for releases via GitHub
### Installation
_Black_ can be installed by running `pip install black`. It requires Python 3.6.2+ to
### Installation
_Black_ can be installed by running `pip install black`. It requires Python 3.6.2+ to
-run but you can reformat Python 2 code with it, too.
+run. If you want to format Python 2 code as well, install with
+`pip install black[python2]`.
"click>=7.1.2",
"appdirs",
"toml>=0.10.1",
"click>=7.1.2",
"appdirs",
"toml>=0.10.1",
+ "typed-ast>=1.4.2; python_version < '3.8' ",
"regex>=2020.1.8",
"pathspec>=0.6, <1",
"dataclasses>=0.6; python_version < '3.7'",
"regex>=2020.1.8",
"pathspec>=0.6, <1",
"dataclasses>=0.6; python_version < '3.7'",
extras_require={
"d": ["aiohttp>=3.3.2", "aiohttp-cors"],
"colorama": ["colorama>=0.4.3"],
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=[
},
test_suite="tests.test_black",
classifiers=[
from dataclasses import dataclass, field, replace
import click
import toml
from dataclasses import dataclass, field, replace
import click
import toml
-from typed_ast import ast3, ast27
+
+try:
+ from typed_ast import ast3, ast27
+except ImportError:
+ if sys.version_info < (3, 8):
+ print(
+ "The typed_ast package is not installed.\n"
+ "You can install it with `python3 -m pip install typed-ast`.",
+ file=sys.stderr,
+ )
+ sys.exit(1)
+ else:
+ ast3 = ast27 = ast
+
from pathspec import PathSpec
# lib2to3 fork
from pathspec import PathSpec
# lib2to3 fork
return ast3.parse(src, filename, feature_version=feature_version)
except SyntaxError:
continue
return ast3.parse(src, filename, feature_version=feature_version)
except SyntaxError:
continue
+ if ast27.__name__ == "ast":
+ raise SyntaxError(
+ "The requested source code has invalid Python 3 syntax.\n"
+ "If you are trying to format Python 2 files please reinstall Black"
+ " with the 'python2' extra: `python3 -m pip install black[python2]`."
+ )
deps =
-r{toxinidir}/test_requirements.txt
commands =
deps =
-r{toxinidir}/test_requirements.txt
commands =
+ pip install -e .[d,python2 ]
coverage erase
coverage run -m pytest tests
coverage report
coverage erase
coverage run -m pytest tests
coverage report