Starting with 2.4.0, there is an experimental C++ implementation for Python messages that is compatible with the pure-Python implementation, but massively faster. For more information, search for PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION in the URL above. In 2.4.x, setting PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp in a local bashrc was enough to compile the experimental version. This doesn't work anymore with 2.5.0. When compiling 2.5.0 "by hand", in addition to setting the environment variable above, it is necessary to pass additional arguments to "build_ext". The following command works, when run from the "python" directory: python setup.py build build_ext -I ../src -L ../src/.libs Of course, when building for several Python targets, the include and library paths may have to be adapted. I haven't found a way to integrate this into protobuf-2.5.0.ebuild. It looks like there's no easy way to pass additional arguments to the "python setup.py build" command. Ideally, building the C++ implementation would be gated by a USE flag. Reproducible: Always
Created attachment 407888 [details, diff] python-cpp-protobuf.patch Adding the environment variables and the '--cpp_implementation' to the setup.py call give me the cpp implementation.
Upstream is a little ambiguous about it [0], but it's merely a wrapping of libprotobuf.so as a Python2 module. And in my understanding, it's not experimental, it's being phased out in favor of the pure python implementation. Protobuf 3 adds support for Python 3.3 and higher. Therefore I've decided to not add support for the C++ implementation. I suggest closing this as WONTFIX. [0] https://github.com/google/protobuf/tree/master/python
I would be extremely surprised if Google was phasing out the C++ implementation in favor of the pure Python one, considering it has vastly better performance and is used internally. In the meantime, it's also not experimental anymore.
yeah it's pretty unlikely C++ is going anywhere. Google uses a *ton* of C++ internally, as well as a ton of protobufs.
The way I understood it, this regards only the Python implementation, it being a wrapper for the C++ implementation. Of course, the main protobuf stuff will remain C++; just the wrapper is supposed to be replaced by a "native" Python implementation.
It was fixed in dev-python/protobuf-python-3.4.1.
And --cpp_implementation is passed unconditionally.