Repository navigation
API: make delay_doc_updates context manager a noop under Python's optimized mode - #17572
Conversation
|
Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
|
👋 Thank you for your draft pull request! Do you know that you can use |
d13d95f to
b8d372a
Compare
| see for example the source code of ``astropy.table.__init__``. | ||
| """ | ||
| self._delayed_docs_classes.add(cls) | ||
| if sys.flags.optimize < 2: |
There was a problem hiding this comment.
It'd require less indenting to invert this branch and use both a yield and then return. Then the normal mode doesn't need to be indented.
There was a problem hiding this comment.
I normally prefer this style because it more clearly reflects that both path are branches from the same conditional, but here the new path is indeed short enough that it makes sense to write it as a guard clause.
There was a problem hiding this comment.
But what does this mean for end-users? Perhaps mention that the help stuff won't work? Will it throw exception instead?
There was a problem hiding this comment.
But what does this mean for end-users?
As I said in the original post I don't even know if this context manager has end users. I'd like inputs on that.
Perhaps mention that the help stuff won't work? Will it throw exception instead?
Changes to help functions are found in #17571, which has (hopefully) clear changelog fragments.
I will add a what's new entry for 7.1 once we're get a stable dedicated CI job, which will cover user-facing changes.
| SKIPIF_OPTIMIZED_PYTHON = pytest.mark.skipif( | ||
| sys.flags.optimize >= 2, reason="docstrings are not available at runtime" | ||
| ) | ||
| ONLY_OPTIMIZED_PYTHON = pytest.mark.skipif( | ||
| sys.flags.optimize < 2, | ||
| reason="checking behavior specifically if docstrings are not present", | ||
| ) |
There was a problem hiding this comment.
Should these be generalized and reused elsewhere you did the optimized mode work? We probably don't need such specific reasons.
There was a problem hiding this comment.
I'm honestly not sure that it'd be worth the cost of less specific reasons + an additional indirection just to avoid repeating two lines over a couple files.
Though, if that's what the majority wants, maybe I could unify the implementation in a cleanup PR when everything is working ?
b8d372a to
482631d
Compare
delay_doc_updates context manager a noop under Python's optimized mode
482631d to
ed64a99
Compare
| -------- | ||
| see for example the source code of ``astropy.table.__init__``. | ||
| """ | ||
| if sys.flags.optimize >= 2: |
There was a problem hiding this comment.
Do we not have a CI test for optimized python?
|
Hi humans 👋 - this pull request hasn't had any new commits for approximately 4 months. I plan to close this in 30 days if the pull request doesn't have any new commits by then. In lieu of a stalled pull request, please consider closing this and open an issue instead if a reminder is needed to revisit in the future. Maintainers may also choose to add keep-open label to keep this PR open but it is discouraged unless absolutely necessary. If this PR still needs to be reviewed, as an author, you can rebase it to reset the clock. If you believe I commented on this pull request incorrectly, please report this here. |
|
I'm going to close this pull request as per my previous message. If you think what is being added/fixed here is still important, please remember to open an issue to keep track of it. Thanks! If this is the first time I am commenting on this issue, or if you believe I closed this issue incorrectly, please report this here. |
|
@neutrinoceros was there anything uncertain about this PR? |
ed64a99 to
cf47a12
Compare
|
not that I know of. It just got buried under a pile of other notifications. Let's try reviving it now. |
Description
ref #17472
I'm not 100% sure this needs a changelog entry (because I don't know if this method is used downstream and/or considered public) but if so, I got one.