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