p4lang / p4runtime

Specification documents for the P4Runtime control-plane API
Apache License 2.0
146 stars 89 forks source link

Add Python package support? #324

Closed Yi-Tseng closed 3 years ago

Yi-Tseng commented 3 years ago

Hello maintainers,

I open this issue to see if anyone is interested in this feature.

Currently, I am maintaining some projects which use the P4Runtime Python library(_pb2.py) and try to improve the way to create the P4Runtime python library. So I made few code changes to my fork to support the Python package (using pip/setup.py to install) https://github.com/Yi-Tseng/p4runtime/commit/f623d27aa6ffde2c084e49cceb4ff031b02b0e73

This means developers can use the following command to install the P4Runtime python library:

pip3 install git+https://github.com/Yi-Tseng/p4runtime.git@pip-support

This package only includes the P4Runtime python library, but the setup.py script will install some dependencies such as:

We can also upload the package to pypi.org if merged, so people can simply use pip install p4runtime to install the library.

Let me know if anyone has any concerns.

Thanks

antoninbas commented 3 years ago

Sorry for the delay @Yi-Tseng. We discussed this at the 11/20/2020 P4 API WG meeting and everyone was in favor. I took a quick look at the fork and it looked good, so please feel free to open a PR.