1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchPypi,
6 pythonOlder,
7 aiodns,
8 aiohttp,
9 flask,
10 mock,
11 opentelemetry-api,
12 opentelemetry-instrumentation,
13 opentelemetry-instrumentation-requests,
14 opentelemetry-sdk,
15 pytest,
16 pytest-asyncio,
17 pytest-trio,
18 pytestCheckHook,
19 requests,
20 setuptools,
21 six,
22 trio,
23 typing-extensions,
24}:
25
26buildPythonPackage rec {
27 version = "1.35.0";
28 pname = "azure-core";
29 pyproject = true;
30
31 disabled = pythonOlder "3.7";
32
33 __darwinAllowLocalNetworking = true;
34
35 src = fetchPypi {
36 pname = "azure_core";
37 inherit version;
38 hash = "sha256-wL5ShIlIXp7eWbaXHrY8HqrPg+9TABv+OQTkdelyvlw=";
39 };
40
41 build-system = [ setuptools ];
42
43 dependencies = [
44 requests
45 six
46 typing-extensions
47 ];
48
49 optional-dependencies = {
50 aio = [ aiohttp ];
51 tracing = [ opentelemetry-api ];
52 };
53
54 nativeCheckInputs = [
55 aiodns
56 flask
57 mock
58 opentelemetry-instrumentation
59 opentelemetry-instrumentation-requests
60 opentelemetry-sdk
61 pytest
62 pytest-trio
63 pytest-asyncio
64 pytestCheckHook
65 trio
66 ]
67 ++ lib.flatten (builtins.attrValues optional-dependencies);
68
69 # test server needs to be available
70 preCheck = ''
71 export PYTHONPATH=tests/testserver_tests/coretestserver:$PYTHONPATH
72 '';
73
74 enabledTestPaths = [ "tests/" ];
75
76 # disable tests which touch network
77 disabledTests = [
78 "aiohttp"
79 "multipart_send"
80 "response"
81 "request"
82 "timeout"
83 "test_sync_transport_short_read_download_stream"
84 "test_aio_transport_short_read_download_stream"
85 # disable 8 tests failing on some darwin machines with errors:
86 # azure.core.polling.base_polling.BadStatus: Invalid return status 403 for 'GET' operation
87 # azure.core.exceptions.HttpResponseError: Operation returned an invalid status 'Forbidden'
88 ]
89 ++ lib.optionals stdenv.hostPlatform.isDarwin [ "location_polling_fail" ];
90
91 disabledTestPaths = [
92 # requires testing modules which aren't published, and likely to create cyclic dependencies
93 "tests/test_connection_string_parsing.py"
94 # wants network
95 "tests/async_tests/test_streaming_async.py"
96 "tests/test_streaming.py"
97 # testserver tests require being in a very specific working directory to make it work
98 "tests/testserver_tests/"
99 # requires missing pytest plugin
100 "tests/async_tests/test_rest_asyncio_transport.py"
101 # needs msrest, which cannot be included in nativeCheckInputs due to circular dependency new in msrest 0.7.1
102 # azure-core needs msrest which needs azure-core
103 "tests/test_polling.py"
104 "tests/async_tests/test_base_polling_async.py"
105 "tests/async_tests/test_polling_async.py"
106 # infinite recursion with azure-storage-blob
107 "tests/async_tests/test_tracing_live_async.py"
108 "tests/test_serialization.py"
109 "tests/test_tracing_live.py"
110 ];
111
112 meta = with lib; {
113 description = "Microsoft Azure Core Library for Python";
114 homepage = "https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/core/azure-core";
115 changelog = "https://github.com/Azure/azure-sdk-for-python/blob/azure-core_${version}/sdk/core/azure-core/CHANGELOG.md";
116 license = licenses.mit;
117 maintainers = [ ];
118 };
119}