1{
2 lib,
3 buildPythonPackage,
4 pythonOlder,
5 fetchFromGitHub,
6 fetchpatch2,
7 poetry-core,
8 snowballstemmer,
9 tomli,
10 pytestCheckHook,
11}:
12
13buildPythonPackage rec {
14 pname = "pydocstyle";
15 version = "6.3.0";
16 pyproject = true;
17
18 disabled = pythonOlder "3.6";
19
20 src = fetchFromGitHub {
21 owner = "PyCQA";
22 repo = "pydocstyle";
23 tag = version;
24 hash = "sha256-MjRrnWu18f75OjsYIlOLJK437X3eXnlW8WkkX7vdS6k=";
25 };
26
27 patches = [
28 # https://github.com/PyCQA/pydocstyle/pull/656
29 (fetchpatch2 {
30 name = "python312-compat.patch";
31 url = "https://github.com/PyCQA/pydocstyle/commit/306c7c8f2d863bdc098a65d2dadbd4703b9b16d5.patch";
32 hash = "sha256-bqnoLz1owzDpFqlZn8z4Z+RzKCYBsI0PqqeOtjLxnMo=";
33 })
34 ];
35
36 nativeBuildInputs = [ poetry-core ];
37
38 postPatch = ''
39 substituteInPlace pyproject.toml \
40 --replace 'version = "0.0.0-dev"' 'version = "${version}"'
41 '';
42
43 propagatedBuildInputs = [ snowballstemmer ] ++ lib.optionals (pythonOlder "3.11") [ tomli ];
44
45 optional-dependencies.toml = [ tomli ];
46
47 nativeCheckInputs = [ pytestCheckHook ] ++ optional-dependencies.toml;
48
49 disabledTestPaths = [
50 "src/tests/test_integration.py" # runs pip install
51 ];
52
53 meta = with lib; {
54 description = "Python docstring style checker";
55 mainProgram = "pydocstyle";
56 homepage = "https://github.com/PyCQA/pydocstyle";
57 changelog = "https://github.com/PyCQA/pydocstyle/blob/${version}/docs/release_notes.rst";
58 license = licenses.mit;
59 maintainers = with maintainers; [ dzabraev ];
60 };
61}