Skip to content
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

hide Index.get_values in docs and IPython tab completion #28772

Merged
merged 2 commits into from
Oct 5, 2019

Conversation

topper-123
Copy link
Contributor

@topper-123 topper-123 commented Oct 3, 2019

In #28621 I hid the deprecated method Index.set_value in the docs (in indexing.rst) and in the REPL/Ipython (by adding it to Index._deprecations). I like that as it hides not-recommended parts of the pandas API and guides users away from deprecated methods.

I've given the already deprecated method Indexc.get_values the same treatment in this PR. If there's consensus about it, I could go through various deprecations (at least the more obscure ones, like get_ftype_counts and get_ftype_counts etc.).

@WillAyd
Copy link
Member

WillAyd commented Oct 4, 2019

Does this make the doc unaccessible or just not shown in the API reference?

@WillAyd WillAyd added Deprecate Functionality to remove in pandas Docs labels Oct 4, 2019
@topper-123
Copy link
Contributor Author

topper-123 commented Oct 4, 2019

The removes the method name from Ipython (Index._deprecations) and in the doc TOC (indexing.rst). The underlying document is however still around, e.g. for Index.set_value, see here: https://dev.pandas.io/docs/reference/api/pandas.Index.set_value.html#pandas.Index.set_value

My interest is getting these out of the ipython tab-completion, so tabbing is more focused. I could revert the removal in the doc TOC, as I can see it's reasonable that deprecated methods are shown there.

@WillAyd WillAyd added this to the 1.0 milestone Oct 4, 2019
@WillAyd
Copy link
Member

WillAyd commented Oct 4, 2019

Makes sense. I'm fine with this either way - @TomAugspurger or @jorisvandenbossche might have some insights into how we've historically handled deprecated functions in the TOC

@jorisvandenbossche jorisvandenbossche changed the title hide Index.get_values in docs and Ipython hide Index.get_values in docs and IPython tab completion Oct 4, 2019
@jorisvandenbossche
Copy link
Member

+1 on removing them from tab completion (did that recently as well for attributes).

For the docs, in the autosummary tables they get a clear "DEPRECATED" in front (see eg in https://pandas.pydata.org/pandas-docs/stable/reference/series.html), there has been done some work to do that automatically. So I am also fine with keeping them, as it is quite visually clear they are deprecated. But of course, if it are many, it also clutters the page.
(and for people looking at those pages, they might actually realize that some methods they are using are deprecated)
But no strong opinion about it.

@jreback jreback merged commit 8a0553f into pandas-dev:master Oct 5, 2019
@jreback
Copy link
Contributor

jreback commented Oct 5, 2019

thanks . I wonder if we can have a test generally to avoid these issues? e.g. we should try to see if any tab completables show a deprecation warning and then fail the test.

@topper-123 topper-123 deleted the hide_index.get_values branch October 6, 2019 06:00
@jorisvandenbossche
Copy link
Member

@jreback I answered about that in the other PR as well: #28524 (comment)
Someone would need to find out how to write a test directly with jedi, as we already have this test for IPython and it doesn't catch those warnings.
Also, this is only for attribtues. Methods are not executed so don't raise a warning on tab-completion, so can't be catched that way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Deprecate Functionality to remove in pandas Docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants