1Protocol Buffers - Google's data interchange format 2=================================================== 3 4Copyright 2008 Google Inc. 5 6This directory contains the Python Protocol Buffers runtime library. 7 8Normally, this directory comes as part of the protobuf package, available 9from: 10 11 https://developers.google.com/protocol-buffers/ 12 13The complete package includes the C++ source code, which includes the 14Protocol Compiler (protoc). If you downloaded this package from PyPI 15or some other Python-specific source, you may have received only the 16Python part of the code. In this case, you will need to obtain the 17Protocol Compiler from some other source before you can use this 18package. 19 20Development Warning 21=================== 22 23The pure python performance is slow. For better performance please 24use python c++ implementation. 25 26Installation 27============ 28 291) Make sure you have Python 3.7 or newer. If in doubt, run: 30 31 $ python -V 32 332) If you do not have setuptools installed, note that it will be 34 downloaded and installed automatically as soon as you run `setup.py`. 35 If you would rather install it manually, you may do so by following 36 the instructions on [this page](https://packaging.python.org/en/latest/installing.html#setup-for-installing-packages). 37 383) Build the C++ code, or install a binary distribution of `protoc`. If 39 you install a binary distribution, make sure that it is the same 40 version as this package. If in doubt, run: 41 42 $ protoc --version 43 444) Build and run the tests: 45 46 $ python setup.py build 47 $ python setup.py test 48 49 To build, test, and use the C++ implementation, you must first compile 50 `libprotobuf.so`: 51 52 $ (cd .. && make) 53 54 On OS X: 55 56 If you are running a Homebrew-provided Python, you must make sure another 57 version of protobuf is not already installed, as Homebrew's Python will 58 search `/usr/local/lib` for `libprotobuf.so` before it searches 59 `../src/.libs`. 60 61 You can either unlink Homebrew's protobuf or install the `libprotobuf` you 62 built earlier: 63 64 $ brew unlink protobuf 65 66 or 67 68 $ (cd .. && make install) 69 70 On other *nix: 71 72 You must make `libprotobuf.so` dynamically available. You can either 73 install libprotobuf you built earlier, or set `LD_LIBRARY_PATH`: 74 75 $ export LD_LIBRARY_PATH=../src/.libs 76 77 or 78 79 $ (cd .. && make install) 80 81 To build the C++ implementation run: 82 83 $ python setup.py build --cpp_implementation 84 85 Then run the tests like so: 86 87 $ python setup.py test --cpp_implementation 88 89 If some tests fail, this library may not work correctly on your 90 system. Continue at your own risk. 91 92 Please note that there is a known problem with some versions of 93 Python on Cygwin which causes the tests to fail after printing the 94 error: `sem_init: Resource temporarily unavailable`. This appears 95 to be a [bug either in Cygwin or in 96 Python](http://www.cygwin.com/ml/cygwin/2005-07/msg01378.html). 97 98 We do not know if or when it might be fixed. We also do not know 99 how likely it is that this bug will affect users in practice. 100 1015) Install: 102 103 $ python setup.py install 104 105 or: 106 107 $ (cd .. && make install) 108 $ python setup.py install --cpp_implementation 109 110 This step may require superuser privileges. 111 NOTE: To use C++ implementation, you need to export an environment 112 variable before running your program. See the "C++ Implementation" 113 section below for more details. 114 115Usage 116===== 117 118The complete documentation for Protocol Buffers is available via the 119web at: 120 121 https://developers.google.com/protocol-buffers/ 122 123C++ Implementation 124================== 125 126The C++ implementation for Python messages is built as a Python extension to 127improve the overall protobuf Python performance. 128 129To use the C++ implementation, you need to install the C++ protobuf runtime 130library, please see instructions in the parent directory. 131