Difficulties documenting enum classes

10 views
Skip to first unread message

Alex Golec

unread,
May 28, 2020, 3:36:06 PM5/28/20
to sphinx-users

I'm trying to document a module I'm maintaining, and I'm finding it very difficult to get my enum classes documented properly. For instance, here's one that I'd like to document properly (source):


class
QOSLevel(Enum): '''Quality of service levels''' #: 500ms (fastest available) EXPRESS = '0' #: 750ms REAL_TIME = '1' #: 1000ms FAST = '2' #: 1500ms MODERATE = '3' #: 3000ms SLOW = '4' #: 5000ms DELAYED = '5'


My documentation for this is here (source):

.. autoclass:: tda.streaming.StreamClient.QOSLevel 
  :members:                                        
  :undoc-members:                                  
  :member-order: bysource                          


The output looks like this:

Screen Shot 2020-05-28 at 9.58.21 AM.png




Two things are immediately wrong here:

  • First off, the documentation strings I set are not rendering. I've attempted to follow some advice I've received before that worked for generic attributes, but it seems enums are somehow handled differently?

  • Secondly, it seems the :member-order: bysource directive is being ignored. I tried setting this both here and in conf.py, and neither place seems to allow the fields to be emitted in the proper order.

I'm using sphinx v3.0.4 for what it's worth. You can try to replicate the error by copy-pasting the following into your terminal:


git clone https
://github.com/alexgolec/tda-api.git cd tda-api git checkout remotes/origin/autodoc-bysource-not-working virtualenv -v virtualenv source virtualenv/bin/activate pip install -r requirements.txt make -f Makefile.sphinx html open docs-build/html/streaming.html # Only works on Mac OS

What gives?
Reply all
Reply to author
Forward
0 new messages