Settings.ini

nbdev 配置文件

nbdev 的所有配置都是通过一个名为 settings.ini 的文件完成的,该文件位于你的仓库根目录。它是 ConfigParser 格式的。例如,这是 nbdev 的 settings.ini 文件的前几行

[DEFAULT]
lib_name = nbdev
repo = nbdev
description = Create delightful software with Jupyter Notebooks
copyright = 2020 onwards, Jeremy Howard
keywords = nbdev fastai jupyter notebook export
user = fastai
author = Jeremy Howard and Hamel Husain
author_email = [email protected]
branch = master

你可以使用 nbdev_create_config(在这种情况下你需要手动传递设置),或使用 nbdev_new(它会根据你的仓库设置自动为你配置)来创建此文件。以下是 nbdev 的所有设置(不包括决定配置文件保存位置的 pathcfg_name 参数)

类型 默认值 详情
repo str None 仓库名称
branch str None 仓库默认分支
user str None 仓库用户名
author str None 包作者姓名
author_email str None 包作者电子邮箱地址
description str None 包的简短摘要
path str . 创建配置文件的路径
cfg_name str settings.ini 要创建的配置文件名称
lib_name str %(repo)s 包名称
git_url str https://github.com/%(user)s/%(repo)s 仓库 URL
custom_sidebar bool_arg False 使用自定义的 sidebar.yml?
nbs_path 路径 nbs notebooks 路径
lib_path 路径 None 包根目录路径(默认:repo 中的 - 替换为 _
doc_path 路径 _docs 渲染后文档的路径
tst_flags str notest 测试标志
version str 0.0.1 此版本的版本号
doc_host str https://%(user)s.github.io 文档主机名
doc_baseurl str /%(repo)s 文档基础 URL
keywords str nbdev jupyter notebook python 包关键词
license str apache2 包许可证
copyright str None 包版权,默认为 'current_year 及以后,author'
status str 3 开发状态 PyPI 分类器
min_python str 3.9 最低 Python 版本 PyPI 分类器
audience str 开发者 目标受众 PyPI 分类器
language str 英语 语言 PyPI 分类器
recursive bool_arg True 在 notebook glob 中包含子文件夹?
black_formatting bool_arg False 使用 black 格式化库?
readme_nb str index.ipynb 导出为仓库 README 的 notebook
title str %(lib_name)s Quarto 网站标题
allowed_metadata_keys str 保留主 notebook 元数据中的键列表
allowed_cell_metadata_keys str 保留单元格级别元数据中的键列表
jupyter_hooks bool_arg False 运行 Jupyter 钩子?
clean_ids bool_arg True 从纯文本 repr 中删除 id?
clear_all bool_arg False 删除所有单元格元数据和单元格输出?
cell_number bool_arg True 将单元格编号添加到导出的文件中
put_version_in_init bool_arg True 在 nbdev_export 中将版本添加到主 init.py
update_pyproject bool_arg True 使用正确的项目名称创建/更新 pyproject.toml
skip_procs str 你想跳过的处理器(processors)的逗号分隔列表

你可以通过 ~/.config/nbdev/settings.ini 文件为你用户的所有仓库自定义 nbdev。

为了让 Git 操作顺利运行,请在 settings.ini 中添加包含所需包的 requirementsdev_requirements

请参阅此处作为参考。