# Cleanup pybind11 code in afw

XMLWordPrintable

#### Details

• Type: Story
• Status: Done
• Resolution: Done
• Fix Version/s: None
• Component/s:
• 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.
• 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
• 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

1. afw-cleanups.rst
7 kB

#### Activity

Jim Bosch created issue -
Field Original Value New Value
Epic Link DM-7717 [ 26925 ]
 Link This issue is triggered by DM-9063 [ DM-9063 ]
 Link This issue is blocked by DM-9099 [ DM-9099 ]
 Link This issue blocks DM-9100 [ DM-9100 ]
 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. - 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) - Look for comment headings that are unused or disrupt readability - Look for lambdas with non-const reference arguments; could they be const references? - Look for getters that should be using reference_internal - Look for returning 'this', especially in in-place operators - make sure call policy is correct. - 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. 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. - 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 - Look for lambdas with non-const reference arguments; could they be const references? - Look for getters that should be using reference_internal - Look for returning 'this', especially in in-place operators - make sure call policy is correct. - 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.
Hide
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
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.
 Status To Do [ 10001 ] In Progress [ 3 ]
 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. - 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 - Look for lambdas with non-const reference arguments; could they be const references? - Look for getters that should be using reference_internal - Look for returning 'this', especially in in-place operators - make sure call policy is correct. - 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. 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. - 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 - 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.
 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. - 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 - 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. 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. - 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.
 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. - 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. 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.
 Sprint DRP S17-3 [ 360 ] DRP S17-3, DRP S17-4 [ 360, 363 ]
 Rank Ranked higher
Pim Schellart [X] (Inactive) made changes -
 Component/s daf_persistence [ 10713 ] Component/s utils [ 10723 ] Component/s pex_exceptions [ 10728 ] Component/s daf_base [ 10756 ]
Pim Schellart [X] (Inactive) made changes -
 Summary Cleanup pybind11 code in afw and its dependencies Cleanup pybind11 code in afw
Hide
Pim Schellart [X] (Inactive) added a comment -

Moved dependencies to DM-9701.

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

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

Show
Pim Schellart [X] (Inactive) added a comment - Merged, so calling this done. Remaining cleanup will be done on separate ticket.
Pim Schellart [X] (Inactive) made changes -
 Resolution Done [ 10000 ] Status In Progress [ 3 ] Done [ 10002 ]

#### People

Assignee:
Jim Bosch
Reporter:
Jim Bosch
Watchers:
Jim Bosch, Pim Schellart [X] (Inactive)