Skip to content

[MRG] Correctly handle deprecated attribute warnings and docstrings#13635

Merged
TomDLT merged 4 commits intoscikit-learn:masterfrom
NicolasHug:deprecated_property
Apr 18, 2019
Merged

[MRG] Correctly handle deprecated attribute warnings and docstrings#13635
TomDLT merged 4 commits intoscikit-learn:masterfrom
NicolasHug:deprecated_property

Conversation

@NicolasHug
Copy link
Copy Markdown
Member

@NicolasHug NicolasHug commented Apr 13, 2019

Fixes #8113
Fixes #13489
Closes #8122

This PR fixes the warning and docstrings of deprecated attributes (i.e. deprecated properties):

  • warning do not start with "function blahblah is deprecated"
  • docstrings are properly rendered (see differences between the docstring of active_features here (this PR) and here(dev)). Note that deprecated attributes aren't part of the methods section anymore.

For this to work we need to enforce that the @property decorator comes before the deprecated decorator.

I updated the contributing guide and added a CI check regarding this.

@NicolasHug NicolasHug changed the title [WIP] Correctly handle deprecated attribute warnings and docstrings [MRG] Correctly handle deprecated attribute warnings and docstrings Apr 13, 2019
Copy link
Copy Markdown
Member

@jnothman jnothman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice :)

Copy link
Copy Markdown
Member

@jnothman jnothman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small note that this ordering is also important for uses of other descriptor decorators, such as @if_delegate_has_method

Co-Authored-By: NicolasHug <contact@nicolas-hug.com>
@TomDLT TomDLT merged commit 83dca7e into scikit-learn:master Apr 18, 2019
@TomDLT
Copy link
Copy Markdown
Member

TomDLT commented Apr 18, 2019

Nice !

jeremiedbb pushed a commit to jeremiedbb/scikit-learn that referenced this pull request Apr 25, 2019
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
koenvandevelde pushed a commit to koenvandevelde/scikit-learn that referenced this pull request Jul 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docstrings of deprecated attributes aren't rendered properly Warning of utils.deprecated for properties is ugly

3 participants