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

Cleanup pybind11 code in afw

    Details

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

      Description

      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.

        Attachments

          Issue Links

            Activity

            Hide
            jbosch Jim Bosch added a comment -

            Starting this mostly to provide some clean examples for RFC-281; will move to the back burner again when I've made enough progress for that.

            Show
            jbosch Jim Bosch added a comment - Starting this mostly to provide some clean examples for RFC-281 ; will move to the back burner again when I've made enough progress for that.
            Hide
            pschella Pim Schellart [X] (Inactive) added a comment -

            Moved dependencies to DM-9701.

            Show
            pschella Pim Schellart [X] (Inactive) added a comment - Moved dependencies to DM-9701 .
            Hide
            pschella Pim Schellart [X] (Inactive) added a comment -

            Merged, so calling this done. Remaining cleanup will be done on separate ticket.

            Show
            pschella Pim Schellart [X] (Inactive) added a comment - Merged, so calling this done. Remaining cleanup will be done on separate ticket.

              People

              • Assignee:
                jbosch Jim Bosch
                Reporter:
                jbosch Jim Bosch
                Watchers:
                Jim Bosch, Pim Schellart [X] (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Summary Panel