commands
Utilities
as_command
as_command (rich_help_panel:str, remove_call_parse:bool=True, no_args_is_help:bool=False)
Decorator that converts a function to an nbz command.
| Type | Default | Details | |
|---|---|---|---|
| rich_help_panel | str | Which CLI panel to put command in | |
| remove_call_parse | bool | True | Whether or not this function has had call_parse attached |
| no_args_is_help | bool | False | Default to help if no args passed |
delegates_sorted
delegates_sorted (to:function=None, keep=False, but:list=None)
Decorator: replace **kwargs in signature with params from to. Sorts arguments.
| Type | Default | Details | |
|---|---|---|---|
| to | function | None | Delegatee |
| keep | bool | False | Keep kwargs in decorated function? |
| but | list | None | Exclude these parameters from signature |
Commands
bump_version
bump_version (part:int)
*Bump the version of a project in settings.ini and __version__ within __init__.py. PART must be 0, 1, or 2.
Examples:
nbz bump-version 0will increment a 0.0.1 to 1.0.1nbz bump-version 1will increment a 0.0.1 to 0.1.1nbz bump-version 2will increment a 0.0.1 to 0.0.2
Learn more answerdotai.github.io/nbz/commands.html#bump_version*
| Type | Details | |
|---|---|---|
| part | int | Zero index of the part to change. |
unbump_version
unbump_version (confirm:bool=False)
*Unbump the version of a project in settings.ini and __version__ within __init__.py.
Example:
nbz unbump-versionwill prompt the user to confirm the unbumpnbz unbump-version --confirmwon’t prompt the user
Learn more answerdotai.github.io/nbz/commands.html#unbump_version*
| Type | Default | Details | |
|---|---|---|---|
| confirm | bool | False | Confirm before unbumping |
check
check ()
*Check that all the components are configured.
Example:
nbz check
Learn more answerdotai.github.io/nbz/commands.html#check*
export
export (path:typing.Annotated[pathlib.Path,<typer.models.ArgumentInfoobje ctat0x7fe65536ab00>], procs:Annotated[List[fastcore.basics.Procs] ,<typer.models.OptionInfoobjectat0x7fe65536aa10>]=['black_format' ], file_glob:str='*.ipynb', file_re:str=None, folder_re:str=None, skip_file_glob:str=None, skip_file_re:str='^[_.]', skip_folder_re:str='^[_.]', symlinks:bool=False)
*Export notebooks in path to Python modules.
Examples:
nbz export .nbz export path/to/notebook
Learn more answerdotai.github.io/nbz/commands.html#export*
| Type | Default | Details | |
|---|---|---|---|
| path | str | None | Path to notebooks |
| procs | Annotated | [‘black_format’] | |
| file_glob | str | *.ipynb | Only include files matching glob |
| file_re | str | None | Only include files matching regex |
| folder_re | str | None | Only enter folders matching regex |
| skip_file_glob | str | None | Skip files matching glob |
| skip_file_re | str | ^[_.] | Skip files matching regex |
| skip_folder_re | str | ^[_.] | Skip folders matching regex |
| symlinks | bool | False | Follow symlinks? |
export_nb
export_nb (target:typing.Annotated[pathlib.Path,<typer.models.ArgumentInf oobjectat0x7fe656944760>], name:typing.Annotated[str,<typer.mo dels.OptionInfoobjectat0x7fe656944940>]=None, lib_path:typing. Annotated[str,<typer.models.OptionInfoobjectat0x7fe656933100>] =None, debug:store_true=False)
*Export a single nbdev notebook to a python script.
Example:
nbz export-nb path/to/notebook.ipynb
Learn more answerdotai.github.io/nbz/commands.html#export_nb*
| Type | Default | Details | |
|---|---|---|---|
| target | Annotated | ||
| name | str | None | Name of python script {name}.py to create. |
| lib_path | str | None | Path to destination library. If not in a nbdev project, defaults to current directory. |
| debug | store_true | False | Debug flag |
install
install ()
*Installs Quarto and the current library.
For Linux and Mac will request your system password. For Windows, will print installation instructions. Example:
nbz install
Learn more answerdotai.github.io/nbz/commands.html#install*
new
new (target:typing.Annotated[pathlib.Path,<typer.models.ArgumentInfoobjec tat0x7fe656964c40>], allowed_cell_metadata_keys='', allowed_metadata_keys='', audience='Developers', author:str=None, author_email:str=None, black_formatting:<function bool_arg>=False, branch:str=None, cell_number:<function bool_arg>=True, cfg_name:str='settings.ini', clean_ids:<function bool_arg>=True, clear_all:<function bool_arg>=False, copyright:str=None, custom_sidebar:<function bool_arg>=False, description:str=None, doc_baseurl='/%(repo)s', doc_host='https://%(user)s.github.io', doc_path:pathlib.Path='_docs', git_url='https://github.com/%(user)s/%(repo)s', jupyter_hooks:<function bool_arg>=False, keywords='nbdev jupyter notebook python', language='English', lib_name='%(repo)s', lib_path:pathlib.Path=None, license='apache2', min_python='3.7', nbs_path:pathlib.Path='nbs', path:str='.', put_version_in_init:<function bool_arg>=True, readme_nb='index.ipynb', recursive:<function bool_arg>=True, repo:str=None, skip_procs:str='', status='3', title='%(lib_name)s', tst_flags='notest', user:str=None, version='0.0.1')
*Create an nbdev project. If the target directory does not exist, creates it.
Examples:
In your current directory:
nbz new .In a different directory:
nbz new my-project
Learn more answerdotai.github.io/nbz/commands.html#new*
| Type | Default | Details | |
|---|---|---|---|
| target | Annotated | ||
| allowed_cell_metadata_keys | str | Preserve the list of keys in cell level metadata | |
| allowed_metadata_keys | str | Preserve the list of keys in the main notebook metadata | |
| audience | str | Developers | Intended audience PyPI classifier |
| author | str | None | Package author’s name |
| author_email | str | None | Package author’s email address |
| black_formatting | bool_arg | False | Format libraries with black? |
| branch | str | None | Repo default branch |
| cell_number | bool_arg | True | Add cell number to the exported file |
| cfg_name | str | settings.ini | Name of config file to create |
| clean_ids | bool_arg | True | Remove ids from plaintext reprs? |
| clear_all | bool_arg | False | Remove all cell metadata and cell outputs? |
| copyright | str | None | Copyright for the package, defaults to ‘current_year onwards, author’ |
| custom_sidebar | bool_arg | False | Use a custom sidebar.yml? |
| description | str | None | Short summary of the package |
| doc_baseurl | str | /%(repo)s | Base URL for docs |
| doc_host | str | https://%(user)s.github.io | Hostname for docs |
| doc_path | Path | _docs | Path to rendered docs |
| git_url | str | https://github.com/%(user)s/%(repo)s | Repo URL |
| jupyter_hooks | bool_arg | False | Run Jupyter hooks? |
| keywords | str | nbdev jupyter notebook python | Package keywords |
| language | str | English | Language PyPI classifier |
| lib_name | str | %(repo)s | Package name |
| lib_path | Path | None | Path to package root (default: repo with - replaced by _) |
| license | str | apache2 | License for the package |
| min_python | str | 3.7 | Minimum Python version PyPI classifier |
| nbs_path | Path | nbs | Path to notebooks |
| path | str | . | Path to create config file |
| put_version_in_init | bool_arg | True | Add the version to the main init.py in nbdev_export |
| readme_nb | str | index.ipynb | Notebook to export as repo readme |
| recursive | bool_arg | True | Include subfolders in notebook globs? |
| repo | str | None | Repo name |
| skip_procs | str | A comma-separated list of processors that you want to skip | |
| status | str | 3 | Development status PyPI classifier |
| title | str | %(lib_name)s | Quarto website title |
| tst_flags | str | notest | Test flags |
| user | str | None | Repo username |
| version | str | 0.0.1 | Version of this release |
release_git
release_git (confirm_release:typing.Annotated[bool,<typer.models.OptionIn foobjectat0x7fe656932980>]=False, token:str=None)
*Tag and create a release in GitHub for the current version.
Example:
nbz release-git
Learn more [answerdotai.github.io/nbz/commands.html#release_git](https://answerdotai.github.io/nbz/commands.html#release_git)*
| Type | Default | Details | |
|---|---|---|---|
| confirm_release | Annotated | False | |
| token | str | None | Optional GitHub token (otherwise token file is used) |