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