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