Skip to content

Remove use of obsolete Python package p4.tmp - #754

Merged
jafingerhut merged 1 commit into
masterfrom
remove-use-of-python-package-p4-tmp
Aug 25, 2026
Merged

Remove use of obsolete Python package p4.tmp#754
jafingerhut merged 1 commit into
masterfrom
remove-use-of-python-package-p4-tmp

Conversation

@jafingerhut

Copy link
Copy Markdown
Collaborator

No description provided.

Signed-off-by: Andy Fingerhut <andy_fingerhut@alum.wustl.edu>
@jafingerhut

Copy link
Copy Markdown
Collaborator Author

Without these changes, when the Python P4Runtime API client code in this tutorials repo sends a SetForwardingPipelineConfig message to the simple_switch_grpc process, it executes code from the p4lang/PI library in this file, currently at these lines: https://github.com/p4lang/PI/blob/main/proto/frontend/src/device_mgr.cpp#L499-L508

This code is copied and pasted below:

    p4::tmp::P4DeviceConfig p4_device_config;
    const std::string *device_data = nullptr;
    bool uses_legacy_p4_device_config = false;
    if (p4_device_config.ParseFromString(config.p4_device_config())) {
      device_data = &p4_device_config.device_data();
      uses_legacy_p4_device_config = true;
      Logger::get()->warn("p4::tmp::P4DeviceConfig is deprecated");
    } else {
      device_data = &config.p4_device_config();
    }

The condition of the if statement is true. Note that warn() call that the use of p4::tmp::P4DeviceConfig is deprecated. The code works correctly because it still checks for this case and handles it properly.

However, if one simply avoids using the P4DeviceConfig message from the p4.tmp Python package, then the condition of the if statement is false, and everything still works properly, without the warning that it is a deprecated situation. In addition, we no longer need the p4.tmp package code to be installed in order to run the tutorials.

One of the practical effects of this is that by doing pip install p4runtime, we can run the tutorials on a system that did not have the p4lang/PI package installed from source code. As of now, the Python package p4runtime does not include the p4.tmp package, and with this change, there is less desire to add that obsolete code to the p4runtime Python package.

@jafingerhut
jafingerhut merged commit f5a0e52 into master Aug 25, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant