1{
2 lib,
3 aiohttp,
4 buildPythonPackage,
5 fastapi,
6 fetchFromGitHub,
7 flask,
8 httpx,
9 mypy-boto3-s3,
10 numpy,
11 pydantic,
12 pytest-asyncio,
13 pytestCheckHook,
14 pythonOlder,
15 pyyaml,
16 scipy,
17 setuptools,
18}:
19
20buildPythonPackage rec {
21 pname = "dependency-injector";
22 version = "4.42.0";
23 pyproject = true;
24
25 disabled = pythonOlder "3.7";
26
27 src = fetchFromGitHub {
28 owner = "ets-labs";
29 repo = "python-dependency-injector";
30 tag = version;
31 hash = "sha256-ryPNmiIKQzR4WSjt7hi4C+iTsYvfj5TYGy+9PJxX+10=";
32 };
33
34 build-system = [ setuptools ];
35
36 optional-dependencies = {
37 aiohttp = [ aiohttp ];
38 pydantic = [ pydantic ];
39 flask = [ flask ];
40 yaml = [ pyyaml ];
41 };
42
43 nativeCheckInputs = [
44 fastapi
45 httpx
46 mypy-boto3-s3
47 numpy
48 pytest-asyncio
49 pytestCheckHook
50 scipy
51 ] ++ lib.flatten (builtins.attrValues optional-dependencies);
52
53 pythonImportsCheck = [ "dependency_injector" ];
54
55 disabledTestPaths = [
56 # Exclude tests for EOL Python releases
57 "tests/unit/ext/test_aiohttp_py35.py"
58 "tests/unit/wiring/test_*_py36.py"
59 "tests/unit/providers/configuration/test_from_pydantic_py36.py"
60 "tests/unit/providers/configuration/test_pydantic_settings_in_init_py36.py"
61 ];
62
63 meta = with lib; {
64 description = "Dependency injection microframework for Python";
65 homepage = "https://github.com/ets-labs/python-dependency-injector";
66 changelog = "https://github.com/ets-labs/python-dependency-injector/blob/${version}/docs/main/changelog.rst";
67 license = licenses.bsd3;
68 maintainers = with maintainers; [ gerschtli ];
69 # https://github.com/ets-labs/python-dependency-injector/issues/726
70 broken = versionAtLeast pydantic.version "2";
71 };
72}