我使用sphinx.ext.autosummary生成了python文档。autodoc和autosummary在conf.py中配置如下:
autodoc_member_order = 'bysource'
## Default flags used by autodoc directives
autodoc_default_flags = ['members','undoc-members']
## Generate autodoc stubs with summaries from code
autosummary_generate = True
Run Code Online (Sandbox Code Playgroud)
我使用模板:
myModuleName
=======
.. autosummary::
:toctree: _autosummary
:template: modules.rst
myModule
Run Code Online (Sandbox Code Playgroud)
模块模板为:
{{ fullname }}
{{ underline }}
.. automodule:: {{ fullname }}
{% block functions %}
{% if functions %}
.. rubric:: Functions
.. autosummary::
:toctree: {{ objname }}
{% for item in functions %}
{{ item }}
{%- endfor %}
{% endif %}
{% …Run Code Online (Sandbox Code Playgroud) 当我用绘图保存 jupyter 笔记本时,出现以下错误:
[E 13:42:38.458 NotebookApp] Notebook JSON is invalid: {'data': [{'type': 'scatter', 'y': [1, 2, 3]}], 'layout': {}} is not valid under any of the given schemas
Failed validating 'oneOf' in schema['properties']['data']['patternProperties']['^(?!application/json$)[a-zA-Z0-9]+/[a-zA-Z0-9\\-\\+\\.]+$']:
{'oneOf': [{'type': 'string'},
{'items': {'type': 'string'}, 'type': 'array'}]}
On instance['data']['application/vnd.plotly.v1+json']:
{'data': [{'type': 'scatter', 'y': [1, 2, 3]}], 'layout': {}}
Run Code Online (Sandbox Code Playgroud)
我在笔记本中的代码是:
import plotly.offline as py
import plotly.graph_objs as go
py.init_notebook_mode(connected=True)
data = [go.Scatter(y=[1,2,3])]
py.iplot(data)
Run Code Online (Sandbox Code Playgroud)
遵循jupyter 笔记本中的情节图:保存时验证失败,我更新了 nbformat 但仍然无法正常工作(我检查import nbformat nbformat__version__了更新是否有效)