Looking at the links at the top of boilerplate.py it seems that the reasons for its existence (rather than dynamically generating wrapper functions at import time) is
the __name__ of functions was not writable in Python 2.2, and
there was no way to preserve the signatures of the wrappees (until the introduction of function signature objects in Python 3.3).
The first point is obviously no longer a problem. Regarding the second one, I see that IPython carries its own backport of Signature objects (https://github.com/ipython/ipython/blob/master/IPython/utils/_signatures.py), so it should be possible to at least display the correct signature within IPython (python2) even using dynamically generated wrappers.
Or we could (very reasonably) just wait until Py2 support is dropped to get rid of boilerplate.py; in such a case, it may make sense to integrate the running of boilerplate.py into python setup.py build, so that we don't forget it?
There is an open issue for checking that we have run boiler plate in the tests #3701
#3587 and #2736 are two half-started attempts to generate pyplot at run time. #4488 is a pass at a helper decorator for the same purpose.
There was some concern about the generating at runtime approach messing with static code analysis tools (like pycharm's auto complete / suggestions).
We do currently use their signature backport, but only if we are already in an IPython sessions (which we check by seeing if IPython is already in the sys.modules).
Activity
tacaswell commented on Oct 27, 2016
We just need to re-run boilerplate.py
anntzer commented on Oct 27, 2016
Looking at the links at the top of boilerplate.py it seems that the reasons for its existence (rather than dynamically generating wrapper functions at import time) is
The first point is obviously no longer a problem. Regarding the second one, I see that IPython carries its own backport of Signature objects (https://github.com/ipython/ipython/blob/master/IPython/utils/_signatures.py), so it should be possible to at least display the correct signature within IPython (python2) even using dynamically generated wrappers.
Or we could (very reasonably) just wait until Py2 support is dropped to get rid of boilerplate.py; in such a case, it may make sense to integrate the running of boilerplate.py into python setup.py build, so that we don't forget it?
tacaswell commented on Oct 27, 2016
There is an open issue for checking that we have run boiler plate in the tests #3701
#3587 and #2736 are two half-started attempts to generate pyplot at run time. #4488 is a pass at a helper decorator for the same purpose.
There was some concern about the generating at runtime approach messing with static code analysis tools (like pycharm's auto complete / suggestions).
We do currently use their signature backport, but only if we are already in an IPython sessions (which we check by seeing if IPython is already in the sys.modules).
anntzer commented on Oct 27, 2016
Given that pycharm even supports PEP484 semantics for type annotations (https://www.jetbrains.com/help/pycharm/2016.1/type-hinting-in-pycharm.html), I would be amazed that it is not able to support signature objects...
NelleV commented on Nov 10, 2016
This is fixed in both master and v2.x as of yesterday.