Skip to content

DOC: add hidden IntervalIndex.str to prevent doc build warnings #16050

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

Conversation

jorisvandenbossche
Copy link
Member

@TomAugspurger @jreback This (should) fixes the warning related to the IntervalIndex.str, but, I was thinking we should maybe remove the full IntervalIndex class from the API docs?
I mean the class docstring, not the docstrings for the specific methods that are unique to the IntervalIndex

@jorisvandenbossche
Copy link
Member Author

For the constructor, we could add it as IntervalIndex.__init__, but the problem is that Indexes currently don't have a __init__ defined to put the docstring.

It is just that adding the full IntervalIndex add another > 100 pages to the API docs (making the doc build longer and the docs heavier), which are mostly not needed

@codecov
Copy link

codecov bot commented Apr 18, 2017

Codecov Report

Merging #16050 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #16050   +/-   ##
=======================================
  Coverage   90.79%   90.79%           
=======================================
  Files         156      156           
  Lines       50534    50534           
=======================================
  Hits        45883    45883           
  Misses       4651     4651
Flag Coverage Δ
#multiple 88.56% <ø> (ø) ⬆️
#single 40.44% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2522efa...bfaefbc. Read the comment docs.

@jreback
Copy link
Contributor

jreback commented Apr 18, 2017

yes certainly fine to remove interval from docs

@jreback
Copy link
Contributor

jreback commented Apr 18, 2017

what if we take off all of the index autogenerated ones (but leave the specifically named method), eg. remove the first second but leave the 2nd? @jorisvandenbossche @TomAugspurger

.. _api.categoricalindex:

CategoricalIndex
----------------

.. autosummary::
   :toctree: generated/

   CategoricalIndex

Categorical Components
~~~~~~~~~~~~~~~~~~~~~~

.. autosummary::
   :toctree: generated/

   CategoricalIndex.codes
   CategoricalIndex.categories
   CategoricalIndex.ordered
   CategoricalIndex.rename_categories
   CategoricalIndex.reorder_categories
   CategoricalIndex.add_categories
   CategoricalIndex.remove_categories
   CategoricalIndex.remove_unused_categories
   CategoricalIndex.set_categories
   CategoricalIndex.as_ordered
   CategoricalIndex.as_unordered

@jreback jreback added this to the 0.20.0 milestone Apr 18, 2017
@jorisvandenbossche
Copy link
Member Author

@jreback yes, I think that is a good idea.
The only thing is that I would like to have a docstring for the class/constructor itself as well. That could be done for the __init__ method, if Index would have that. But maybe I can also see if I can get it working with sphinx to create a class docstring page without all attributes.

@TomAugspurger
Copy link
Contributor

@jorisvandenbossche do you want me to take a look at this before the release? Just so I understand correctly.

But maybe I can also see if I can get it working with sphinx to create a class docstring page without all attributes

There is an exclude-members directive that works for autodoc. Let me check with autosummary. I worry a bit that our autosummary hack taken from numpy is ignoring the exclude-members directive.

@jorisvandenbossche
Copy link
Member Author

What I was thinking was to make a separate class template for those classes for which we don't want all the members listed. But didn't think it fully through yet.

Another option is for now just add a manual autodoc page for IntervalIndex that is not autogenerated and does not included the overview of all methods/attributes (but not sure whether this prevents it being overwritten by the automatic generation step)

If you have time to look at this, certainly feel free!

@TomAugspurger
Copy link
Contributor

@jorisvandenbossche I tried a few things to not autodoc everything on Index subclasses without success. Maybe just merge this as is for now. It'll remove the warnings at the least.

@TomAugspurger
Copy link
Contributor

@jorisvandenbossche newer versions of numpydoc have a numpydoc_show_inherited_class_members flag that does pretty much what we want I think. The only issue is you don't get any fine-grained control, but maybe that's OK.

@jorisvandenbossche
Copy link
Member Author

I am not sure we can use it in our case in general, as eg for DataFrame and Series we want all ones included, and not those that are inherited from NDFrame (but didn't try it, so don't know whether it makes sense).

@TomAugspurger
Copy link
Contributor

Oh yeah, of course. I was only thinking of public things that inherit from other public things :/

I'll see how hard it is to extend numpydoc to give us more control over what goes into autosummary. Not before the release though. Merge this in the meantime?

@jorisvandenbossche
Copy link
Member Author

Closed by alternative PR #16221

@jorisvandenbossche jorisvandenbossche deleted the doc-intervalindex-str branch May 4, 2017 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants