No project description provided
Project description
nb2minimod
From Jupyter notebooks, take all the cells that have # export and output them to a python script. A __init__.py is generated that imports * from each module.
pip install nb2minimod
example shown in example_project
CLI
nb2minimod path/my_project/ will create a folder called my_project with a file for each ipynb file.
CLI uses typer.
nb2minimod --help will show the following:
Usage: nb2script [OPTIONS] [PATH] [FOLDER_NAME]
Take a path to either a directory or a single notebook file and generate a Python module from each notebook file. The module will be given the same name as the notebook file, and will contain all code cells that start with #| export. The contents (including comments) of these code cells will be in the same order as they appear in the notebook.
If a directory is given, a new directory with the same name will be created containing all the generated Python modules. If a notebook file is given, the generated module will be written in the same directory.
The __init__.py file for the new directory will be created containing import statements for all the generated Python modules. If create_core is False, the __init__.py file will not be created.
If path is None, the current directory will be used.
Examples:
nb2script my_notebooksnb2script notebook.ipynbnb2script my_notebooks --no-create-core
Arguments
| Argument | Description | Default |
|---|---|---|
path |
[PATH] | [default: None] |
folder_name |
[FOLDER_NAME] | [default: None] |
Options
| Option | Description | Default |
|---|---|---|
--create-core, --no-create-core |
[default: create-core] | |
--install-completion |
Install completion for the current shell. | |
--show-completion |
Show completion for the current shell, to copy it or customize the installation. | |
--help |
Show this message and exit. |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nb2minimod-0.1.1-py3-none-any.whl.
File metadata
- Download URL: nb2minimod-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3442c3e1c704cd40c5a38b17fcd8ce3e9b949e12205edb3e4d4fa2d41abd9f0c
|
|
| MD5 |
4d08b9d0497621ad66588ba0808dbccb
|
|
| BLAKE2b-256 |
053ce4d2d9f1b77ef2de036aeb89e51416fca59533bb7ec779b63f6f1b414cff
|