nblibrary:从源存储库获取笔记本的实用程序
nblibrarian的Python项目详细描述
维护jupyter笔记本库的工具 从笔记本的“仓库”(另一个github存储库)。
安装
您可以从pypi安装nblibrary
pip install nblibrarian
或来源
git clone https://github.com/lheagy/nblibrarian
cd nblibrarian
pip install -e .
配置nblibrary
配置nblibrary需要两个文件::
库配置.yml
.library config.yml文件指定源存储库的详细信息,以及是否希望包含environment.yml文件和/或requirements.txt文件。(我们建议您至少下载其中一个)。library config.yml的结构如下:
# information about the source librarysource:github:user:geoscixyz# github username or organizationrepo:geosci-labs# github repositorybranch:master# [optional] branch to fetch material fromdirectory:notebooks# [optional] directory where the notebooks are in the repository - including it will speed up the search for the desired notebooks# setup options for the librarysetup:environment:environment.yml# [optional] include the environment.yml from the sourcerequirements:requirements.txt# [optional] include the requirements.txt file
.jupyter包含
jupyter include文件描述了您希望在库中包括哪些笔记本。同样的道理 语法为.gitignore文件。
# this is a comment # dc resistivity notebooks/dcip/DCIP_2D_Overburden_Pseudosections.ipynb # you can specify the full path notebooks/dcip/DC_Building_Pseudosections # also without the .ipynb extension DC_Cylinder_2D.ipynb # or just specify the notebook name # em /em/EM_Pipeline.ipynb em/EM_ThreeLoopModel.ipynb em/*Sphere*.ipynb # includes all notebooks in a directory called em with "Sphere" in the title # magnetics mag/*.ipynb # includes all notebooks in the mag directory # inversion inversion # includes notebooks in the inversion directory
用法
一旦指定了.library config.yml和.jupyter include,就可以从命令行运行nblibrary 下载指定的文件。
nblibrarian
还有一些选项,可以在verbose模式下运行使用
nblibrarian -v
如果你想更新你的库,你可以随时修改.jupyter include并重新运行nblibrary。默认情况下,它不会覆盖当前笔记本。如果确实要覆盖它们,请运行
nblibrarian --overwrite=True
如果要指定jupyter include和config文件的路径(例如,如果将它们放在其他目录中),请使用
nblibrarian --config=.library-config.yml --jupyter-include=.jupyter-include
问题
如果您在使用nblibrary时遇到任何错误、问题或问题,请在github上create an issue。
许可证
这项工作是根据BSD 3-Clause License授权的。