Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 460608 - dev-python/protobuf-python - Enable building the experimental C++ implementation for Python messages
Summary: dev-python/protobuf-python - Enable building the experimental C++ implementa...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All All
: Normal enhancement (vote)
Assignee: Arfrever Frehtes Taifersar Arahesis
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-06 22:50 UTC by Remy Blank
Modified: 2018-02-12 23:19 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
python-cpp-protobuf.patch (python-cpp-protobuf.patch,1.24 KB, patch)
2015-07-29 12:42 UTC, Tom Daff
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Remy Blank 2013-03-06 22:50:50 UTC
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
Comment 1 Tom Daff 2015-07-29 12:42:34 UTC
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.
Comment 2 M. B. 2016-04-20 11:28:40 UTC
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
Comment 3 Remy Blank 2016-04-20 18:50:50 UTC
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.
Comment 4 SpanKY gentoo-dev 2016-04-21 05:29:44 UTC
yeah it's pretty unlikely C++ is going anywhere.  Google uses a *ton* of C++ internally, as well as a ton of protobufs.
Comment 5 M. B. 2016-07-02 15:35:32 UTC
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.
Comment 6 Arfrever Frehtes Taifersar Arahesis 2018-02-12 23:17:31 UTC
It was fixed in dev-python/protobuf-python-3.4.1.
Comment 7 Arfrever Frehtes Taifersar Arahesis 2018-02-12 23:19:13 UTC
And --cpp_implementation is passed unconditionally.