[PYTHON] Sphinx notes

Background

I've put together a list of things that I often use in Sphinx that won't come out without a little research.

Read an external csv file

.. csv-table::Sample data
   :file: sample.csv
   :encoding: utf-8
   :header-rows: 1
(Open a line)

For sample.csv, select "CSV UTF-8 (Comma delimited) (.csv)" from "Save As" in Excel and save it. At the end, after: header-rows, if you do not open one line, it will not be displayed. Also, put the csv file in the same directory as the program file.

Excel image on the left, HTML image on the right

スクリーンショット 2020-08-15 16.23.31.pngスクリーンショット2020-08-1516.28.06.png

Label reference on the same page

.. _`foo_label`:

===============
foo Methods
....
....
....

=============
At the top of the page:ref:`foo description<foo_label>`See.

Again, leave the next line of [.. _foo_label:] open.

How to add a constructor to a document

By default, the constructor is not added to the document.

Let's add as follows in conf.py.

def skip(app, what, name, obj, would_skip, options):
    if name == "__init__":
        return False
    return would_skip

def setup(app):
    app.connect("autodoc-skip-member", skip)

Then the constructor will not be skipped.

reference

[How to use Sphinx's autodoc to document the __init __ (self) method of a class? ](How to document the init- (self) method of a class using autodoc at https://www.it-swarm.dev/ja/python/sphinx?/971302038/) 1. Practice of restructured text

Recommended Posts

Sphinx notes
JetBrains_Learning Notes_003
Upgrade Sphinx
SQLAlchemy notes
pyenv notes
SQL notes
Sphinx installation
Pandas notes
django notes
Jupyter_Learning Notes_000
Django notes
Python scraping notes
Mecab installation notes
Python study notes _000
Sphinx setup summary
Python learning notes
concurrent.futures Usage notes
Theano installation notes
sphinx play editor
Jupyter study notes_006
[Django] as_view () notes
Notes about with
Python beginner notes
Theano's basic notes
Linux study notes
Notes on Flask
Django's order_by notes
Django Template notes
python C ++ notes
pyenv installation notes
Python study notes _005
Python grammar notes
Python Library notes
Hydrogen installation notes
Jupyter study notes_008
python personal notes
Jupyter study notes_004
Notes about pytorch
Jupyter study notes_001
python pandas notes
[Django] JWT notes
Python study notes_001
python learning notes
Python3.4 installation notes
Cabocha installation notes