1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, fetchpatch
5, importlib-metadata
6, isort
7, poetry-core
8, pytest
9, pytestCheckHook
10, pythonOlder
11}:
12
13buildPythonPackage rec {
14 pname = "pytest-isort";
15 version = "3.0.0";
16 format = "pyproject";
17
18 disabled = pythonOlder "3.7";
19
20 src = fetchFromGitHub {
21 owner = "stephrdev";
22 repo = pname;
23 rev = version;
24 hash = "sha256-gbEO3HBDeZ+nUACzpeV6iVuCdNHS5956wFzIYkbam+M=";
25 };
26
27 nativeBuildInputs = [
28 poetry-core
29 ];
30
31 buildInputs = [
32 pytest
33 ];
34
35 propagatedBuildInputs = [
36 isort
37 ] ++ lib.optionals (pythonOlder "3.8") [
38 importlib-metadata
39 ];
40
41 checkInputs = [
42 pytestCheckHook
43 ];
44
45 patches = [
46 # Can be removed with the next release, https://github.com/stephrdev/pytest-isort/pull/44
47 (fetchpatch {
48 name = "switch-to-poetry-core.patch";
49 url = "https://github.com/stephrdev/pytest-isort/commit/f17ed2d294ae90e415d051e1c720982e3dd01bff.patch";
50 sha256 = "sha256-PiOs0c61BNx/tZN11DYblOd7tNzGthNnlkmYMTI9v18=";
51 })
52 ];
53
54 pythonImportsCheck = [
55 "pytest_isort"
56 ];
57
58 meta = with lib; {
59 description = "Pytest plugin to perform isort checks (import ordering)";
60 homepage = "https://github.com/moccu/pytest-isort/";
61 license = licenses.bsd3;
62 maintainers = with maintainers; [ ];
63 };
64}