sandialabs / Prove-It

A tool for proving and organizing general theorems using Python.
http://pyproveit.org
Other
27 stars 10 forks source link

build.py must be updated for new version of nbconvert #235

Open wwitzel opened 3 years ago

wwitzel commented 3 years ago

This was a problem for @wdcraft01 when he upgraded his Python version (with a new nbconvert version). We hacked build.py to get it work for him, but we need to fix it properly. The hacks we made to get this to execute were:

  1. Use RecyclingExecutePreprocessor.setup_kernel() as the ContextManager rather than the RecyclingExecutePreprocessor object itself.
  2. RecyclingExecutePreprocessor.init: added self.store_history = False
  3. RecyclingExecutePreprocessor.preprocessor: added self.nb= nb
  4. We commented html_exporter.template_file = ... command. We need to figure out how to set the 'template_file' so it can find it in the new version. It may be looking in the wrong path. Not sure.
wwitzel commented 3 years ago

Another issue is that it seems to be writing extra cell executions (e.g., garbage collection and resetting) to the nb object and then saving those to the notebooks. This may relate to our "self.nb = nb" change. For now, @wdcraft01 , just comment out the lines in build.py where it saves changed notebooks: if new_nb_str != nb_str:

Write it out if it has changed.

        with open(notebook_path, 'wt', encoding='utf8') as f:
            f.write(new_nb_str)

That way, you can do a build --essential for your purposes but not have the headache of your notebooks getting garbled. It will still make the changes to the "database" (__pv_it directories) that are needed.