55702
# 環境

  * sphinx 1.8.5

# やりたいこと

Read the DocsにPythonライブラリのリファレンスを公開したいです。  
リファレンスの主な内容はDocstringです。

# 今の状態

Read the Docsにアップロードはできましたが、Docstringは出力されていませんでした。  
<https://annofab-api-python-
client.readthedocs.io/en/latest/annofabapi.html#annofabapi-api-module>

ローカル環境で、`make html`コマンドを実行した場合は、Docstringは出力されます。

# 怪しそうな部分

Read the Docsのログを見ると、以下の警告が表示されています。

```

    WARNING: autodoc: failed to import module 'api' from module 'annofabapi'; the following exception was raised:
    No module named 'backoff'
    WARNING: autodoc: failed to import module 'exceptions' from module 'annofabapi'; the following exception was raised:
    No module named 'backoff'
    WARNING: autodoc: failed to import module 'generated_api' from module 'annofabapi'; the following exception was raised:
    No module named 'backoff'
    WARNING: autodoc: failed to import module 'resource' from module 'annofabapi'; the following exception was raised:
    No module named 'backoff'
    WARNING: autodoc: failed to import module 'typing' from module 'annofabapi'; the following exception was raised:
    No module named 'backoff'
    WARNING: autodoc: failed to import module 'utils' from module 'annofabapi'; the following exception was raised:
    No module named 'backoff'
    WARNING: autodoc: failed to import module 'wrapper' from module 'annofabapi'; the following exception was raised:
    No module named 'backoff'
    WARNING: autodoc: failed to import module 'annofabapi'; the following exception was raised:
    No module named 'backoff'
    
```

<https://readthedocs.org/api/v2/build/9201527.txt>

backoffはannofabapiの依存パッケージです。  
<https://github.com/litl/backoff>

他の依存パッケージと異なる部分は、backoffにはsetup.pyがないことです。

# 質問

Reat the DocsのドキュメントにDocstringを出力させるには、どのように対応すればよいでしょうか？」

# 追記：Read the Docsの設定

### 高度な設定のDefault Settings

[![画像の説明をここに入力](https://i.stack.imgur.com/hoeLb.png)](https://i.stack.imgur.com/hoeLb.png)  
[![画像の説明をここに入力](https://i.stack.imgur.com/LE2Dl.png)](https://i.stack.imgur.com/LE2Dl.png)

### requirements-doc.txtを追加

[requirements-doc.txt](https://github.com/kurusugawa-computer/annofab-api-
python-client/blob/master/requirements-doc.txt)を追加して、Read the
Docsの高度な設定で、requirements-doc.txtを設定しました。  
しかし、結果は変わりませんでした。  
また、[ビルド結果](https://readthedocs.org/projects/annofab-api-python-
client/builds/9212506/)のログを見る限り、`pip isntall`時に`requirements-
doc.txt`が読み込まれていませんでした。  
どのような設定にすれば、`requirements-doc.txt`が読み込まれるでしょうか？

```

    /home/docs/checkouts/readthedocs.org/user_builds/annofab-api-python-client/envs/latest/bin/python -m pip install --upgrade --cache-dir /home/docs/checkouts/readthedocs.org/user_builds/annofab-api-python-client/.cache/pip Pygments==2.3.1 setuptools==41.0.1 docutils==0.14 mock==1.0.1 pillow==5.4.1 alabaster>=0.7,<0.8,!=0.7.5 commonmark==0.8.1 recommonmark==0.5.0 sphinx<2 sphinx-rtd-theme<0.5 readthedocs-sphinx-ext<0.7
    Requirement already up-to-date: Pygments==2.3.1 in /home/docs/checkouts/readthedocs.org/user_builds/annofab-api-python-client/envs/latest/lib/python3.7/site-packages (2.3.1)
    Requirement already up-to-date: setuptools==41.0.1 in /home/docs/checkouts/readthedocs.org/user_builds/annofab-api-python-client/envs/latest/lib/python3.7/site-packages (41.0.1)
    Requirement already up-to-date: docutils==0.14 in /home/docs/checkouts/readthedocs.org/user_builds/annofab-api-python-client/envs/latest/lib/python3.7/site-packages (0.14)
    Requirement already up-to-date: mock==1.0.1 in /home/docs/checkouts/readthedocs.org/user_builds/annofab-api-python-client/envs/latest/lib/python3.7/site-packages (1.0.1)
    Requirement already up-to-date: pillow==5.4.1 in /home/docs/checkouts/readthedocs.org/user_builds/annofab-api-python-client/envs/latest/lib/python3.7/site-packages (5.4.1)
    Requirement already up-to-date: alabaster!=0.7.5,<0.8,>=0.7 in /home/docs/checkouts/readthedocs.org/user_builds/annofab-api-python-client/envs/latest/lib/python3.7/site-packages (0.7.12)
    Requirement already up-to-date: commonmark==0.8.1 in /home/docs/checkouts/readthedocs.org/user_builds/annofab-api-python-client/envs/latest/lib/python3.7/site-packages (0.8.1)
    Requirement already up-to-date: recommonmark==0.5.0 in /home/docs/checkouts/readthedocs.org/user_builds/annofab-api-python-client/envs/latest/lib/python3.7/site-packages (0.5.0)
    Requirement already up-to-date: sphinx<2 in /home/docs/checkouts/readthedocs.org/user_builds/annofab-api-python-client/envs/latest/lib/python3.7/site-packages (1.8.5)
    Requirement already up-to-date: sphinx-rtd-theme<0.5 in /home/docs/checkouts/readthedocs.org/user_builds/annofab-api-python-client/envs/latest/lib/python3.7/site-packages (0.4.3)
    Requirement already up-to-date: readthedocs-sphinx-ext<0.7 in /home/docs/checkouts/readthedocs.org/user_builds/annofab-api-python-client/envs/latest/lib/python3.7/site-packages (0.6.0)
    Requirement already satisfied, skipping upgrade: future in /home/docs/checkouts/readthedocs.org/user_builds/annofab-api-python-client/envs/latest/lib/python3.7/site-packages (from commonmark==0.8.1) (0.17.1)
    Requirement already satisfied, skipping upgrade: six>=1.5 in /home/docs/checkouts/readthedocs.org/user_builds/annofab-api-python-client/envs/latest/lib/python3.7/site-packages (from sphinx<2) (1.12.0)
    Requirement already satisfied, skipping upgrade: packaging in /home/docs/checkouts/readthedocs.org/user_builds/annofab-api-python-client/envs/latest/lib/python3.7/site-packages (from sphinx<2) (19.0)
    Requirement already satisfied, skipping upgrade: requests>=2.0.0 in /home/docs/checkouts/readthedocs.org/user_builds/annofab-api-python-client/envs/latest/lib/python3.7/site-packages (from sphinx<2) (2.22.0)
    Requirement already satisfied, skipping upgrade: babel!=2.0,>=1.3 in /home/docs/checkouts/readthedocs.org/user_builds/annofab-api-python-client/envs/latest/lib/python3.7/site-packages (from sphinx<2) (2.7.0)
    Requirement already satisfied, skipping upgrade: snowballstemmer>=1.1 in /home/docs/checkouts/readthedocs.org/user_builds/annofab-api-python-client/envs/latest/lib/python3.7/site-packages (from sphinx<2) (1.2.1)
    Requirement already satisfied, skipping upgrade: imagesize in /home/docs/checkouts/readthedocs.org/user_builds/annofab-api-python-client/envs/latest/lib/python3.7/site-packages (from sphinx<2) (1.1.0)
    Requirement already satisfied, skipping upgrade: Jinja2>=2.3 in /home/docs/checkouts/readthedocs.org/user_builds/annofab-api-python-client/envs/latest/lib/python3.7/site-packages (from sphinx<2) (2.10.1)
    Requirement already satisfied, skipping upgrade: sphinxcontrib-websupport in /home/docs/checkouts/readthedocs.org/user_builds/annofab-api-python-client/envs/latest/lib/python3.7/site-packages (from sphinx<2) (1.1.2)
    Requirement already satisfied, skipping upgrade: pyparsing>=2.0.2 in /home/docs/checkouts/readthedocs.org/user_builds/annofab-api-python-client/envs/latest/lib/python3.7/site-packages (from packaging->sphinx<2) (2.4.0)
    Requirement already satisfied, skipping upgrade: certifi>=2017.4.17 in /home/docs/checkouts/readthedocs.org/user_builds/annofab-api-python-client/envs/latest/lib/python3.7/site-packages (from requests>=2.0.0->sphinx<2) (2019.3.9)
    Requirement already satisfied, skipping upgrade: idna<2.9,>=2.5 in /home/docs/checkouts/readthedocs.org/user_builds/annofab-api-python-client/envs/latest/lib/python3.7/site-packages (from requests>=2.0.0->sphinx<2) (2.8)
    Requirement already satisfied, skipping upgrade: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /home/docs/checkouts/readthedocs.org/user_builds/annofab-api-python-client/envs/latest/lib/python3.7/site-packages (from requests>=2.0.0->sphinx<2) (1.25.3)
    Requirement already satisfied, skipping upgrade: chardet<3.1.0,>=3.0.2 in /home/docs/checkouts/readthedocs.org/user_builds/annofab-api-python-client/envs/latest/lib/python3.7/site-packages (from requests>=2.0.0->sphinx<2) (3.0.4)
    Requirement already satisfied, skipping upgrade: pytz>=2015.7 in /home/docs/checkouts/readthedocs.org/user_builds/annofab-api-python-client/envs/latest/lib/python3.7/site-packages (from babel!=2.0,>=1.3->sphinx<2) (2019.1)
    Requirement already satisfied, skipping upgrade: MarkupSafe>=0.23 in /home/docs/checkouts/readthedocs.org/user_builds/annofab-api-python-client/envs/latest/lib/python3.7/site-packages (from Jinja2>=2.3->sphinx<2) (1.1.1)
    Command time: 2s Return: 0
    
```

[![画像の説明をここに入力](https://i.stack.imgur.com/Qqmgw.png)](https://i.stack.imgur.com/Qqmgw.png)
CC BY-SA 4.0
2019-06-11T08:42:15.053
55698
2019-06-15T05:21:26.247
2019-06-13T02:53:29.973
19524
19524
question
python sphinx read-the-docs
Read the docsにアップロードしたドキュメントにDocstring出力されない
> 他の依存パッケージと異なる部分は、backoffにはsetup.pyがないことです。

backoffのPyPI登録状況を見ると、whlとtar.gzがあるので特に問題なさそうです。  
<https://pypi.org/project/backoff/#files>

<https://readthedocs.org/projects/annofab-api-python-client/builds/9201527/>
を見ると、 annofabapi のインストールをしてなさそうに見えます。ReadTheDocsの「プロジェクトのインストール」は設定していますか？

[![プロジェクトのインストール](https://i.stack.imgur.com/htfc6.png)](https://i.stack.imgur.com/htfc6.png)

* * *

6/13 追記

実際に設定している例だと <https://github.com/beproud/django-newauth> があります。  
設定のポイントは以下の通りです。

  1. [requirements-doc.txt](https://github.com/beproud/django-newauth/blob/master/requirements-doc.txt) でドキュメントビルド用の依存パッケージを記載している
  2. ReadTheDocsの「Requirements ファイル」にrequirements-doc.txtを指定している
  3. ReadTheDocsの「プロジェクトをインストール」のチェックを入れている

[![Requirements
ファイルとプロジェクトをインストール](https://i.stack.imgur.com/oNcrw.png)](https://i.stack.imgur.com/oNcrw.png)

  4. ReadTheDocsの[ビルド結果](https://readthedocs.org/projects/django-newauth/builds/7814197/)にインストールした状況が表示されている

[![ビルド結果](https://i.stack.imgur.com/Xo0aJ.jpg)](https://i.stack.imgur.com/Xo0aJ.jpg)

* * *

6/15 追記

`.readthedocs.yml` ファイルがあると、RTD設定画面上の指定は無視されるようです。  
<https://github.com/kurusugawa-computer/annofab-api-python-
client/blob/master/.readthedocs.yml> の最後の部文を以下の様に変更してみてください。

変更前

```

    python:
      version: 3
    
```

変更後

```

    python:
      version: 3
      install:
      - path: .
    
```

また、追加してもらった `requirements-doc.txt` は不要です（上記の指定で同じ意味になります）

`.readthedocs.yml` の設定内容については次のURLにドキュメントがあります
<https://docs.readthedocs.io/en/stable/config-file/v2.html>
CC BY-SA 4.0
2019-06-11T13:57:01.960
55702
2019-06-15T05:21:26.247
2019-06-15T05:21:26.247
806
806
55698
answer