New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reorganize astropy.utils.misc a bit #2857
Conversation
<astropy#2835 (comment)> this adds the make_func_with_sig function to astropy.utils.misc. Taking advantage of this, a new astropy.utils.compat.misc.wraps function is provided as a replacement for functools.wraps, which provides the same functionality but while also preserving the original wrapped function's signature (so that it displays properly in help())
… thought. And most of them are in utilties/backwards compatibility features that aren't terribly important. But I found this one case where the new wraps implementation is useful. And there could be others in the future.
…_sig, rather than only allowing the name of the wrapped function to be used
…eplacement, such that the new function gets the same *name* as the function being wrapped as well
… number into the module make_func_with_sig was called from, and a test to prove that it works.
…mplementation available on Python 3.4 as well. As such I moved it out of astropy.utils.compat since it's really providing a new function rather than some backward/forward compatibility.
….utils.misc was getting a bit cluttered, so this introduces a few new astropy.utils modules so that astropy.utils.misc could be broken up a bit.
Any opinions on this? Part of what motivated this, by the way, was a branch in which I've introduced yet another new decorator called |
👍 but I do have minor concern on how much this would impact affiliated packages. |
Me too--really they should just use |
Went ahead and added a changelog entry clarifying which imports moved. I don't think this will have much impact but it can't hurt to have the change clearly documented. |
#2849 has been merged, so I'll go ahead and merge this too. If it ends up affecting any affiliated packages we'll find out quickly and I can take steps to make their lives easier. |
Reorganize astropy.utils.misc a bit
In Gammapy we used But could someone please wipe readthedocs so that this shows up at the right location (and hopefully with a docstring) in the development version of the docs? |
- Some members of ``astropy.utils.misc`` were moved into new submodules. | ||
Specifically: | ||
|
||
- ``deprecated`, ``deprecated_attribute``, and ``lazyproperty`` -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing double-backtick
``deprecated`
should be
``deprecated``
@cdeil - I've wiped latest and started a new build. |
@astrofrog Build log is here: I"ve seen this error before, but never figured out the reason ... any idea?
|
Fixed in Gammapy at https://github.com/gammapy/gammapy/pull/168/files without |
@cdeil Thanks, sorry for the trouble. And yes, import from |
I just ran into this change, with an sncosmo user working on astropy master. Glad to see the flatter However, the docs look like they don't reflect this still. That is, http://astropy.readthedocs.org/en/latest/api/astropy.utils.decorators.lazyproperty.html has the path as |
Thanks, I hadn't seen #2873. Looks like the docs issue will be resolved there. |
Reorganize astropy.utils.misc a bit
Reorganize astropy.utils.misc a bit
Following on from #2849, it became apparent to me that
astropy.utils.misc
was getting a bit cluttered, so this introduces a few newastropy.utils
modules so thatastropy.utils.misc
could be broken up a bit.Specifically it moves:
make_func_with_sig
into thecodegen
submoduledeprecated
,deprecated_attribute
,lazyproperty
, andwraps
into thedecorators
submodulefind_current_module
andfind_mod_objs
into theintrospection
submoduleAny other moves seem worthwhile? Note again, this has #2849 as a prerequisite.