Skip to content

Instantly share code, notes, and snippets.

@mikeyhew
Last active January 26, 2017 00:51
Show Gist options
  • Save mikeyhew/08703e5c908a75cd9c2f00274ed620e6 to your computer and use it in GitHub Desktop.
Save mikeyhew/08703e5c908a75cd9c2f00274ed620e6 to your computer and use it in GitHub Desktop.
Use f-strings with mypy before python/mypy#2622 is merged

uninstall the old version of mypy so that the mypy command won't point to the old one

pip3 uninstall mypy

use the version of typed_ast from this PR: python/typed_ast#22

pip3 install -e git+https://github.com/kirbyfan64/typed_ast@fstring#egg=typed_ast

install the version of mypy from @achauve's PR

pip3 install -e git+https://github.com/achauve/mypy@handle-f-string-without-error#egg=mypy

MyPy should be working. Test it out.

echo 'f"{foo{1}bar{2}"' > fstring_test.py
mypy --fast-parser --python 3.6 fstring_test.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment