Repository navigation
Skimage2 -> Skimage1 doctest postprocessing - #8219
Conversation
|
Too many files changed for review. ( Bypass the limit by tagging |
5360d73 to
66d80dc
Compare
4ab11e9 to
0ec9f56
Compare
Only implicitly use own callable, and `np`, in doctests, import everything else explicitly.
Cursor, comprehensively refactored and reviewed by MB.
0ec9f56 to
a78cd7b
Compare
|
This one is ready for review. Notice that addition back of the |
* origin/main: Ignore pyenv virtualenv env name marker (scikit-image#8233)
Always set doctest_requires markers, whether package is installed at initial import time or not. And add version requirement to doctest_requires for safety. And add tests for doctest_requires machinery.
Rather than checking a possibly-varying doctest_requires element / version.
For efficiency, but perhaps not clarity.
* origin/main: Harmonize doctest imports (scikit-image#8234)
To allow more flexible adaptation.
Largely Deepseek with edits from MB.
c8e311e to
3865276
Compare
It looks like these two need special-casing |
| @@ -0,0 +1,230 @@ | |||
| """Adapt ``_skimage2`` doctest examples for the public ``skimage`` namespace. | |||
There was a problem hiding this comment.
Is the plan to have a separate set of adapters in skimage2 to change the docstrings from _skimage2 -> skimage2?
There was a problem hiding this comment.
Well - I was thinking would be temporary, until our full release, at which point we can search replace _skimage2 in the docstrings. What do you think?
There was a problem hiding this comment.
That sounds reasonable for now
Only create new classes as necessary, to avoid overhead. Refactor class-making code for clarity.
Slight refactor of original code to use class member marker as class to return when adding instances of different types.
Working on it! |
Sorry - on reflection - I guess this code is to avoid the How would this deal with cases like |
PYTHONOPTIMIZE=2 strips docstrings, so docstrings are always None.
See top comment in PR for discussion of |
|
I'm working on the data files refactor now in #8240. Of relevance to this PR:
|
Yes
I think for the special cases the post adaptation would still be in |
I'm vaguely against, on the basis that you gave - that it's harder to think about what's going on. If we'd started there, I'd say yes, but given we already have all the boilerplate, my preference is to leave it. Happy to be overruled. |
Fair enough, given that this whole part of the tree will be removed. It just looked really ugly to me. 😄 |
| _PARAMS_DEP_STOP = '2.2' | ||
|
|
||
|
|
||
| class BaseModel: |
There was a problem hiding this comment.
It looks like we can't remove this until skimage 2.2?
|
Yes, fair enough. Though, I guess we’re trading ugliness for
transparency. Again, I don’t feel that strongly. What does everyone else
think?
This email is fully human-source. Unless I'm quoting AI, I did not use
AI for any text in this email.
…On Sat, 4 Jul 2026 at 12:05, Steven Silvester ***@***.***> wrote:
*blink1073* left a comment (scikit-image/scikit-image#8219)
<#8219 (comment)>
my preference is to leave it
Fair enough, given that this whole part of the tree will be removed. It
just looked really ugly to me. 😄
—
Reply to this email directly, view it on GitHub
<#8219?email_source=notifications&email_token=AAAQQHBDKIWEZIVGG7M3CI35DETMHA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIOBYGI4TQNRYGU4KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-4882986858>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAQQHGD7PK4YB47B4JNLAT5DETMHAVCNFSNUABDKJSXA33TNF2G64TZHMZDAMJUHEZDSO2JONZXKZJ3GQ3DIOJRHA2DOOJVUF3AE>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/AAAQQHH57BDNUZ6TNBMS3IL5DETMHA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIOBYGI4TQNRYGU4KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KUZTPN52GK4S7NFXXG>
and Android
<https://github.com/notifications/mobile/android/AAAQQHGNJIRCQCR6NVWUAPD5DETMHA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIOBYGI4TQNRYGU4KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2K4ZTPN52GK4S7MFXGI4TPNFSA>.
Download it today!
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
|
Ah yes I see what you mean. Perhaps we can change our minds about that?
This email is fully human-source. Unless I'm quoting AI, I did not use
AI for any text in this email.
…On Sat, 4 Jul 2026 at 12:07, Steven Silvester ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/_skimage2/measure/fit.py
<#8219 (comment)>
:
> @@ -43,16 +43,6 @@ def residuals(self, *data): ...
_PARAMS_DEP_STOP = '2.2'
-class BaseModel:
It looks like we can't remove this until skimage 2.2?
—
Reply to this email directly, view it on GitHub
<#8219?email_source=notifications&email_token=AAAQQHHNF3S7JE5XIXR3VU35DETUFA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTINRSHE4TAMRYHA42M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#pullrequestreview-4629902889>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAQQHFLYKU4WWAPR3DTRFD5DETUFAVCNFSNUABDKJSXA33TNF2G64TZHMZDAMJUHEZDSO2JONZXKZJ3GQ3DIOJRHA2DOOJVUF3AE>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/AAAQQHBBPDZIQETIDC3U2ZL5DETUFA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTINRSHE4TAMRYHA42M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KUZTPN52GK4S7NFXXG>
and Android
<https://github.com/notifications/mobile/android/AAAQQHGKXBZJ3LKXWEYS2635DETUFA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTINRSHE4TAMRYHA42M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2K4ZTPN52GK4S7MFXGI4TPNFSA>.
Download it today!
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Was this in response to my BaseModel question? The email response didn't preserve the thread |
|
Yes, that was in response to your BaseModel question. Sorry, am on phone
with very bad internet.
This email is fully human-source. Unless I'm quoting AI, I did not use
AI for any text in this email.
…On Sat, 4 Jul 2026 at 12:14, Steven Silvester ***@***.***> wrote:
*blink1073* left a comment (scikit-image/scikit-image#8219)
<#8219 (comment)>
Ah yes I see what you mean. Perhaps we can change our minds about that?
Was this in response to my BaseModel question? The email response didn't
preserve the thread
—
Reply to this email directly, view it on GitHub
<#8219?email_source=notifications&email_token=AAAQQHDWW52TIYDBOH7KKIT5DEUNVA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIOBYGMYDCMZZGIZKM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-4883013922>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAQQHH2V6UHS45VCVITTN35DEUNVAVCNFSNUABDKJSXA33TNF2G64TZHMZDAMJUHEZDSO2JONZXKZJ3GQ3DIOJRHA2DOOJVUF3AE>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/AAAQQHHQZGXH5V7OOH4735T5DEUNVA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIOBYGMYDCMZZGIZKM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KUZTPN52GK4S7NFXXG>
and Android
<https://github.com/notifications/mobile/android/AAAQQHFCAUCHMN2CODOJXLT5DEUNVA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIOBYGMYDCMZZGIZKM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2K4ZTPN52GK4S7MFXGI4TPNFSA>.
Download it today!
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
|
Was there a need to remove BaseModel in this PR specifically? |
|
I moved it only because it was inconvenient to try and intercept the
deprecation warning when making the skimage subclass. Can go back and do
that instead.
This email is fully human-source. Unless I'm quoting AI, I did not use
AI for any text in this email.
…On Sat, 4 Jul 2026 at 15:58, Steven Silvester ***@***.***> wrote:
*blink1073* left a comment (scikit-image/scikit-image#8219)
<#8219 (comment)>
Was there a need to remove BaseModel in this PR specifically?
—
Reply to this email directly, view it on GitHub
<#8219?email_source=notifications&email_token=AAAQQHCCT33L5LWWMTSRXNT5DFOV5A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIOBYGM3DGNRWHAY2M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-4883636681>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAQQHHOREYTCNDVY62XQOD5DFOV5AVCNFSNUABDKJSXA33TNF2G64TZHMZDAMJUHEZDSO2JONZXKZJ3GQ3DIOJRHA2DOOJVUF3AE>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/AAAQQHCGHLHPO76UDHQ2LQL5DFOV5A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIOBYGM3DGNRWHAY2M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KUZTPN52GK4S7NFXXG>
and Android
<https://github.com/notifications/mobile/android/AAAQQHCXMLH5FZBTBCLYZN35DFOV5A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIOBYGM3DGNRWHAY2M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2K4ZTPN52GK4S7MFXGI4TPNFSA>.
Download it today!
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Now we aren't defining classes where there is no docstring change, we don't need to worry about deprecationwarning in inheriting from BaseModel in shim.
Give up on modification of `_skimage2.transform._geometric.ProjectiveTransform` to remove any remaining changes to `_skimage2` tree. Apply Deepseek suggestion of redefining `__add__` for the ProjectiveTransform classes, but do it by hand and write my own explanations.
Also: expand / rewrite docstrings.
This was in reference to BaseModel again. The problem I was trying to address by moving BaseModel was triggering the deprecation warning during |
* origin/main: Convert contribution guide to Markdown format (scikit-image#8188)
Adapt shim docstrings so skimage users see skimage doctests.
After the megamove, canonical docstrings live in _skimage2 and use internal
imports (e.g.
from _skimage2 import data). This adds a shim-layer adapter sohelp(), Sphinx, andskimagedoctests exposeskimageexamples instead,while leaving
skimage2doctests intact.There are various things worth discussing:
_copy_callableinsrc/skimage/_docstring_adapters.py), and replacing the docstring.skimage.transform._geometricclasses. The new classes inherit from the old, but this affects the inheritance line of the new classes. Consider original class B that inherits from original class A. The new class A' inherits from A, and new class B' inherits from B. But now B' does not inherit from A'. This messes up some behavior, and in particular it was messing up the behavior of the__add__function for theProjectiveTransformhierarchy. I used a version of a fix suggested by DeepSeek, which is to a) useABC.registerformally note the inheritance of e.g.AffineTransformfromProjectiveTransform, and b) rewrite the__add__method of the shim versions to refer to the shim versions ofProjectiveTransform. This is somewhat of a hack, but at least the hack is local to the shims, and we're expecting to be able to remove the shims in a few years.io.collectionsdocstring work, I needed to the docstrings to know where the in-tree data files are. They are always in the_skimage2tree, and not in theskimagetree. So I needed a newlegacy_data_dirattribute of_skimage2.datato point to the directory containing these files -_skimage2/data- so I could use this for doctests in both_skimage2andskimage. This does add something to the API surface for both namespaces, but we do need some way of telling the user where these files are - or we need to move them somewhere - or we need to adapt data fetching somehow so the user can get the files without needed their location. Happy for advice.AI declaration
Initially generated by Cursor and Deepseek. I have guided and refactored and reviewed, so the current code is a substantial mix of AI and I.