aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/development/python-modules/black/default.nix
blob: f0a25dfb0b12e4d1e9d1d5cb15ad22be49aaf2de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
{ stdenv, lib
, buildPythonPackage, fetchPypi, pythonOlder, setuptools_scm, pytestCheckHook
, aiohttp
, aiohttp-cors
, appdirs
, attrs
, click
, mypy-extensions
, pathspec
, regex
, toml
, typed-ast
, typing-extensions }:

buildPythonPackage rec {
  pname = "black";
  version = "20.8b1";

  disabled = pythonOlder "3.6";

  src = fetchPypi {
    inherit pname version;
    sha256 = "1spv6sldp3mcxr740dh3ywp25lly9s8qlvs946fin44rl1x5a0hw";
  };

  nativeBuildInputs = [ setuptools_scm ];

  # Necessary for the tests to pass on Darwin with sandbox enabled.
  # Black starts a local server and needs to bind a local address.
  __darwinAllowLocalNetworking = true;

  checkInputs =  [ pytestCheckHook ];

  preCheck = ''
    export PATH="$PATH:$out/bin"
  '';

  disabledTests = [
    # Don't know why these tests fails
    "test_cache_multiple_files"
    "test_failed_formatting_does_not_get_cached"
    # requires network access
    "test_gen_check_output"
    "test_process_queue"
  ] ++ lib.optionals stdenv.isDarwin [
    # fails on darwin
    "test_expression_diff"
  ];

  propagatedBuildInputs = [
    aiohttp
    aiohttp-cors
    appdirs
    attrs
    click
    mypy-extensions
    pathspec
    regex
    toml
    typed-ast
    typing-extensions
  ];

  meta = with lib; {
    description = "The uncompromising Python code formatter";
    homepage    = "https://github.com/psf/black";
    changelog   = "https://github.com/psf/black/blob/${version}/CHANGES.md";
    license     = licenses.mit;
    maintainers = with maintainers; [ sveitser ];
  };
}