【问题标题】:Sphinx docs builds fail on readthedocs for private GitHub repositorySphinx 文档构建在私有 GitHub 存储库的 readthedocs 上失败
【发布时间】:2019-11-29 19:27:06
【问题描述】:

我已经为 Python 3.6 项目设置并构建了 Sphinx 文档 (2.1.2),该项目目前位于私有 GitHub 存储库中。我想在公开发布项目后在 readthedocs.org 上托管文档,但目前 readthedocs 构建总是失败并显示此错误消息

 git clone --no-single-branch --depth 50 https://github.com/<user name>/<repo name> .

Cloning into '.'...
fatal: could not read Username for 'https://github.com': terminal prompts disabled

我尝试查看 readthedocs 项目设置,但似乎找不到要修改的正确设置以使构建工作。配置。 YAML 是直接从 Python 项目的 readthedocs 模板复制而来的。

# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
  builder: html
  configuration: docs/conf.py
  fail_on_warning: false

# Build documentation with MkDocs
#mkdocs:
#  configuration: mkdocs.yml

# Optionally build your docs in additional formats such as PDF and ePub
formats: htmlzip

# Optionally set the version of Python and requirements required to build your docs
python:
   version: 3.6
   install:
      - requirements: docs/requirements.txt
      - requirements: requirements.txt
      - method: pip
   system_packages: true

这是docs/conf.py

# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# http://www.sphinx-doc.org/en/master/config

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath(os.pardir))


# -- Project information -----------------------------------------------------

project = '<project name>'
copyright = '2019, <author>'
author = '<author>'

# The full version, including alpha/beta/rc tags
release = '0.1.0'


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
    'recommonmark',
    'sphinx.ext.autodoc',
    'sphinxcontrib.httpdomain',
    'sphinx.ext.intersphinx',
    'sphinx.ext.todo',
    'sphinx.ext.coverage',
    'sphinx.ext.viewcode',
    'sphinx.ext.githubpages'
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
source_suffix = ['.rst', '.md']

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages.  See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'https://docs.python.org/': None}

【问题讨论】:

  • 您从Quick Start Guide 中错过了什么?
  • 我认为我没有错过任何东西 - 本地 Sphinx 构建工作,所有远程构建都因克隆错误而失败。似乎无法通过 HTTPS 进行克隆。
  • 如果这是真的,那么托管在 GitHub 上并被拉入 RTD 的数千个项目都不会失败。如果没有关于您的 RTD 配置和您在 GitHub 上的 repo 的更多信息,就不可能说出您错过了什么。指南的其余部分有更多关于correct setup 的信息。文档中还有更多页面,如果该页面未涵盖您的问题。
  • 您看到上面的错误了吗? Cloning into '.'... fatal: could not read Username for 'https://github.com': terminal prompts disabled。它与 Sphinx 配置无关。本地 Sphinx 构建所有工作,我可以阅读我在本地构建的文档。
  • GitHub 存储库是私有的。这会导致 RTD 出现问题吗? RTD 配置是标准的:存储库 URL 提供为 https://github.com/&lt;user name&gt;/&lt;repo name&gt;

标签: python-3.6 python-sphinx read-the-docs


【解决方案1】:

这可能是因为 ReadTheDocs 允许其免费会员访问公共存储库。

但是,对于私有 GitHub 存储库,我们将不得不使用 ReadtheDocs for Business 注意 here

截至 2020 年 2 月,每个计划的费用如下:

Plan:
 Advanced ($150 per month)

Plan Features:
Style your documentation to fit your company's brand
Support custom SSL certificates
Host documentation on your own domain

还有

计划:基本(50 美元/月)

计划特点: 用于为贵公司的员工托管文档

希望对你有帮助

【讨论】:

    猜你喜欢
    • 2017-08-30
    • 1970-01-01
    • 2018-03-10
    • 1970-01-01
    • 2016-11-02
    • 2018-12-15
    • 1970-01-01
    • 2019-01-24
    • 2021-06-19
    相关资源
    最近更新 更多