OpenAssetIO / OpenAssetIO/OpenAssetIO
Validate Python bindings argument config
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 348
- Forks
- 47
- PR merge metrics
- No merged PRs in 30d
Description
What
Add tests to validate that the arguments on Python bindings for functions/methods are configured correctly
Why
It's easy to make a typo and get them wrong, and fixing it can be an API breaking change.
ACs
Tests for all Python bindings of functions, to ensure that
- All arguments can be used as both positional and keyword (
py::args are added). - The arguments have the correct name, mirroring the C++ argument name.
Noneis disallowed (i.e..none(false)) as appropriate for pointer-like types, and lists of pointer-like types.
Original issue for posterity
What
Decide on Python bindings positional vs. keyword argument policy, and then conform and test them.
Why
If py::arg is not used to document constructor/method arguments, then pybind will require arguments to be positional.
However, this means the signature docstrings (also shown in some pybind exceptions) are less informative, e.g. arguments are named arg0 etc in the docs.
Using py::arg or py::arg_v to name the arguments gives better docs, but then by default also allows the arguments to be provided as keyword arguments.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the C++ Python binding definitions and the existing tests covering them, then run the relevant test suite to understand current coverage. Add checks for argument names, positional and keyword use, and appropriate None handling across all function bindings; done means the stated acceptance criteria pass for every binding.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- api, testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100