Skip to content

Add PEP 723 dependency metadata to examples - #1032

Open
shrishsk wants to merge 6 commits into
ni:masterfrom
shrishsk:users/kshrish/pep723-example-metadata
Open

shrishsk wants to merge 6 commits into
ni:masterfrom
shrishsk:users/kshrish/pep723-example-metadata

Conversation

@shrishsk

@shrishsk shrishsk commented Oct 16, 2026 •

Copy link
Copy Markdown

What does this Pull Request accomplish?

Adds PEP 723 dependency metadata after the module docstring in all 53 Python examples. Each script declares its directly imported third-party packages, including numpy, nitypes, matplotlib, and nptdms where applicable.

Closes #1030.

Why should this Pull Request be merged?

PEP 723-aware script runners can use the metadata to install the dependencies needed by each example, making the examples easier to run. Keeping the docstring first makes each example’s purpose immediately visible.

What testing has been done?

  • Audited imports in all 53 scripts against their declared distributions; all matched.
  • uv export --script parsed and resolved dependencies for all 53 scripts.
  • Ran pipx run --path on four examples importing matplotlib or nptdms. Dependency installation succeeded, but execution stopped at DAQmx calls because NI-DAQmx is not installed in the test environment.
  • git diff --check passed.

Signed-off-by: Shrish Kulkarni <shrish.kulkarni@ni.com>
@zhindes

zhindes commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator

Let's make sure @bkeryan reviews as well :)

Comment thread examples/analog_in/cont_voltage_acq_int_clk_every_n_samples_event.py Outdated
Comment thread examples/analog_in/ai_multi_task_pxie_ref_clk.py
Comment thread examples/analog_in/ai_multi_task_pxie_ref_clk.py
Comment thread examples/analog_in/ai_multi_task_pxie_ref_clk.py
Shrish Kulkarni added 3 commits October 16, 2026 22:57
Signed-off-by: Shrish Kulkarni <shrish.kulkarni@ni.com>
Signed-off-by: Shrish Kulkarni <shrish.kulkarni@ni.com>
@shrishsk

Copy link
Copy Markdown
Author

@bkeryan Thanks for the feedback. I moved the metadata below each docstring, updated the changelog, and revised the PR description to follow the project template and accurately reflect validation.

Comment thread CHANGELOG.md Outdated
shrishsk and others added 2 commits October 17, 2026 17:07
Co-authored-by: Brad Keryan <brad.keryan@emerson.com>
Signed-off-by: Shrish Kulkarni <shrish.kulkarni@ni.com>
@shrishsk

Copy link
Copy Markdown
Author

@bkeryan Thanks for the suggestion. I added the pipx/uv usage paragraph to the README’s Python Examples section and updated the changelog wording to explain how users can run examples with their dependencies installed automatically.

This branch has not been deployed

No deployments
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.

Add PEP 723 dependency metadata to example programs

3 participants