summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/pydocstyle/default.nix
blob: 6fe939ff927d430aa91f02861e74bfa0404f607b (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
{
  lib,
  buildPythonPackage,
  pythonOlder,
  fetchFromGitHub,
  fetchpatch2,
  poetry-core,
  snowballstemmer,
  tomli,
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "pydocstyle";
  version = "6.3.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "PyCQA";
    repo = "pydocstyle";
    tag = version;
    hash = "sha256-MjRrnWu18f75OjsYIlOLJK437X3eXnlW8WkkX7vdS6k=";
  };

  patches = [
    # https://github.com/PyCQA/pydocstyle/pull/656
    (fetchpatch2 {
      name = "python312-compat.patch";
      url = "https://github.com/PyCQA/pydocstyle/commit/306c7c8f2d863bdc098a65d2dadbd4703b9b16d5.patch";
      hash = "sha256-bqnoLz1owzDpFqlZn8z4Z+RzKCYBsI0PqqeOtjLxnMo=";
    })
  ];

  nativeBuildInputs = [ poetry-core ];

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace 'version = "0.0.0-dev"' 'version = "${version}"'
  '';

  propagatedBuildInputs = [ snowballstemmer ] ++ lib.optionals (pythonOlder "3.11") [ tomli ];

  optional-dependencies.toml = [ tomli ];

  nativeCheckInputs = [ pytestCheckHook ] ++ optional-dependencies.toml;

  disabledTestPaths = [
    "src/tests/test_integration.py" # runs pip install
  ];

  meta = {
    description = "Python docstring style checker";
    mainProgram = "pydocstyle";
    homepage = "https://github.com/PyCQA/pydocstyle";
    changelog = "https://github.com/PyCQA/pydocstyle/blob/${version}/docs/release_notes.rst";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ dzabraev ];
  };
}