1{ stdenv, buildPythonPackage, fetchPypi, pythonOlder
2, attrs, click, toml, appdirs, aiohttp, aiohttp-cors
3, glibcLocales, typed-ast, pathspec, regex
4, setuptools_scm, pytest }:
5
6buildPythonPackage rec {
7 pname = "black";
8 version = "19.10b0";
9
10 disabled = pythonOlder "3.6";
11
12 src = fetchPypi {
13 inherit pname version;
14 sha256 = "0f8mr0yzj78q1dx7v6ggbgfir2wv0n5z2shfbbvfdq7910xbgvf2";
15 };
16
17 nativeBuildInputs = [ setuptools_scm ];
18 checkInputs = [ pytest glibcLocales ];
19
20 # Necessary for the tests to pass on Darwin with sandbox enabled.
21 # Black starts a local server and needs to bind a local address.
22 __darwinAllowLocalNetworking = true;
23
24 # Don't know why these tests fails
25 # Disable test_expression_diff, because it fails on darwin
26 checkPhase = ''
27 LC_ALL="en_US.UTF-8" pytest \
28 --deselect tests/test_black.py::BlackTestCase::test_expression_diff \
29 --deselect tests/test_black.py::BlackTestCase::test_cache_multiple_files \
30 --deselect tests/test_black.py::BlackTestCase::test_failed_formatting_does_not_get_cached
31 '';
32
33 propagatedBuildInputs = [ attrs appdirs click toml aiohttp aiohttp-cors pathspec regex typed-ast ];
34
35 meta = with stdenv.lib; {
36 description = "The uncompromising Python code formatter";
37 homepage = https://github.com/ambv/black;
38 license = licenses.mit;
39 maintainers = with maintainers; [ sveitser ];
40 };
41
42}