notebook: Python 3.6 f-strings break notebook syntax highlighting

Using Notebook v4.3.1, use of f-strings (PEP 498, Python 3.6) breaks syntax highlighting for the remaining code in a given cell.

Is Jupyter curently unable to handle this syntax? I would imagine that this issue would have been raised by others were this the case.

Using OS X, brewed Python 3.6.0, Firefox 50.

$ python3 --version
Python 3.6.0
$ jupyter --version
4.2.1
$ jupyter-notebook --version
4.3.1
$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.12.2
BuildVersion:	16C68

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 2
  • Comments: 16 (10 by maintainers)

Commits related to this issue

Most upvoted comments

Patch

Temporary solution tested on notebook version 4.3.1

Two patterns inside site-packages/notebook/static/notebook/js/main.min.js need replacing: [rub] with [rubf] and "rub" with "rubf"

With sed:

sed -i 's/'"rub"'/'"rubf"'/g' -i 's/\[rub\]/\[rubf\]/g' /usr/local/lib/python3.6/site-packages/notebook/static/notebook/js/main.min.js

Thanks, at least the fix is trivial.

Could we at least patch the existing Codemirror version? F-strings are the big ticket item in Python 3.6 after all.

I’ve marked this as 5.0 - I’d really like to get it fixed soon, because syntax highlighting is currently broken with the new Python 3.6 strings.

Are we aware of any fix for the Safari issue in CodeMirror that would let us update it again? If not, can we work out a way to use a patched CodeMirror?