New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementing mypyc support pt. 2 #2431
Commits on Jun 29, 2021
-
-
Make the test suite usable for testing
Pretty much marking a few tests as straight incompatible or marking certain functions with monkeypatching support. Also address the lack of 3.8 or higher support in src/black/parsing.py caused by my original changes. Finally tweak the compile configuration.
Commits on Jun 30, 2021
-
Fix mypyc KeyError on src/black/parsing.py
Typing the ast3 / ast27 variables as Any breaks mypyc. More details in the comment added in this commit. Many thanks goes to Jelle for helping out, with their insight I was able to find a workaround.
-
Saves ~100 kB on my Linux machine :)
before .whl was 1.3M and now it is 1.2M
-
Commits on Jul 1, 2021
Commits on Jul 10, 2021
-
The `platform=linux` was causing mypy (and therefore mypyc) to believe any `if sys.platform == "win32":` branch would never be taken. That led to `Reached allegedly unreachable code!` crashes because of safety checks mypyc adds. There's not a strong reason for pinning the platform in `mypy.ini` so with the agreement of Jelle, it's gone now! I also disabled CliRunner's exception catching feature because while it does lead to nicer test failures when an exception goes unhandled, it also removes traceback information which makes debugging a pain. P.S. You can blame Windows Update for the slowness of this bugfix :p
-
Ask mypy to warn on unreachable code
Unreachable code has either led to mypyc being unable to analyze or compile Black, or has led to runtime failures (like the one the previous commit fixed - although mypy wouldn't be able to catch it).
-
Clean up mypyc setup in setup.py
Hardcoding the targets isn't great since we will probably forget to add paths to the list as new files are created. Inspired from mypy's setup for mypyc.
Commits on Jul 17, 2021
Commits on Jul 27, 2021
-
-
More parsing optimizations - 4% faster
- early binding; plus - reordering of if checks to reduce work / hit the happy case more often; plus - a few more tiny mypyc-specific tweaks
Commits on Jul 31, 2021
Commits on Aug 1, 2021
Commits on Aug 7, 2021
-
Round 3 of optimizations - 95% black + 5% blib2to3
Honestly at this point, I was tired of optimizing and only attempted basic and safe optimizations. I hope this actually makes a performance impact :p
Commits on Aug 8, 2021
-
-
Fix crashes and errors since merge from main
Mostly just dataclasses nonsense + more pain from the TOML bare CR thing ... ugh
Commits on Aug 14, 2021
-
Mild hack so mypyc doesn't break diff-shades + cleanup
diff-shades depends on reformat_many being monkeypatchable so it can calculate files and black.Mode without copying and pasting a bunch of parsing, file discovery, and configuration code. On the other hand, I've been working on blackbench and upcoming version 21.8a1 is now compatible with the driver convert changes.
Commits on Aug 21, 2021
-
Address feedback & cleanup comments
- I don't actually have to go on a rant about tomli and bare CR it turns out. - Subclassing KeyError isn't actually *that* important for one custom exception.