文档#

关于文档#

  • yfinance文档采用reStructuredText(rst)格式编写,并使用Sphinx构建。

  • 文档文件位于 doc/source/..

  • API参考文档下的多数说明源自类和方法文档字符串。这些文档位于doc/source/reference/api中,由Sphinx自动生成且未包含在git版本控制中。

本地构建文档#

要在本地构建文档,请按照以下步骤操作:

  1. 安装所需依赖项:

    • 确保已安装Sphinx和其他所有依赖项。如果存在requirements.txt文件,可以通过运行以下命令安装依赖项:

    pip install -r requirements.txt
    pip install Sphinx==8.0.2 pydata-sphinx-theme==0.15.4 Jinja2==3.1.4 sphinx-copybutton==0.5.2
    
  2. 使用Sphinx构建:

    • After dependencies are installed, use the sphinx-build command to generate HTML documentation.

    • 进入 doc/ 目录运行:

    sphinx-build -b html doc/source doc/_build/html
    
  3. View Documentation Locally:

    python -m http.server -d ./doc/_build/html
    

    Then open “localhost:8000” in browser

发布文档#

Merge into main branch triggers auto-generating documentation by action .github/workflows/deploy_doc.yml. This publishes the generated HTML into branch documentation.

  1. 在本地审查变更并推送到 dev

  2. dev 分支合并到 main 分支时,GitHub Actions 工作流会自动构建文档。