Code Documentation¶
Apps¶
DsCreate¶
The base app for dscreate applications. This app primarily handles the set up of configuration files for dscreate.
Behavior:
The first time a dscreate CLI app is activated, the system configuration directory is created using the
appdirspython package.A subdirectory called
dsis created and adscreate_config.pyfile is added to thedssubdirectory. This serves as the global configuration file for dscreate.A subdirectory for the activated application is created inside the system configuration directory.
A
dscreate_config.pyfile is added to the application subdirectory. This serves as a localized configuration file for a specific dscreate application.If the configuration directories already exist, the configuration files are loaded into a
traitletsconfig object which will be used to alter the settings of the application components.Additional configuration files can be used if specified with the
--config_fileargument.The traitlets
Application.startmethod is activated, which in turn activates the sub application’s.startmethod.
CONFIGURABLE VARIABLES:
- DsCreate.app_dirUnicode
Default:
''No description
- DsCreate.classesList
Default:
[]No description
- DsCreate.config_fileUnicode
Default:
''No description
- DsCreate.config_file_nameUnicode
Default:
'dscreate_config.py'Specify a config file to load.
- DsCreate.dsconfigUnicode
Default:
''No description
- DsCreate.inlineBool
Default:
FalseNo description
- DsCreate.log_datefmtUnicode
Default:
'%Y-%m-%d %H:%M:%S'The date format used by logging formatters for %(asctime)s
- DsCreate.log_formatUnicode
Default:
'[%(name)s]%(highlevel)s %(message)s'The Logging format template
- DsCreate.log_levelInt
Default:
50No description
- DsCreate.show_configBool
Default:
FalseInstead of starting the Application, dump configuration to stdout
- DsCreate.show_config_jsonBool
Default:
FalseInstead of starting the Application, dump configuration to stdout (as JSON)
- DsCreate.system_config_pathUnicode
Default:
''No description
METHODS
write_default_config(self) -> None:
Builds system configuration directories and files.
_load_configs(self) -> None:
Loads the default configurations for every application object.
Generates system config files if they do not exist.
Loads the system configuration files and overwrites the defaults with configurations set in the files.
Loads config file if set by
--config_fileOverwrites configurations with configs set via command line.
add_all_configurables(self) -> None:
Apart from inline and source_notebook, config variables are expected to be tied to
an application object. To ensure the application has full access to every configurable trait
we loop over all of the dscreate applications and pipeline objects and add their configurable
traits to the application config, setting each trait to their default values.
start(self) -> None:
Activates the traitlets
Application.startmethod, which parses the command line.Generates the application configuration object.
CreateApp¶
Splits a notebook into student and teacher facing materials using dscreate solution tags.
Behavior:
CreateApp uses three major variables.
pipeline_steps
This variable is a list containing the converters and controllers that are applied to the repository.
branches
This variable is a list containing the name of git branches and is used by CheckoutControllers (included in the
pipeline_stepslist) to move sequentially across the branches.*It is worth noting that the
pipeline_stepslist cannot contain more CheckoutControllers than the length ofbranches.
inline
This variable is a bool that indicates whether or not to split the notebooks on solely on the active branch. When inline is True, the solution files are stored in a
.solution_filesdirectory.inline is set to True via the
--inlineflag.When inline is true, a
curriculum.ipynbfile used as theedit_file.
If a branch inside the branches list has not been created, it is created.
For notebook splits that requires git branches, the application must be run from the edit_branch which defaults to
curriculum.
CONFIGURABLE VARIABLES:
- CreateApp.app_dirUnicode
Default:
''No description
- CreateApp.branchesList
Default:
[]No description
- CreateApp.classesList
Default:
[]No description
- CreateApp.config_fileUnicode
Default:
''No description
- CreateApp.config_file_nameUnicode
Default:
'dscreate_config.py'Specify a config file to load.
- CreateApp.dsconfigUnicode
Default:
''No description
- CreateApp.edit_branchUnicode
Default:
'curriculum'No description
- CreateApp.inlineBool
Default:
FalseNo description
- CreateApp.log_datefmtUnicode
Default:
'%Y-%m-%d %H:%M:%S'The date format used by logging formatters for %(asctime)s
- CreateApp.log_formatUnicode
Default:
'[%(name)s]%(highlevel)s %(message)s'The Logging format template
- CreateApp.log_levelInt
Default:
50No description
- CreateApp.pipeline_stepsList
Default:
[]No description
- CreateApp.show_configBool
Default:
FalseInstead of starting the Application, dump configuration to stdout
- CreateApp.show_config_jsonBool
Default:
FalseInstead of starting the Application, dump configuration to stdout (as JSON)
- CreateApp.system_config_pathUnicode
Default:
''No description
METHODS
validate_branches(self) -> None:
No description
start(self) -> None:
No description
GenerateApp¶
Splits an nbgrader assignment into student facing and teacher facing files and uses the arguments to determine which sub application should be activated.
Behavior:
GenerateApp uses three major variables.
pipeline_steps
This variable is a list containing the converters and controllers that are applied to the repository.
branches
This variable is a list containing the name of git branches and is used by CheckoutControllers (included in the
pipeline_stepslist) to move sequentially across the branches.*It is worth noting that the
pipeline_stepslist cannot contain more CheckoutControllers than the length ofbranches.This app uses nbgrader’s preprocessors to create student facing and and teacher facing versions for the README markdown files. The curriculum notebook is saved to each branch.
CONFIGURABLE VARIABLES:
- GenerateApp.app_dirUnicode
Default:
''No description
- GenerateApp.branchesList
Default:
['master', 'solution']Sets the branches used for the notebook split. Default: [‘master’, ‘solution’]
- GenerateApp.classesList
Default:
[]No description
- GenerateApp.config_fileUnicode
Default:
''No description
- GenerateApp.config_file_nameUnicode
Default:
'dscreate_config.py'Specify a config file to load.
- GenerateApp.dsconfigUnicode
Default:
''No description
- GenerateApp.edit_branchUnicode
Default:
'master'Sets the name of the git branch used for curriculum development. Default: ‘curriculum’
- GenerateApp.inlineBool
Default:
FalseNo description
- GenerateApp.log_datefmtUnicode
Default:
'%Y-%m-%d %H:%M:%S'The date format used by logging formatters for %(asctime)s
- GenerateApp.log_formatUnicode
Default:
'[%(name)s]%(highlevel)s %(message)s'The Logging format template
- GenerateApp.log_levelInt
Default:
50No description
- GenerateApp.pipeline_stepsList
Default:
[<class 'dscreate.pipeline.CollectCurriculum.CollectCurriculu...No description
- GenerateApp.show_configBool
Default:
FalseInstead of starting the Application, dump configuration to stdout
- GenerateApp.show_config_jsonBool
Default:
FalseInstead of starting the Application, dump configuration to stdout (as JSON)
- GenerateApp.system_config_pathUnicode
Default:
''No description
METHODS
start(self) -> None:
Activates the application.
Adds the name of the edit branch to the application configuration object.
Configures the DsPipeline object
Adds the branches to the controller objects
Initializes a DsPipeline
Activates thee pipeline
EditApp¶
Generates an edit file for an in directory notebook split.
Behavior:
Notebook filenames and the solution dir are set via BaseConverter traits
Lesson and solution notebooks are read in
Lesson cells and solution cells are concatenated into a single list
Cells are sorted according to cell.metadata.index
CONFIGURABLE VARIABLES:
- EditApp.app_dirUnicode
Default:
''No description
- EditApp.classesList
Default:
[]No description
- EditApp.config_fileUnicode
Default:
''No description
- EditApp.config_file_nameUnicode
Default:
'dscreate_config.py'Specify a config file to load.
- EditApp.dsconfigUnicode
Default:
''No description
- EditApp.inlineBool
Default:
FalseNo description
- EditApp.log_datefmtUnicode
Default:
'%Y-%m-%d %H:%M:%S'The date format used by logging formatters for %(asctime)s
- EditApp.log_formatUnicode
Default:
'[%(name)s]%(highlevel)s %(message)s'The Logging format template
- EditApp.log_levelInt
Default:
50No description
- EditApp.pipeline_stepsList
Default:
[<class 'dscreate.pipeline.converters.MergeConverter.MergeCon...No description
- EditApp.show_configBool
Default:
FalseInstead of starting the Application, dump configuration to stdout
- EditApp.show_config_jsonBool
Default:
FalseInstead of starting the Application, dump configuration to stdout (as JSON)
- EditApp.system_config_pathUnicode
Default:
''No description
METHODS
start(self) -> None:
No description
MarkdownApp¶
Converts a notebook to markdown.
The name of notebook must be provided as an argument or via –notebook The output file defaults to README.md but can be set via –output
CONFIGURABLE VARIABLES:
- MarkdownApp.app_dirUnicode
Default:
''No description
- MarkdownApp.classesList
Default:
[]No description
- MarkdownApp.config_fileUnicode
Default:
''No description
- MarkdownApp.config_file_nameUnicode
Default:
'dscreate_config.py'Specify a config file to load.
- MarkdownApp.dsconfigUnicode
Default:
''No description
- MarkdownApp.inlineBool
Default:
FalseNo description
- MarkdownApp.log_datefmtUnicode
Default:
'%Y-%m-%d %H:%M:%S'The date format used by logging formatters for %(asctime)s
- MarkdownApp.log_formatUnicode
Default:
'[%(name)s]%(highlevel)s %(message)s'The Logging format template
- MarkdownApp.log_levelInt
Default:
50No description
- MarkdownApp.pipeline_stepsList
Default:
[<class 'dscreate.pipeline.converters.ReadmeConverter.ReadmeC...No description
- MarkdownApp.show_configBool
Default:
FalseInstead of starting the Application, dump configuration to stdout
- MarkdownApp.show_config_jsonBool
Default:
FalseInstead of starting the Application, dump configuration to stdout (as JSON)
- MarkdownApp.system_config_pathUnicode
Default:
''No description
METHODS
start(self) -> None:
No description
ConfigApp¶
Prints the path for a dscreate configuration file. If a subcommand is provided, a configuration filepath is printed for that specific application.
If not subcommand is provided, the global configuration file is printed.
CONFIGURABLE VARIABLES:
- ConfigApp.app_dirUnicode
Default:
''No description
- ConfigApp.classesList
Default:
[]No description
- ConfigApp.config_fileUnicode
Default:
''No description
- ConfigApp.config_file_nameUnicode
Default:
'dscreate_config.py'Specify a config file to load.
- ConfigApp.dsconfigUnicode
Default:
''No description
- ConfigApp.inlineBool
Default:
FalseNo description
- ConfigApp.log_datefmtUnicode
Default:
'%Y-%m-%d %H:%M:%S'The date format used by logging formatters for %(asctime)s
- ConfigApp.log_formatUnicode
Default:
'[%(name)s]%(highlevel)s %(message)s'The Logging format template
- ConfigApp.log_levelInt
Default:
50No description
- ConfigApp.show_configBool
Default:
FalseInstead of starting the Application, dump configuration to stdout
- ConfigApp.show_config_jsonBool
Default:
FalseInstead of starting the Application, dump configuration to stdout (as JSON)
- ConfigApp.system_config_pathUnicode
Default:
''No description
METHODS
start(self) -> None:
No description
Pipeline¶
DsPipeline¶
The primary pipeline for dscreate
DsPipeline’s primary variable is
stepscontaining converter and controller objects. Every object included in steps must haveenabledandprintoutattributes, and a.startmethod
CONFIGURABLE VARIABLES:
- DsPipeline.branchesList
Default:
[]No description
- DsPipeline.stepsList
Default:
[]No description
METHODS
__init__(self, **kwargs) -> None:
Set up configuration file.
start(self) -> None:
No description
CollectCurriculum¶
CollectCurriculum reads in the edit_file and stores the notebook in the application configuration object.
CONFIGURABLE VARIABLES:
- CollectCurriculum.edit_branchUnicode
Default:
'curriculum'No description
- CollectCurriculum.edit_fileUnicode
Default:
'index.ipynb'No description
METHODS
start(self) -> None:
No description
Controllers¶
BaseController¶
The base controller object.
Behavior:
This object is used to configure git repository controller objects.
Primarily, controllers inherit
enabledandbranchesattributes from the BaseController.
enabled* When enabled is true, the controller is used during the notebook split
CONFIGURABLE VARIABLES:
- BaseController.branchesList
Default:
['curriculum', 'master', 'solution']No description
- BaseController.enabledBool
Default:
FalseNo description
METHODS
__init__(self, **kwargs) -> None:
Set up configuration file.
Inherit git repo attributes
CheckoutController¶
Checkout branches set by the running application.
This controller relies on a configuration object that contains the following variables
BaseController.branches``CommitController.count
The commit controller count is added to the config object if it does not exist, but does not increment the count. The count variable is used to identify the next branch in the BaseController.branches sequence.
dscreate uses a “force” merge strategy which overwrites each branch with the most recent edit branch commit. It is equivalent to running
git merge <name of branch> -X theirs
CONFIGURABLE VARIABLES:
- CheckoutController.branchesList
Default:
['curriculum', 'master', 'solution']No description
- CheckoutController.enabledBool
Default:
FalseNo description
- CheckoutController.printoutUnicode
Default:
''No description
METHODS
get_branch(self):
No description
merge_edit_branch(self):
No description
start(self) -> None:
No description
CommitController¶
Commits changes to a git branch.
This object has a
commit_msgattribute that can be set from command line using the-margument.If a commit message is not provided the commit message defaults to ‘Updating <name of branch>’
CONFIGURABLE VARIABLES:
- CommitController.branchesList
Default:
['curriculum', 'master', 'solution']No description
- CommitController.commit_msgUnicode
Default:
''No description
- CommitController.countInt
Default:
0No description
- CommitController.enabledBool
Default:
FalseNo description
METHODS
add_and_commit(self, commit_msg=None):
No description
start(self) -> None:
No description
PushController¶
Pushing changes to the remote.
Remote is a configurable variables that defaults to ‘origin’
CONFIGURABLE VARIABLES:
- PushController.branchesList
Default:
['curriculum', 'master', 'solution']No description
- PushController.enabledBool
Default:
FalseNo description
- PushController.remoteUnicode
Default:
''No description
METHODS
get_branch(self):
No description
start(self) -> None:
No description
CheckoutEditBranch¶
This controller checkouts the first branch of the branches configuration variable.
CONFIGURABLE VARIABLES:
- CheckoutEditBranch.branchesList
Default:
['curriculum', 'master', 'solution']No description
- CheckoutEditBranch.enabledBool
Default:
FalseNo description
METHODS
start(self) -> None:
No description
Converters¶
BaseConverter¶
The base converter that is inherited by all dscreate converters.
The base converter initializes and activates the exporter and filewriter objects. If the
--inlineflag is used withds create, a .solution_dir directory is created.The base converter has an
--outputargument that allows you to change the name of the output file. This variable defaults to'index'When the base converter is used a step in the pipeline, the edit_file is written to disk unchanged.
CONFIGURABLE VARIABLES:
- BaseConverter.enabledBool
Default:
TrueNo description
- BaseConverter.exporter_classType
Default:
'nbconvert.exporters.notebook.NotebookExporter'No description
- BaseConverter.outputUnicode
Default:
'index'No description
- BaseConverter.preprocessorsList
Default:
[]No description
- BaseConverter.solution_dirUnicode
Default:
'/Users/joel/Documents/scripts/dscreate/docs/.solution_files'No description
METHODS
__init__(self, **kwargs) -> None:
Set up configuration file.
start(self) -> None:
Activate the converter
_init_preprocessors(self) -> None:
Here we add the preprocessors to the exporter pipeline with the register_preprocessor method.
convert_notebook(self) -> None:
Create a resources object that tells the exporter how to format link urls for images.
Pass the notebook through the preprocessor and convert to the desired format via the exporter.
Write the notebook to file.
init_notebook_resources(self) -> dict:
The resources argument, when passed into an exporter, tell the exporter what directory to include in the path for external images via output_files_dir.
The output_name value is required by nbconvert and is typically the name of the original notebook.
write_notebook(self, output, resources) -> None:
Sets the output directory for the file write and writes the file to disk.
MasterConverter¶
The master converter is used to generate the student facing notebook.
The preprocessors default to the nbconvert ClearOutput and dscreate RemoveSolutions preprocessors.
CONFIGURABLE VARIABLES:
- MasterConverter.enabledBool
Default:
TrueNo description
- MasterConverter.exporter_classType
Default:
'nbconvert.exporters.notebook.NotebookExporter'No description
- MasterConverter.outputUnicode
Default:
'index'No description
- MasterConverter.preprocessorsList
Default:
[<class 'dscreate.pipeline.preprocessors.ClearOutput.ClearOut...No description
- MasterConverter.solution_dirUnicode
Default:
'/Users/joel/Documents/scripts/dscreate/docs/.solution_files'No description
METHODS
start(self) -> None:
No description
ReleaseConverter¶
ReleaseConverter replicates
nbgrader generate
CONFIGURABLE VARIABLES:
- ReleaseConverter.enabledBool
Default:
TrueNo description
- ReleaseConverter.exporter_classType
Default:
'nbconvert.exporters.markdown.MarkdownExporter'No description
- ReleaseConverter.notebook_pathUnicode
Default:
'index.ipynb'No description
- ReleaseConverter.outputUnicode
Default:
'README'No description
- ReleaseConverter.preprocessorsList
Default:
[]No description
- ReleaseConverter.solution_dirUnicode
Default:
'/Users/joel/Documents/scripts/dscreate/docs/.solution_files'No description
METHODS
convert_notebook(self) -> None:
Create a resources object that tells the exporter how to format link urls for images.
Pass the notebook through the preprocessor and convert to the desired format via the exporter.
Write the notebook to file.
SolutionConverter¶
SolutionConverter generates the teacher facing notebook.
CONFIGURABLE VARIABLES:
- SolutionConverter.enabledBool
Default:
TrueNo description
- SolutionConverter.exporter_classType
Default:
'nbconvert.exporters.notebook.NotebookExporter'No description
- SolutionConverter.outputUnicode
Default:
'index'No description
- SolutionConverter.preprocessorsList
Default:
[<class 'dscreate.pipeline.preprocessors.ClearOutput.ClearOut...No description
- SolutionConverter.solution_dirUnicode
Default:
'/Users/joel/Documents/scripts/dscreate/docs/.solution_files'No description
METHODS
start(self) -> None:
No description
ReadmeConverter¶
Generates the readme for a notebook.
This converter has a
notebook_pathconfigurable variable that indicates what notebook should be converted. notebook_path defaults to ‘index.ipynb’ when--inlineis False and.solution_files/index.ipynbwhen--inlineis True.No preprocessors are applied by the ReadmeConverter.
CONFIGURABLE VARIABLES:
- ReadmeConverter.enabledBool
Default:
TrueNo description
- ReadmeConverter.exporter_classType
Default:
'nbconvert.exporters.markdown.MarkdownExporter'No description
- ReadmeConverter.notebook_pathUnicode
Default:
''No description
- ReadmeConverter.outputUnicode
Default:
'README'No description
- ReadmeConverter.preprocessorsList
Default:
[]No description
- ReadmeConverter.solution_dirUnicode
Default:
'/Users/joel/Documents/scripts/dscreate/docs/.solution_files'No description
METHODS
convert_notebook(self) -> None:
Create a resources object that tells the exporter how to format link urls for images.
Pass the notebook through the preprocessor and convert to the desired format via the exporter.
Write the notebook to file.
SourceConverter¶
SourceConverter generates a teacher facing readme for an nbgrader assignment.
CONFIGURABLE VARIABLES:
- SourceConverter.enabledBool
Default:
TrueNo description
- SourceConverter.exporter_classType
Default:
'nbconvert.exporters.markdown.MarkdownExporter'No description
- SourceConverter.notebook_pathUnicode
Default:
''No description
- SourceConverter.outputUnicode
Default:
'README'No description
- SourceConverter.preprocessorsList
Default:
[]No description
- SourceConverter.solution_dirUnicode
Default:
'/Users/joel/Documents/scripts/dscreate/docs/.solution_files'No description
METHODS
convert_notebook(self) -> None:
No description
MergeConverter¶
MergeConverter reads in lesson and solution notebooks and merges them into an edit file.
CONFIGURABLE VARIABLES:
- MergeConverter.enabledBool
Default:
TrueNo description
- MergeConverter.exporter_classType
Default:
'nbconvert.exporters.notebook.NotebookExporter'No description
- MergeConverter.oldBool
Default:
FalseNo description
- MergeConverter.outputUnicode
Default:
'curriculum'No description
- MergeConverter.preprocessorsList
Default:
[<class 'dscreate.pipeline.preprocessors.SortCells.SortCells'>]No description
- MergeConverter.solution_dirUnicode
Default:
'/Users/joel/Documents/scripts/dscreate/docs/.solution_files'No description
METHODS
read_notebook(self, filepath):
No description
paths(self):
No description
start(self) -> None:
No description
Preprocessors¶
AddCellIndex¶
AddCellIndex adds a metadata.index variable to a notebook and determines if a cell is a solution cell. This preprocessor is used primarily for
--inlinesplits.
CONFIGURABLE VARIABLES:
- AddCellIndex.default_languageUnicode
Default:
'ipython'Deprecated default highlight language as of 5.0, please use language_info metadata instead
- AddCellIndex.display_data_priorityList
Default:
['text/html', 'application/pdf', 'text/latex', 'image/svg+xml...An ordered list of preferred output type, the first encountered will usually be used when converting discarding the others.
- AddCellIndex.enabledBool
Default:
TrueWhether to use this preprocessor when running dscreate
- AddCellIndex.solution_tagsSet
Default:
{'#==SOLUTION==', '#__SOLUTION__', '==SOLUTION==', '__SOLUTIO...Tags indicating which cells are to be removed
METHODS
preprocess(self, nb, resources):
No description
preprocess_cell(self, cell, resources, cell_index):
No transformation is applied.
RemoveSolutionCells¶
RemoveSolutions removes cells that contain a solution tag.
This preprocess identifies both code and solution cells:
code solution tags defaults to: {‘#__SOLUTION__’, ‘#==SOLUTION==’} markdown solution tags defaults to: {‘==SOLUTION==’,’__SOLUTION__’}
CONFIGURABLE VARIABLES:
- RemoveSolutionCells.code_tagsSet
Default:
{'#==SOLUTION==', '#__SOLUTION__'}Tags indicating which cells are to be removed
- RemoveSolutionCells.default_languageUnicode
Default:
'ipython'Deprecated default highlight language as of 5.0, please use language_info metadata instead
- RemoveSolutionCells.display_data_priorityList
Default:
['text/html', 'application/pdf', 'text/latex', 'image/svg+xml...An ordered list of preferred output type, the first encountered will usually be used when converting discarding the others.
- RemoveSolutionCells.enabledBool
Default:
TrueWhether to use this preprocessor when running dscreate
- RemoveSolutionCells.markdown_tagsSet
Default:
{'==SOLUTION==', '__SOLUTION__'}No description
METHODS
is_code_solution(self, cell):
Checks that a cell has a tag that is to be removed Returns: Boolean. True means cell should not be removed.
is_markdown_solution(self, cell):
No description
found_tag(self, cell):
No description
preprocess(self, nb, resources):
No description
RemoveLessonCells¶
RemoveLessonCells removes cells that do not contain a tag included in the
solution_tagsvariable.
solution_tagsare a configurable variable. Defaults to {‘#__SOLUTION__’, ‘#==SOLUTION==’, ‘__SOLUTION__’, ‘==SOLUTION==’}
CONFIGURABLE VARIABLES:
- RemoveLessonCells.default_languageUnicode
Default:
'ipython'Deprecated default highlight language as of 5.0, please use language_info metadata instead
- RemoveLessonCells.display_data_priorityList
Default:
['text/html', 'application/pdf', 'text/latex', 'image/svg+xml...An ordered list of preferred output type, the first encountered will usually be used when converting discarding the others.
- RemoveLessonCells.enabledBool
Default:
TrueWhether to use this preprocessor when running dscreate
- RemoveLessonCells.solution_tagsSet
Default:
{'#==SOLUTION==', '#__SOLUTION__', '==SOLUTION==', '__SOLUTIO...Tags indicating which cells are to be removed
METHODS
is_solution(self, cell):
Checks that a cell has a solution tag.
preprocess(self, nb, resources):
No description
preprocess_cell(self, cell):
Removes the solution tag from the solution cells.
SortCells¶
Sorts the cells of a notebook according to the metadata.index variable and adds a solution tag back to solution cells.
CONFIGURABLE VARIABLES:
- SortCells.default_languageUnicode
Default:
'ipython'Deprecated default highlight language as of 5.0, please use language_info metadata instead
- SortCells.display_data_priorityList
Default:
['text/html', 'application/pdf', 'text/latex', 'image/svg+xml...An ordered list of preferred output type, the first encountered will usually be used when converting discarding the others.
- SortCells.enabledBool
Default:
TrueWhether to use this preprocessor when running dscreate
METHODS
preprocess(self, nb, resources):
No description
preprocess_cell(self, cell, resources, cell_index):
No description
ClearOutput¶
ClearOutput removes the outputs for notebook cells.
CONFIGURABLE VARIABLES:
- ClearOutput.default_languageUnicode
Default:
'ipython'Deprecated default highlight language as of 5.0, please use language_info metadata instead
- ClearOutput.display_data_priorityList
Default:
['text/html', 'application/pdf', 'text/latex', 'image/svg+xml...An ordered list of preferred output type, the first encountered will usually be used when converting discarding the others.
- ClearOutput.enabledBool
Default:
TrueWhether to use this preprocessor when running dscreate
- ClearOutput.remove_metadata_fieldsSet
Default:
{'collapsed', 'scrolled'}No description
METHODS
ExecuteCells¶
ExecuteCells runs code cells in a notebook.
CONFIGURABLE VARIABLES:
- ExecuteCells.allow_error_namesList
Default:
[]List of error names which won’t stop the execution. Use this if the
allow_errorsoption it too general and you want to allow only specific kinds of errors.- ExecuteCells.allow_errorsBool
Default:
FalseIf
False(default), when a cell raises an error the execution is stopped and a CellExecutionError is raised, except if the error name is inallow_error_names. IfTrue, execution errors are ignored and the execution is continued until the end of the notebook. Output from exceptions is included in the cell output in both cases.- ExecuteCells.default_languageUnicode
Default:
'ipython'Deprecated default highlight language as of 5.0, please use language_info metadata instead
- ExecuteCells.display_data_priorityList
Default:
['text/html', 'application/pdf', 'text/latex', 'image/svg+xml...An ordered list of preferred output type, the first encountered will usually be used when converting discarding the others.
- ExecuteCells.enabledBool
Default:
TrueWhether to use this preprocessor when running dscreate
- ExecuteCells.extra_argumentsList
Default:
[]No description
- ExecuteCells.force_raise_errorsBool
Default:
FalseIf False (default), errors from executing the notebook can be allowed with a
raises-exceptiontag on a single cell, or theallow_errorsorallow_error_namesconfigurable options for all cells. An allowed error will be recorded in notebook output, and execution will continue. If an error occurs when it is not explicitly allowed, a CellExecutionError will be raised. If True, CellExecutionError will be raised for any error that occurs while executing the notebook. This overrides theallow_errorsandallow_error_namesoptions and theraises-exceptioncell tag.- ExecuteCells.interrupt_on_timeoutBool
Default:
FalseIf execution of a cell times out, interrupt the kernel and continue executing other cells rather than throwing an error and stopping.
- ExecuteCells.iopub_timeoutInt
Default:
4The time to wait (in seconds) for IOPub output. This generally doesn’t need to be set, but on some slow networks (such as CI systems) the default timeout might not be long enough to get all messages.
- ExecuteCells.ipython_hist_fileUnicode
Default:
':memory:'Path to file to use for SQLite history database for an IPython kernel.
The specific value
:memory:(including the colon at both end but not the back ticks), avoids creating a history file. Otherwise, IPython will create a history file for each kernel.When running kernels simultaneously (e.g. via multiprocessing) saving history a single SQLite file can result in database errors, so using
:memory:is recommended in non-interactive contexts.- ExecuteCells.kernel_manager_classType
Default:
'builtins.object'The kernel manager class to use.
- ExecuteCells.kernel_nameUnicode
Default:
''Name of kernel to use to execute the cells. If not set, use the kernel_spec embedded in the notebook.
- ExecuteCells.raise_on_iopub_timeoutBool
Default:
FalseIf
False(default), then the kernel will continue waiting for iopub messages until it receives a kernel idle message, or until a timeout occurs, at which point the currently executing cell will be skipped. IfTrue, then an error will be raised after the first timeout. This option generally does not need to be used, but may be useful in contexts where there is the possibility of executing notebooks with memory-consuming infinite loops.- ExecuteCells.record_timingBool
Default:
TrueIf
True(default), then the execution timings of each cell will be stored in the metadata of the notebook.- ExecuteCells.shell_timeout_intervalInt
Default:
5The time to wait (in seconds) for Shell output before retrying. This generally doesn’t need to be set, but if one needs to check for dead kernels at a faster rate this can help.
- ExecuteCells.shutdown_kernelany of
'graceful'``|’immediate’`` Default:
'graceful'If
graceful(default), then the kernel is given time to clean up after executing all cells, e.g., to execute itsatexithooks. Ifimmediate, then the kernel is signaled to immediately terminate.- ExecuteCells.startup_timeoutInt
Default:
60The time to wait (in seconds) for the kernel to start. If kernel startup takes longer, a RuntimeError is raised.
- ExecuteCells.store_widget_stateBool
Default:
TrueIf
True(default), then the state of the Jupyter widgets created at the kernel will be stored in the metadata of the notebook.- ExecuteCells.timeoutInt
Default:
NoneThe time to wait (in seconds) for output from executions. If a cell execution takes longer, a TimeoutError is raised.
Noneor-1will disable the timeout. Iftimeout_funcis set, it overridestimeout.- ExecuteCells.timeout_funcAny
Default:
NoneA callable which, when given the cell source as input, returns the time to wait (in seconds) for output from cell executions. If a cell execution takes longer, a TimeoutError is raised.
Returning
Noneor-1will disable the timeout for the cell. Not settingtimeout_funcwill cause the client to default to using thetimeouttrait for all cells. Thetimeout_functrait overridestimeoutif it is notNone.
METHODS
DsCreatePreprocessor¶
The base preprocessor object for dscreate.
CONFIGURABLE VARIABLES:
- DsCreatePreprocessor.default_languageUnicode
Default:
'ipython'Deprecated default highlight language as of 5.0, please use language_info metadata instead
- DsCreatePreprocessor.display_data_priorityList
Default:
['text/html', 'application/pdf', 'text/latex', 'image/svg+xml...An ordered list of preferred output type, the first encountered will usually be used when converting discarding the others.
- DsCreatePreprocessor.enabledBool
Default:
TrueWhether to use this preprocessor when running dscreate
METHODS
AddLanguage¶
Adds name of coding language to code blocks.
CONFIGURABLE VARIABLES:
- AddLanguage.default_languageUnicode
Default:
'ipython'Deprecated default highlight language as of 5.0, please use language_info metadata instead
- AddLanguage.display_data_priorityList
Default:
['text/html', 'application/pdf', 'text/latex', 'image/svg+xml...An ordered list of preferred output type, the first encountered will usually be used when converting discarding the others.
- AddLanguage.enabledBool
Default:
TrueWhether to use this preprocessor when running dscreate
- AddLanguage.languageUnicode
Default:
'python'No description
METHODS
preprocess(self, nb, resources):
No description