Hi Clément,
Astropy is fairly mature, and hence I am not sure that enough new
additions to the astropy core package are foreseen that we really need
it, but maybe it is still a good idea to have a kind of best practice
document. If we do have one, ideally it would just point to a generally
accepted one that we follow, a bit like we do for PEP 8, and have
minimal astropy specific content.
Indeed, the only astropy-specific content that I would really like to
have would be to make explicit the current practice that for smaller
contributions to existing sub-packages of astropy, one should follow
whatever the pattern is that is used in those. I'd very much like to no
longer have to discuss "src layout!" or "internal modules should be
prefixed by underscored!"), or to have to ask to please not add no-ops
like ``__all__: list[str] = []``.
On the specific examples you give, I think most are obvious except your
last one, viz., to "avoid mixin classes for code reuse, prefer protocols
and composable objects". We have not done that before (protocols didn't
exist), and at least at the sub-package level I don't think it is
particularly helpful if some newer parts were to follow that, while the
older parts do not, i.e., I think it would be better to change a whole
sub-package if it really turns out that the existing class hierarchies
have become too complicated. (I might add that so far in the cases where
protocols were suggested, it seemed nice in principle, but in practice
it turned out that it ended up requiring the addition of specific
attributes just to make them runtime checkable.)
Anyway, overall my main comment is that if we go ahead with this, any
recommendations in an APE should be for really widely *used* best
practice (e.g., in CPython itself, or in the wider scientific python
ecosystem).
All the best,
Marten