1{
2 lib,
3 fetchFromGitHub,
4 buildPythonPackage,
5 flake8-import-order,
6 pyflakes,
7 tomli,
8 setuptools,
9 pytestCheckHook,
10 pythonAtLeast,
11 pythonOlder,
12}:
13
14buildPythonPackage rec {
15 pname = "zimports";
16 version = "0.6.2";
17 format = "setuptools";
18
19 # upstream technically support 3.7 through 3.9, but 3.10 happens to work while 3.11 breaks with an import error
20 disabled = pythonOlder "3.7" || pythonAtLeast "3.11";
21
22 src = fetchFromGitHub {
23 owner = "sqlalchemyorg";
24 repo = "zimports";
25 tag = "v${version}";
26 hash = "sha256-yI/ZTNqVIu76xivXJ+MoLpPupf0RQjQOnP6OWMPajBo=";
27 };
28
29 propagatedBuildInputs = [
30 flake8-import-order
31 pyflakes
32 setuptools
33 tomli
34 ];
35
36 nativeCheckInputs = [ pytestCheckHook ];
37
38 pythonImportsCheck = [ "zimports" ];
39
40 meta = with lib; {
41 description = "Python import rewriter";
42 homepage = "https://github.com/sqlalchemyorg/zimports";
43 license = licenses.mit;
44 maintainers = with maintainers; [ timokau ];
45 };
46}