使用nbconvert将jupyter笔记本转换为atlassian合流(r)页面
nbconflux的Python项目详细描述
nbconflux
nbconflux将jupyter笔记本转换为Atlassian Confluence 页面使用 nbconvert。
为什么?
nbconflux在以下情况下非常有用:
- 您可以使用Jupyter笔记本编写计算性叙述
- 您的组织使用合流存储机构知识
- 您需要一种简单的方法在该知识库中发布您的工作
功能
- 将大多数单元格输入和输出转换为有效的Confluence storage format
- 将图像输出(例如matplotlib png)附加到页面,并以内联方式显示它们, 并在版本历史记录中维护页面图像关联
- 将源笔记本附加到页面,从页脚链接到它,以及 在版本历史记录中维护页面笔记本关联
- 支持对大多数输入和输出内容的扫描选择合并注释
- 排除基于笔记本单元格标记的输入、输出或整个单元格
noinput
,nooutput
,或nocell
- 用
nbconflux
标记页面,以识别源自笔记本的内容 - 根据笔记本在页面顶部插入目录宏 标题
- 将nbviewer样式表应用于要将汇流样式与 Jupyter笔记本风格(需要css宏)
- 启用mathjax呈现(需要HTML macro)
- 支持汇合存储格式标记的原始单元格传递(例如 包含合流宏)
- 与合流云和合流服务器兼容
安装
nbconflux库要求运行python 3并安装pip
。
满足这些先决条件后,运行:
pip install nbconflux
(康达套餐即将推出)
用法
- 创建或访问汇流网站上的页面。
- 复制页面的URL。
- 运行下列操作之一:
- 在外壳中:
nbconflux /path/to/a.ipynb https://your/page/url
- 在python脚本、jupyter笔记本等中:
importnbconfluxhtml,resources=nbconflux.notebook_to_page(nb_path,url)
- 在外壳中:
- 在提示时输入汇流用户名和密码。
- 访问此页以查看您的更新。
如果收到错误,请参阅项目问题以了解有关 你可以发帖。
在命令行运行nbconflux -h
以获取其他选项和帮助。
usage: nbconflux [-h] [--exclude-toc] [--exclude-ipynb] [--exclude-style]
[--include-mathjax]
notebook url
Converts Jupyter Notebooks to Atlassian Confluence pages using nbconvert
positional arguments:
notebook Path to local notebook (ipynb)
url URL of Confluence page to update
optional arguments:
-h, --help show this help message and exit
--exclude-toc Do not generate a table of contents
--exclude-ipynb Do not attach the notebook to the page
--exclude-style Do not include the Jupyter base stylesheet
--include-mathjax Enable MathJax on the page
--extra-labels EXTRA_LABELS [EXTRA_LABELS ...]
Additional labels to add to the page
Collects credentials from the following locations:
1. CONFLUENCE_USERNAME and CONFLUENCE_PASSWORD environment variables
2. ~/.nbconflux file in the format username:password
3. User prompts
贡献
我们欢迎有助于改进笔记本种类的问题和请求 nbconflux支持的内容和合流安装,其可用性 以及它在其他工具中的可重用性。
我们建议使用conda
或
virtualenv
,运行make dev-env
以安装运行时和开发
需求,并运行make test
以在
本地机器。
常见问题解答
问:为什么不称之为nbconfluence?
答:https://atlassian.com/legal/trademark
问:为什么我必须先在网站上创建一个页面?
A:避免引入指定空间、父页和 包裹的标题。
许可证
版权所有(c)2018 Valassis Digital根据BSD 3条款许可的条款
开发
运行测试:
make dev-env
make test
维护
发布:
- 满足中描述的所有要求 https://dustingram.com/articles/2018/03/16/markdown-descriptions-on-pypi 支持将markdown readme作为pypi上的详细描述。
git commit -m 'REL: 0.6.0' --allow-empty
git tag -a 0.6.0 -m 'REL: 0.6.0'
git push origin master
和git push origin master --tags
或使用pr- 运行
make release
。 - 出现提示时输入您的pypi creds。