Deprecate old names & attributes in RegionProperties#7778
Deprecate old names & attributes in RegionProperties#7778stefanv merged 2 commits intoscikit-image:mainfrom
Conversation
| # Fallback to default behavior, potentially raising an attribute error | ||
| return self.__getattribute__(attr) |
There was a problem hiding this comment.
{type(self)} would print <class 'skimage.measure._regionprops.RegionProperties'> here which isn't really what we want.
Aside: I noticed that something magically appends
Did you mean '...'
to the previous error message. Apparently only for properties. E.g.
class A:
@property
def a(self):
return 3
def __getattr__(self, item):
raise AttributeError("not found")
A().A[...] line 7, in __getattr__
raise AttributeError("not found")
AttributeError: not found. Did you mean: 'a'
If that is official Python behavior I can't find a reference to this behavior? Am I crazy? 🤯
There was a problem hiding this comment.
What version of Python are you seeing this on? I don't see it with 3.13.
There was a problem hiding this comment.
Weird, I see it on 3.13.3 inside a simple repl:
Python 3.13.3 (main, Apr 9 2025, 07:44:25) [GCC 14.2.1 20250207] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> class A:
... @property
... def a(self):
... return 3
...
... def __getattr__(self, item):
... raise AttributeError("not found")
...
... A().A
...
Traceback (most recent call last):
File "<python-input-0>", line 9, in <module>
A().A
File "<python-input-0>", line 7, in __getattr__
raise AttributeError("not found")
AttributeError: not found. Did you mean: 'a'?There was a problem hiding this comment.
Haha, I have the same (i.e., AttributeError: not found. Did you mean: 'a'?) in Python 3.11.3... when I run spin python but not when I run spin ipython (I only get AttributeError: not found). 😅
There was a problem hiding this comment.
Looks like Python 3.11 and 3.12 behavior.
| # lower case names in PROPS are still accessible as attributes | ||
| # Make sure those emit an appropriate warning |
There was a problem hiding this comment.
To do: clarify this comment.
| # Fallback to default behavior, potentially raising an attribute error | ||
| return self.__getattribute__(attr) |
There was a problem hiding this comment.
Haha, I have the same (i.e., AttributeError: not found. Did you mean: 'a'?) in Python 3.11.3... when I run spin python but not when I run spin ipython (I only get AttributeError: not found). 😅
* origin/main: Deprecate estimate method in favor of class constructor (scikit-image#7771) Temporary fix for Visual Studio & Clang incompatibility in Windows image (scikit-image#7835) Address deprecations in Pillow 11.3 (scikit-image#7828) Remove unused & obsolete `legacy_datasets`, `legacy_registry` vars (scikit-image#7677) Draft migration guide for skimage2 (scikit-image#7785) Do not report failure in wheels sub-recipe (scikit-image#7806) Use consistent wording in property description. (scikit-image#7804) Add intensity_median to regionprops (scikit-image#7745) CI: Update pypa/gh-action-pypi-publish to v1.12.4 for attestations on PyPI (scikit-image#7793) Document output dtype for transform.resize. (scikit-image#7792) Use `cibuildwheel` to build WASM/Pyodide wheels for `scikit-image`, push nightlies to Anaconda.org (scikit-image#7440) DOC: Include missing gain parameter in adjust_gamma equation (scikit-image#7763) Temporarily pin to `pyodide-build==0.30.0`, and ensure that the correct xbuildenvs are used (scikit-image#7788) Deprecate old names & attributes in RegionProperties (scikit-image#7778) Pin JasonEtco/create-an-issue action to SHA for v2.9.2 (scikit-image#7787) Make doctest-plus work with spin (scikit-image#7786) Report failures on main via issue (scikit-image#7752) Use `workers` instead of alternate parameter names (scikit-image#7302) Fix f-string in otsu plot (scikit-image#7780) Further document use of regionprops function and fix terms. (scikit-image#7518)
* origin/main: (31 commits) Update import convention in certain gallery examples (scikit-image#7764) Refactor fundamental matrix scaling (scikit-image#7767) Add unit test for cval unequal to zero Forward in _generic_edge_filter Remove superfluous mask argument from _generic_edge_filter Only report failure on main branch once Deprecate estimate method in favor of class constructor (scikit-image#7771) Temporary fix for Visual Studio & Clang incompatibility in Windows image (scikit-image#7835) Address deprecations in Pillow 11.3 (scikit-image#7828) Remove unused & obsolete `legacy_datasets`, `legacy_registry` vars (scikit-image#7677) Draft migration guide for skimage2 (scikit-image#7785) Do not report failure in wheels sub-recipe (scikit-image#7806) Use consistent wording in property description. (scikit-image#7804) Add intensity_median to regionprops (scikit-image#7745) CI: Update pypa/gh-action-pypi-publish to v1.12.4 for attestations on PyPI (scikit-image#7793) Document output dtype for transform.resize. (scikit-image#7792) Use `cibuildwheel` to build WASM/Pyodide wheels for `scikit-image`, push nightlies to Anaconda.org (scikit-image#7440) DOC: Include missing gain parameter in adjust_gamma equation (scikit-image#7763) Temporarily pin to `pyodide-build==0.30.0`, and ensure that the correct xbuildenvs are used (scikit-image#7788) Deprecate old names & attributes in RegionProperties (scikit-image#7778) ...
Description
Closes #7732.
Checklist
./doc/examplesfor new featuresRelease note
For maintainers and optionally contributors, please refer to the instructions on how to document this PR for the release notes.