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.48.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-jsV+PmUGtK8QiI2ga963H/gkd31UEq0SouEia+spSpg=";
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 ]
52 ++ lib.flatten (builtins.attrValues optional-dependencies);
53
54 pythonImportsCheck = [ "dependency_injector" ];
55
56 disabledTestPaths = [
57 # Exclude tests for EOL Python releases
58 "tests/unit/ext/test_aiohttp_py35.py"
59 "tests/unit/wiring/test_*_py36.py"
60 "tests/unit/providers/configuration/test_from_pydantic_py36.py"
61 "tests/unit/providers/configuration/test_pydantic_settings_in_init_py36.py"
62 ];
63
64 meta = with lib; {
65 description = "Dependency injection microframework for Python";
66 homepage = "https://github.com/ets-labs/python-dependency-injector";
67 changelog = "https://github.com/ets-labs/python-dependency-injector/blob/${src.tag}/docs/main/changelog.rst";
68 license = licenses.bsd3;
69 maintainers = with maintainers; [ gerschtli ];
70 # https://github.com/ets-labs/python-dependency-injector/issues/726
71 broken = versionAtLeast pydantic.version "2";
72 };
73}