Skip to content

Commit 51531dd

Browse files
committed
Update version of nbformat used
In more recent versions of Python like 3.10, the `base64` package changed APIs, and this in turn caused nbformat 4.4.0 to fail to work. Updating to the latest version (5.1.3) solved that problem. A minor tweak was also needed in scripts/format_ipynb.py to account for a different error class being returned when "!pip ..." commands are encountered in the notebook file.
1 parent 8487280 commit 51531dd

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cirq-core==1.3.0
22
cirq-google==1.3.0
33
sympy==1.12
44
numpy==1.24.2 # TensorFlow can detect if it was built against other versions.
5-
nbformat==4.4.0
5+
nbformat==5.1.3
66
pylint==2.4.4
77
yapf==0.40.2
88
tensorflow==2.15.0

scripts/format_ipynb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
try:
3131
fmt_lines = yapf.yapf_api.FormatCode(''.join(lines),
3232
style_config="google")[0]
33-
except SyntaxError:
33+
except (SyntaxError, yapf.yapflib.errors.YapfError):
3434
continue
3535
# google style always adds an EOF newline; undo this.
3636
all_cells[i]['source'] = fmt_lines[:-1]

0 commit comments

Comments
 (0)