Skip to content

Commit 3f2f257

Browse files
Document how to add a setter/getter to the DataModel (review)
Answer the reviewer question "how does a developer add a new function": add a "Adding a new setter/getter" section to the lazy layer docstring listing the three steps (wrapper method, public method, spec entry) and noting that test_lazy catches a missing spec entry in CI. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Ramakrishna Prabhu <ramakrishnap@nvidia.com>
1 parent f5fccce commit 3f2f257

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

python/cuopt/cuopt/routing/_lazy.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,17 @@
2121
serializing a problem imports no CUDA/cuDF -- the wrapper is imported lazily
2222
only when a device build actually happens. ``test_lazy`` fails if this
2323
declared surface drifts from the wrapper.
24+
25+
Adding a new setter/getter to the DataModel:
26+
27+
1. Implement it on the C++ ``data_model_view_t`` and the Cython wrapper
28+
(``vehicle_routing_wrapper.pyx``).
29+
2. Add the public method in ``vehicle_routing.py`` -- validation and
30+
docstring -- forwarding to ``super()``.
31+
3. Add its name to ``_SETTERS`` (a mutator) or ``_GETTERS`` (a query) below.
32+
33+
``test_lazy`` cross-checks these names against the wrapper's surface, so a
34+
missing entry fails CI rather than silently dropping the call's data.
2435
"""
2536

2637
import threading

0 commit comments

Comments
 (0)