1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 isPyPy,
6
7 # build-system
8 cython,
9 setuptools,
10 setuptools-scm,
11 packaging,
12 cffi,
13
14 # dependencies
15
16 py,
17 pytestCheckHook,
18 python,
19 pythonOlder,
20 tornado,
21 zeromq,
22 pytest-asyncio,
23}:
24
25buildPythonPackage rec {
26 pname = "pyzmq";
27 version = "25.1.2";
28 pyproject = true;
29
30 disabled = pythonOlder "3.6";
31
32 src = fetchPypi {
33 inherit pname version;
34 hash = "sha256-k/GqMR6LuRLjTwBM8YZAek6Q7sTw7MDv0mBWv37aAiY=";
35 };
36
37 nativeBuildInputs = [
38 setuptools
39 setuptools-scm
40 packaging
41 ] ++ (if isPyPy then [ cffi ] else [ cython ]);
42
43 buildInputs = [ zeromq ];
44
45 propagatedBuildInputs = lib.optionals isPyPy [ cffi ];
46
47 nativeCheckInputs = [
48 pytestCheckHook
49 tornado
50 pytest-asyncio
51 ];
52
53 pythonImportsCheck = [ "zmq" ];
54
55 pytestFlagsArray = [
56 "$out/${python.sitePackages}/zmq/tests/" # Folder with tests
57 # pytest.ini is missing in pypi's sdist
58 # https://github.com/zeromq/pyzmq/issues/1853#issuecomment-1592731986
59 "--asyncio-mode auto"
60 "--ignore=$out/lib/python3.12/site-packages/zmq/tests/test_mypy.py"
61 ];
62
63 disabledTests = [
64 # Tests hang
65 "test_socket"
66 "test_monitor"
67 # https://github.com/zeromq/pyzmq/issues/1272
68 "test_cython"
69 # Test fails
70 "test_mockable"
71 # Issues with the sandbox
72 "TestFutureSocket"
73 "TestIOLoop"
74 "TestPubLog"
75 ];
76
77 # Some of the tests use localhost networking.
78 __darwinAllowLocalNetworking = true;
79
80 meta = with lib; {
81 description = "Python bindings for ØMQ";
82 homepage = "https://pyzmq.readthedocs.io/";
83 license = with licenses; [
84 bsd3 # or
85 lgpl3Only
86 ];
87 maintainers = with maintainers; [ ];
88 };
89}