Sphinxの注意

  • automodule で docstring などを読み込むプログラム hogehoge.py は、以下を満たす必要がある。

    • ライブラリとして読み込めること

    • ファイル名に - は使えないこと

    • ファイル名、パッケージ名は数字で始められないこと

    • サブディレクトリに連番を入れて自動ソートさせる場合は、page010 などから始めること

    • 引数なしで実行しても正常終了すること

    以下のコマンドで確認する。

    python -m hogehoge
    python -c "import hogehoge"
    
  • サブディレクトリ subdir にあるプログラムを automodule で読み込む場合は、package にしたほうがよい。

    • 空の __init__.pyhogehoge.py ディレクトリ(source\subdir)に置く

    • conf.py で、conf.py ディレクトリをライブラリパスに入れる

    current_dir = os.path.abspath(os.path.dirname(__file__))
    sys.path.insert(0, current_dir)
    
  • hogehoge.py が同じディレクトリのライブラリを呼ぶ場合、conf.py でライブラリパスを指定する必要がある。

    sys.path.insert(0, os.path.join(current_dir, 'sbdir'))