File: README.md

package info (click to toggle)
pyzmq 20.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,228 kB
  • sloc: python: 14,051; ansic: 941; cpp: 315; makefile: 179; sh: 32
file content (39 lines) | stat: -rw-r--r-- 893 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Cython example

pyzmq 19 improved the Cython interface for pyzmq,
allowing easier access to libzmq.

When using pyzmq, you can:

```python
cimport zmq
```

or use the underlying wrapped libzmq as

```python
from zmq cimport libzmq
```

which exposes various functions and type definitions.

The `setup.py` file includes examples of what's needed to build a package that uses the Cython exports,
mainly the use of `include_dirs=zmq.get_includes()` which helps Cython find the zmq definitions.

To use this example:

```bash
python setup.py build_ext --inplace
python example.py -n 100000
```


which will give measurements of throughput with the Python API and calling
the underlying API via Cython, e.g.

```
Sending 5000000 messages on tcp://127.0.0.1:5555 with Cython
Cython:    2061989 msgs/sec
Sending 5000000 messages on tcp://127.0.0.1:5555 with Python
Python:     857856 msgs/sec
```