如何通过 Nbsphinx 使用 Travis CI 和 Jupyter Notebooks

埃兹奎尔·卡斯塔尼奥

我正在尝试在 github 存储库中使用 nbsphinx 和 travis 以及 Jupyter 笔记本。

存储库设置:

.
├── _docs
|   ├── config.py # I added nbsphinx extension here
|   ├── including.rst # File with .. include :: ../projects/testingjupyter.ipynb
|   └── index.rst # basically just toctree with "including" among other titles
├── _projects
|   └── testingjupyter.ipynb
├── tests
├── travis.yml
└── requirements.txt

travis.yml:

language: python
python:
     - "2.7.12"
     - "3.5"
     - "3.5"
     - "nightly"

install: 
    - pip install -r requirements.txt
    - sudo apt-get install pandoc

script:
    - py.test tests/
    - travis-sphinx --source ./docs build

after_success:
    - travis-sphinx --branches=master,Develop deploy

要求.txt:

sphinx-rtd-theme==0.2.4
Sphinx==1.5.3
travis-sphinx==1.4.3
flask==0.12
jupyter
nbconvert
pandoc
nbsphinx
IPython
ipykernel

travis-sphinx尝试生成时,出现以下错误:意外的缩进

特拉维斯日志

testingjupyter.ipynb :

{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Testing Jupyter"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Hello World\n"
     ]
    }
   ],
   "source": [
    "print('Hello World')"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
马蒂亚斯

它不适用于

.. include:: ../projects/testingjupyter.ipynb

AFAIK,这仅适用于*.rst文件(请参阅docutils docs)。

您应该将您的笔记本添加到toctree,例如

.. toctree::
    :maxdepth: 3

    testingjupyter

指定.ipynb扩展名是可选的。

或者,您可以将其包含在另一个带有nbsphinx-toctree元数据的笔记本中

更新:

笔记本确实必须在源目录中。尽管在https://github.com/spatialaudio/nbsphinx/pull/33中提出了建议,但不支持使用源目录之外的笔记本

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

如何使用Travis CI和Scalr部署成功的构建

如何使用Gradle和Cobertura在travis-ci上构建

Jupyter Notebooks,启动和停止

如何在Travis CI上测试Jupyter笔记本?

travis-ci和gitlab-ci如何比较?

如何在Jupyter Notebooks中使用Github软件包

如何使用 Travis CI 预编译资产?

如何使Travis CI在python中使用input()?

如何使用自定义数据库凭据设置Travis CI和Postgresql?

如何使用Travis CI和Azure在连续部署管道中设置flyway配置?

Sonarcloud没有使用Travis CI和Maven的授权

使用Travis CI和Docker进行连续部署

无法使用Travis-CI和Android构建项目

使用Laravel 5和PostgreSQL设置Travis-CI

通过Rails 4和Selenium Web驱动程序,在Travis CI上使用Sauce Labs,但不能在本地使用

在GitHub上通过Travis-CI在httr和本地使用httr进行身份验证(本地工作,远程不工作)

Travis CI和Laravel Dusk

Travis CI - knitr 和依赖

命令行 python 和 jupyter notebooks 使用两个不同版本的 Torch

从 Jupyter Notebooks 使用 Azure Devops python 库

如何通过Travis CI测试以使用python click.version_option装饰器?

通过Travis CI使用Perl-helpers时如何强制Devel :: Cover忽略文件夹

如何使用不同的R版本通过Travis-CI测试软件包?

如何在一个.travis.yml文件中使用Travis CI在Ubuntu 14.04 LTS和CentOS7上进行测试?

如何在线与Jupyter Notebooks互动?

如何停止 docker 自动启动 jupyter notebooks

如何使用Travis CI测试Pl / Python PostgreSQL过程?

如何使用Travis-CI在CentOS 7上运行测试?

如何在Travis CI中使用最新的Boost版本