python


sphinx documentation: split a python source into sections, using autodoc


I'm using Sphinx with autodoc to document my sources.
Lets say i have a file pre_processing.py, containing 3 classes.
I would like to have section in the generated html files, like this
Main
====
Topic1
------
blabla
Here is included class1 and class2 doc
Topic2
------
blibli
Here is included class3 doc
However , all that i can manage so far is this:
Main
====
Topic1
------
blabla
Here is a link to class1 and class2 doc
Topic2
------
blibli
Here is a link to class3 doc
Here is cdumped class1, class2 and class3
How can this be achieved please ? Do i have to abandon autodoc, and fill my rst file manually ?
You can do that, by putting your outline (and accompanying text) into the docstring of the module itself. Let’s say this is your pre_processing.py:
# yada yada license yada
"""
Main
====
Topic1
------
blabla
.. autoclass:: class1
.. autoclass:: class2
Topic2
------
blibli
Here is a link to class3 doc
"""
class class1(…):
"""
docstring of class 1
"""
…
Then you can simply use .. automodule: in your .rst file:
.. automodule:: pre_processing
That will first read the docstring of the module and generate the documentation from there. Due to the autoclass directives in there, the classes are also documented.

Related Links

xliff and placeable substitution
Checking that array doesn't contain negative numbers, and running function again if it does
Matplotlib and non-ascii characters
How does HttpResponse(status=<code>) work in django?
Write a CSV from Urlib and manage encoding properly
python - list index out of range, working with CSV?
Pandas DataFrame get substrings from column
Python GET is not working in browser
Django, Pinax, couldn't extract file
Getting proper list of members from pymongo
Not writing into an Excel file
How to integrate my python plugin with nagios
Find words containing . in middle or at the end
Using apply on a column
Maximum-sum subarray given constraints on indices
Converting text to columns

Categories

HOME
sql-server-2008
numpy
udp
erlang
wmic
drupal-7
blockchain
json-ld
avro
concourse
codeeffects
sbt-assembly
wampserver
orientation
phonegap-cli
gspread
cakephp-2.9
rfid
iso
game-maker-studio-1.4
camera-calibration
finite-group-theory
mongodb-query
local
maxima
future
react-leaflet
rapidjson
scala-native
ssms-2016
attask
ghost-inspector
jquery-scrollify
tfs2013
mayavi
fileinfo
reactiveui
superagent
getjson
pari
graph-databases
canvasjs
pljson
modelandview
ocs
superpowered
xen
text-files
broadleaf-commerce
duktape
ntfs-mft
datalog
taglib
ivona
openweathermap
appstore-approval
broadcast
mouseclick-event
spring-data-hadoop
google-maps-ios
instruction-set
unity3d-editor
addin-express
bettercms
vici
garrys-mod
createobject
system.web.ui.webcontrols
glkit
aescryptoserviceprovider
git-annex
unsatisfiedlinkerror
emokit
gradle-release-plugin
proxygen
android-recyclerview
wikitext
code-readability
epl
custom-url
utf-32
sysctl
mov
java-collections-api
ifft
logentries
gamepad
javascriptmvc
gridworld
ienumerator
multiple-conditions
template-haskell
getusermedia
plone-funnelweb
rose-db-object
userid
datacontract
newsstand-kit
ruby-debug
nagle
pureftpd
svn-hooks
recordset
aio
filetime
hmacsha1
database-diagramming

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App