Skip to content

Johnfreeman/daq cmake issue174 install pyi files - #175

Open
jcfreeman2 wants to merge 7 commits into
developfrom
johnfreeman/daq-cmake_issue174_install_pyi_files
Open

Johnfreeman/daq cmake issue174 install pyi files#175
jcfreeman2 wants to merge 7 commits into
developfrom
johnfreeman/daq-cmake_issue174_install_pyi_files

Conversation

@jcfreeman2

@jcfreeman2 jcfreeman2 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Description

With this PR, if you pass a GENERATE_STUBS option to daq_add_python_bindings, the function will use pybind11-stubgen to generate *.pyi files off the bindings. This enables mypy to engage in a kind of type checking for Python code. See issue #174 for details.

To test, I've created a test build using this feature branch, MYPYFD_DEV_260804_A9 which passes the standard and extended integration tests. Note in the test build that GENERATE_STUBS was only passed to daq_add_python_bindings in conffwk and confgen; you can look for *.pyi files in those installations. Also looking for (official) confirmation from Pawel that the *.pyi files are accomplishing what CCM/Python developers are hoping for. Note I've added brief documentation both in the README.md and in-code comments.

Type of change

  • [X ] Documentation (non-breaking change that adds or improves the documentation)
  • [X ] New feature or enhancement (non-breaking change which adds functionality)
  • Optimization (non-breaking change that improves code/performance)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (whatever its nature)

Testing checklist

  • Unit tests pass (e.g. dbt-build --unittest)
  • [X ] Minimal system quicktest passes (pytest -s minimal_system_quick_test.py)
  • [X ] Full set of integration tests pass (dunedaq_integtest_bundle.sh)
  • Python tests pass if applicable (e.g. python -m pytest)
  • Pre-commit hooks run successfully if applicable (e.g. pre-commit run --all-files)

Of course, some of the above is N/A to a daq-cmake change.

Further checks

  • Code is commented where needed, particularly in hard-to-understand areas
  • Code style is correct (dbt-build --lint, and/or see https://dune-daq-sw.readthedocs.io/en/latest/packages/styleguide/)
  • If applicable, new tests have been added or an issue has been opened to tackle that in the future.
    (Indicate issue here: # (issue))

jcfreeman2 and others added 7 commits July 23, 2026 20:55
…ommit

* Removed unnecessary / flawed attempt to forward PYTHONPATH to the pybind11-stubgen call
* Added "ALL" to add_custom_target so the generation of *.pyi files will actually occur
* Install the *.pyi files
…a installations) pybind11-stubgen fails because it can't Python-import a package, copy the full Python code over to the build area
…ndard PYTHONPATH + the local package Python directory
…ly generated for DAL libraries. The work in this commit has brought up ideas for improvement addressed by my TODOs
…atively indicate to daq_add_python_bindings that you wish to generate pybind11-stubgen stubs
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.

2 participants