nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ stdenv
2, lib
3, buildPythonPackage
4, fetchFromGitHub
5, fetchpatch
6, pythonOlder
7, setuptools-scm
8, idna
9, sniffio
10, typing-extensions
11, curio
12, hypothesis
13, mock
14, pytest-mock
15, pytestCheckHook
16, trio
17, trustme
18, uvloop
19}:
20
21buildPythonPackage rec {
22 pname = "anyio";
23 version = "3.5.0";
24 format = "pyproject";
25 disabled = pythonOlder "3.7";
26
27 src = fetchFromGitHub {
28 owner = "agronholm";
29 repo = pname;
30 rev = version;
31 sha256 = "sha256-AZ9M/NBCBlMIUpRJgKbJRL/oReZDUh2Jhwtoxoo0tMs=";
32 };
33
34 patches = [
35 (fetchpatch {
36 # Pytest 7.0 compatibility
37 url = "https://github.com/agronholm/anyio/commit/fed7cc4f95e196f68251bcb9253da3b143ea8e7e.patch";
38 sha256 = "sha256-VmZmiQEmWJ4aPz0Wx+GTMZo7jXRDScnRYf2Hu2hiRVw=";
39 })
40 ];
41
42 preBuild = ''
43 export SETUPTOOLS_SCM_PRETEND_VERSION=${version}
44 '';
45
46 nativeBuildInputs = [
47 setuptools-scm
48 ];
49
50 propagatedBuildInputs = [
51 idna
52 sniffio
53 ] ++ lib.optionals (pythonOlder "3.8") [
54 typing-extensions
55 ];
56
57 checkInputs = [
58 curio
59 hypothesis
60 pytest-mock
61 pytestCheckHook
62 trio
63 trustme
64 uvloop
65 ] ++ lib.optionals (pythonOlder "3.8") [
66 mock
67 ];
68
69 disabledTests = [
70 # block devices access
71 "test_is_block_device"
72 ];
73
74 disabledTestPaths = [
75 # lots of DNS lookups
76 "tests/test_sockets.py"
77 ] ++ lib.optionals stdenv.isDarwin [
78 # darwin sandboxing limitations
79 "tests/streams/test_tls.py"
80 ];
81
82 pythonImportsCheck = [ "anyio" ];
83
84 meta = with lib; {
85 description = "High level compatibility layer for multiple asynchronous event loop implementations on Python";
86 homepage = "https://github.com/agronholm/anyio";
87 license = licenses.mit;
88 maintainers = with maintainers; [ hexa ];
89 };
90}