Skip to content

Remove duplicate session_pb2 codegen, add ni-apis submodule and dependency on ni.grpcdevice.v1.proto#2176

Merged
ni-jfitzger merged 10 commits intoni:masterfrom
rahur-NI:sessionProtoFileFromNiApisRepo
Apr 16, 2026
Merged

Remove duplicate session_pb2 codegen, add ni-apis submodule and dependency on ni.grpcdevice.v1.proto#2176
ni-jfitzger merged 10 commits intoni:masterfrom
rahur-NI:sessionProtoFileFromNiApisRepo

Conversation

@rahur-NI
Copy link
Copy Markdown
Contributor

@rahur-NI rahur-NI commented Apr 13, 2026

  • This contribution adheres to CONTRIBUTING.md.
  • I've updated CHANGELOG.md if applicable.
  • I've added tests applicable for this pull request

What does this Pull Request accomplish?

Replaces the duplicate session_pb2 protobuf codegen in each nimi-python driver modules with a dependency on ni.grpcdevice.v1.proto (similar to [ni/nidaqmx-python#859].

  • Replaced relative import from . import session_pb2 with absolute import session_pb2 in _grpc_stub_interpreter.py.mako
  • Install ni.grpcdevice.v1.proto>=1.0.0 as part of installers for modules that support grpc.
  • Updated mak files to remove generation of session_pb2.py and session_pb2_grpc.py
  • Added third_party/ni-apis as a git submodule pointing to [https://github.com/ni/ni-apis]
  • Deleted session.proto file

List issues fixed by this Pull Request below, if any.

What testing has been done?

  • A successful tox.
  • Codegen files have no changes other than importing from installed ni.grpcdevice.v1.proto package than importing from locally generated session_pb2 file as before.

@rahur-NI rahur-NI marked this pull request as ready for review April 13, 2026 19:18
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.85%. Comparing base (304563a) to head (4e099bd).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2176   +/-   ##
=======================================
  Coverage   89.85%   89.85%           
=======================================
  Files          73       73           
  Lines       19006    19006           
=======================================
+ Hits        17077    17078    +1     
+ Misses       1929     1928    -1     
Flag Coverage Δ
codegenunittests 84.90% <ø> (ø)
nidcpowersystemtests 94.65% <100.00%> (+0.04%) ⬆️
nidcpowerunittests 89.53% <ø> (ø)
nidigitalsystemtests 92.26% <100.00%> (ø)
nidigitalunittests 68.44% <ø> (ø)
nidmmsystemtests 92.72% <100.00%> (ø)
nifakeunittests 86.01% <100.00%> (ø)
nifgensystemtests 94.61% <100.00%> (ø)
nimodinstsystemtests 73.85% <ø> (ø)
nimodinstunittests 94.20% <ø> (ø)
nirfsgsystemtests 81.12% <100.00%> (ø)
niscopesystemtests 92.94% <100.00%> (ø)
niscopeunittests 43.20% <ø> (ø)
nisesystemtests 91.50% <ø> (ø)
niswitchsystemtests 82.03% <100.00%> (ø)
nitclksystemtests 94.87% <ø> (ø)
nitclkunittests 98.26% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ated/nidcpower/nidcpower/_grpc_stub_interpreter.py 89.40% <100.00%> (ø)
...ated/nidigital/nidigital/_grpc_stub_interpreter.py 89.60% <100.00%> (ø)
generated/nidmm/nidmm/_grpc_stub_interpreter.py 87.91% <100.00%> (ø)
generated/nifake/nifake/_grpc_stub_interpreter.py 85.11% <100.00%> (ø)
generated/nifgen/nifgen/_grpc_stub_interpreter.py 88.03% <100.00%> (ø)
generated/nirfsg/nirfsg/_grpc_stub_interpreter.py 78.32% <100.00%> (ø)
...enerated/niscope/niscope/_grpc_stub_interpreter.py 85.57% <100.00%> (ø)
...erated/niswitch/niswitch/_grpc_stub_interpreter.py 81.45% <100.00%> (ø)

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 304563a...4e099bd. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread tox.ini Outdated
Comment thread tools/install_local_wheel.py Outdated
Comment thread src/shared_protos/session.proto Outdated
@rahur-NI rahur-NI changed the title Remove duplicate session_pb2 codegen and add dependency on ni.grpcdevice.v1.proto Remove duplicate session_pb2 codegen, add ni-apis submodule and dependency on ni.grpcdevice.v1.proto Apr 14, 2026
@ni-jfitzger
Copy link
Copy Markdown
Collaborator

ni-jfitzger commented Apr 15, 2026

Please revert these ni-api changes until there's actually something to pull in.

I've been told we actually do need these, so disregard this comment.

@bkeryan
Copy link
Copy Markdown
Contributor

bkeryan commented Apr 15, 2026

Please revert these ni-api changes until there's actually something to pull in.

protoc needs a copy of session.proto in order to handle import "session.proto";

@ni-jfitzger
Copy link
Copy Markdown
Collaborator

Please revert these ni-api changes until there's actually something to pull in.

protoc needs a copy of session.proto in order to handle import "session.proto";

@bkeryan I don't understand. Doesn't ni.grpcdevice.v1.proto have the results of compiling the session.proto?

@ni-jfitzger
Copy link
Copy Markdown
Collaborator

Please revert these ni-api changes until there's actually something to pull in.

protoc needs a copy of session.proto in order to handle import "session.proto";

@bkeryan I don't understand. Doesn't ni.grpcdevice.v1.proto have the results of compiling the session.proto?

Oh, dang. We need it in order to compile our api-specific .proto files? That's annoying.

Comment thread .github/workflows/github_actions_aws_windows_python64.yml Outdated
Comment thread .github/workflows/check_latest_release.yml Outdated
Comment thread build/defines.mak
@ni-jfitzger
Copy link
Copy Markdown
Collaborator

@rahur-NI Did you have to do anything special to fetch the submodule, locally?
Do we need to update CONTRIBUTING.md?

@ni-jfitzger
Copy link
Copy Markdown
Collaborator

@rahur-NI Did you have to do anything special to fetch the submodule, locally? Do we need to update CONTRIBUTING.md?

Suggested that we make this the 2nd step in our CONTRIBUTING.md

1. Initialize and fetch submodules (also re-run this after `git pull` to keep the submodule up to date):

       git submodule update --init --recursive

   Optionally, configure git to do this automatically after `git fetch`, `git pull` and `git checkout`:

       git config submodule.recurse true

@ni-jfitzger
Copy link
Copy Markdown
Collaborator

Maybe we should also have a section that explains how to update the copy of ni-apis that's being used by our repo (git submodule update --remote).

I'm sure we'll need to periodically do this, but git submodule is pretty obscure stuff that I wouldn't expect even our maintainers to know or remember.

@rahur-NI
Copy link
Copy Markdown
Contributor Author

Maybe we should also have a section that explains how to update the copy of ni-apis that's being used by our repo (git submodule update --remote).

I'm sure we'll need to periodically do this, but git submodule is pretty obscure stuff that I wouldn't expect even our maintainers to know or remember.

Thanks Jay.. I had pushed previous changes.. Now i updated as per your suggestion and it makes more sense to include in this way.

@ni-jfitzger ni-jfitzger merged commit 3afe3e1 into ni:master Apr 16, 2026
39 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.

session.proto should be replaced with a dependency on ni.grpcdevice.v1.proto

4 participants