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