cli

CLI 命令

nbdev_filter

 nbdev_filter (nb_txt:str=None, fname:str=None, printit:<function
               bool_arg>=True)

Quarto 的一个笔记本过滤器

类型 默认值 详情
nb_txt str None 笔记本文本(如果未提供,则使用 stdin)
fname str None 要读取的笔记本(如果未提供,则使用 nb_txt
printit bool_arg True 打印到 stdout?

extract_tgz

 extract_tgz (url, dest='.')

nbdev_new

 nbdev_new (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='%(repo)s',
            git_url='https://github.com/%(user)s/%(repo)s',
            custom_sidebar:<function bool_arg>=False,
            nbs_path:pathlib.Path='nbs', lib_path:pathlib.Path=None,
            doc_path:pathlib.Path='_docs', tst_flags='notest',
            version='0.0.1', doc_host='https://%(user)s.github.io',
            doc_baseurl='/%(repo)s', keywords='nbdev jupyter notebook
            python', license='apache2', copyright:str=None, status='3',
            min_python='3.9', audience='Developers', language='English',
            recursive:<function bool_arg>=True, black_formatting:<function
            bool_arg>=False, readme_nb='index.ipynb',
            title='%(lib_name)s', allowed_metadata_keys='',
            allowed_cell_metadata_keys='', jupyter_hooks:<function
            bool_arg>=False, clean_ids:<function bool_arg>=True,
            clear_all:<function bool_arg>=False, cell_number:<function
            bool_arg>=True, put_version_in_init:<function bool_arg>=True,
            update_pyproject:<function bool_arg>=True, skip_procs:str='')

创建一个 nbdev 项目。

类型 默认值 详情
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 笔记本路径
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 PyPI 分类器的最低 Python 版本
audience str 开发者 PyPI 分类器的目标受众
language str 英语 PyPI 分类器的语言
recursive bool_arg True 是否包含笔记本 globs 中的子文件夹?
black_formatting bool_arg False 是否使用 black 格式化库?
readme_nb str index.ipynb 导出为仓库 readme 的笔记本
title str %(lib_name)s Quarto 网站标题
allowed_metadata_keys str 保留主笔记本元数据中的键列表
allowed_cell_metadata_keys str 保留单元格级别元数据中的键列表
jupyter_hooks bool_arg False 运行 Jupyter 钩子?
clean_ids bool_arg True 从纯文本 reprs 中移除 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 您想要跳过的处理器的逗号分隔列表

它通过复制最新的带有标签的 nbdev-template 发布版本中的内容,并使用创建的 settings.ini 文件渲染模板变量来实现。设置可以通过命令行参数传递;缺失的设置将从当前的 git/GitHub 仓库推断,否则会提示输入。


nbdev_update_license

 nbdev_update_license (to:str=None)

允许您更新项目的许可证。

类型 默认值 详情
to str None 更新许可证至

nb_export_cli

 nb_export_cli (nbname, debug:store_true=False, lib_path:str=None,
                name:str=None, solo_nb:bool=False)

将单个 nbdev 笔记本导出为 Python 脚本。

类型 默认值 详情
nbname str 笔记本文件名
debug store_true False 调试标志
lib_path str None 目标库路径。如果不在 nbdev 项目中,默认为当前目录。
name str None 要创建的 Python 脚本 {name}.py 的名称。
solo_nb bool False 在 nbdev 项目外部导出单个笔记本。

watch_export

 watch_export (nbs:str=None, lib:str=None, force:bool=False)

如果可用,使用 nbdev 配置在 nbs 目录中对 .ipynb 文件更改时应用 nb_export

类型 默认值 详情
nbs str None 要监视更改的笔记本目录
lib str None 用于写入 .py 文件的导出目录
force bool False 如果在 nbdev 项目中,忽略 nbdev 配置

帮助


chelp

 chelp ()

显示所有控制台脚本的帮助信息

chelp()
nb_export                 Export a single nbdev notebook to a python script.
nbdev_bump_version        Increment version in settings.ini by one
nbdev_changelog           Create a CHANGELOG.md file from closed and labeled GitHub issues
nbdev_clean               Clean all notebooks in `fname` to avoid merge conflicts
nbdev_conda               Create a `meta.yaml` file ready to be built into a package, and optionally build and upload it
nbdev_contributing        Create CONTRIBUTING.md from contributing_nb (defaults to 'contributing.ipynb' if present). Skips if the file doesn't exist.
nbdev_create_config       Create a config file.
nbdev_docs                Create Quarto docs and README.md
nbdev_export              Export notebooks in `path` to Python modules
nbdev_filter              A notebook filter for Quarto
nbdev_fix                 Create working notebook from conflicted notebook `nbname`
nbdev_help                Show help for all console scripts
nbdev_install             Install Quarto and the current library
nbdev_install_hooks       Install Jupyter and git hooks to automatically clean, trust, and fix merge conflicts in notebooks
nbdev_install_quarto      Install latest Quarto on macOS or Linux, prints instructions for Windows
nbdev_merge               Git merge driver for notebooks
nbdev_migrate             Convert all markdown and notebook files in `path` from v1 to v2
nbdev_new                 Create an nbdev project.
nbdev_prepare             Export, test, and clean notebooks, and render README if needed
nbdev_preview             Preview docs locally
nbdev_proc_nbs            Process notebooks in `path` for docs rendering
nbdev_pypi                Create and upload Python package to PyPI
nbdev_readme              Create README.md from readme_nb (index.ipynb by default)
nbdev_release_both        Release both conda and PyPI packages
nbdev_release_gh          Calls `nbdev_changelog`, lets you edit the result, then pushes to git and calls `nbdev_release_git`
nbdev_release_git         Tag and create a release in GitHub for the current version
nbdev_requirements        Writes a `requirements.txt` file to `directory` based on settings.ini.
nbdev_sidebar             Create sidebar.yml
nbdev_test                Test in parallel notebooks matching `path`, passing along `flags`
nbdev_trust               Trust notebooks matching `fname`
nbdev_update              Propagate change in modules matching `fname` to notebooks that created them
nbdev_update_license      Allows you to update the license of your project.
watch_export              Use `nb_export` on ipynb files in `nbs` directory on changes using nbdev config if available