Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-9182

Cleanup pybind11 code in afw



    • Type: Story
    • Status: Done
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: afw
    • Labels:
    • Story Points:
    • Sprint:
      DRP S17-3, DRP S17-4
    • Team:
      Data Release Production


      Following the review of DM-9063, I've put together a list of fixes to make for most of afw and its dependencies, which I have attached to the ticket. I have not looked at afw::table, as that will be reviewed and fixed independently on DM-8716.

      First, a list of generic issues that weren't worth capturing on a file-by-file basis (though I did start by doing that). This is essentially a checklist that should be used by all pybind11 cleanup issues:

      • Move trivial Python extensions to C++.
      • Use continueClass decorator in remaining Python files.
      • Reorganize/rename files as per RFC.
      • Address any TODOs
      • Remove commented-out headers.
      • Make sure pybind11 header is included first (because Python.h needs to be included first).
      • Remove (or otherwise address) commented-out code
      • Remove any use of ndarray/converters.h (redundant with ndarray/pybind11.h)
      • Make sure all functions that should have kwargs do.
      • Replace py::arg("foo") with "foo"_a (with using pybind11::literals)
      • Make sure shared_ptr holder type is used for all but trivial classes
      • Look for comment headings that are unused or disrupt readability
      • Make sure py::is_operator is used on binary, non-in-place operators, and is not used anywhere else.
      • Look for lambdas with non-const reference arguments; could they be const references?
      • Look for getters that should be using reference_internal
      • Remove spurious (empty) wrapper files.
      • Determine whether enums are used as enums or integer constants, and adjust wrappers accordingly.
      • Check for anonymous namespace and `static` usage.
      • Check for worthless module docstrings.
      • Define typedefs for py::class_ instantiations, or otherwise ensure they're not repeated.
      • Don't use ::Ptr (here, or anywhere).
      • Run clang-format? Some of indentation is really terrible at definitely not conformant, and clang-format improves it.
      • Delete trailing whitespace.


          Issue Links


            No work has yet been logged on this issue.


              jbosch Jim Bosch
              jbosch Jim Bosch
              Jim Bosch, Pim Schellart [X] (Inactive)
              0 Vote for this issue
              2 Start watching this issue