1{
2 lib,
3 buildPythonPackage,
4 pythonOlder,
5 fetchFromGitHub,
6 poetry-core,
7 charset-normalizer,
8 tomli,
9 untokenize,
10 mock,
11 pytestCheckHook,
12}:
13
14buildPythonPackage rec {
15 pname = "docformatter";
16 version = "1.7.7";
17
18 disabled = pythonOlder "3.7";
19
20 format = "pyproject";
21
22 src = fetchFromGitHub {
23 owner = "PyCQA";
24 repo = pname;
25 tag = "v${version}";
26 hash = "sha256-eLjaHso1p/nD9K0E+HkeBbnCnvjZ1sdpfww9tzBh0TI=";
27 };
28
29 patches = [ ./test-path.patch ];
30
31 postPatch = ''
32 substituteInPlace pyproject.toml \
33 --replace 'charset_normalizer = "^2.0.0"' 'charset_normalizer = ">=2.0.0"'
34 substituteInPlace tests/conftest.py \
35 --subst-var-by docformatter $out/bin/docformatter
36 '';
37
38 nativeBuildInputs = [ poetry-core ];
39
40 propagatedBuildInputs = [
41 charset-normalizer
42 tomli
43 untokenize
44 ];
45
46 nativeCheckInputs = [
47 mock
48 pytestCheckHook
49 ];
50
51 # Disable failing tests until https://github.com/PyCQA/docformatter/issues/274 is fixed upstream
52 disabledTests = [
53 "test_do_format_code.py"
54 "test_docformatter.py"
55 ];
56
57 pythonImportsCheck = [ "docformatter" ];
58
59 meta = {
60 changelog = "https://github.com/PyCQA/docformatter/blob/${src.tag}/CHANGELOG.md";
61 description = "Formats docstrings to follow PEP 257";
62 mainProgram = "docformatter";
63 homepage = "https://github.com/myint/docformatter";
64 license = lib.licenses.mit;
65 maintainers = with lib.maintainers; [ dotlambda ];
66 };
67}