Skip to content
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

Merged
merged 28 commits into from Nov 16, 2021
Merged

Implementing mypyc support pt. 2 #2431

merged 28 commits into from Nov 16, 2021

Commits on Jun 29, 2021

  1. Copy the full SHA
    9531e1b View commit details
    Browse the repository at this point in the history
  2. 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.
    ichard26 committed Jun 29, 2021
    Copy the full SHA
    6e9e0fb View commit details
    Browse the repository at this point in the history

Commits on Jun 30, 2021

  1. 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.
    ichard26 committed Jun 30, 2021
    Copy the full SHA
    acb77f7 View commit details
    Browse the repository at this point in the history
  2. Saves ~100 kB on my Linux machine :)

    before .whl was 1.3M and now it is 1.2M
    ichard26 committed Jun 30, 2021
    Copy the full SHA
    a37fb77 View commit details
    Browse the repository at this point in the history
  3. Copy the full SHA
    2ccc774 View commit details
    Browse the repository at this point in the history

Commits on Jul 1, 2021

  1. Copy the full SHA
    6f60e6e View commit details
    Browse the repository at this point in the history

Commits on Jul 10, 2021

  1. Fix mypyc + Black on Windows

    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
    ichard26 committed Jul 10, 2021
    Copy the full SHA
    f508be4 View commit details
    Browse the repository at this point in the history
  2. 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).
    ichard26 committed Jul 10, 2021
    Copy the full SHA
    94dcddb View commit details
    Browse the repository at this point in the history
  3. 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.
    ichard26 committed Jul 10, 2021
    Copy the full SHA
    57a25ed View commit details
    Browse the repository at this point in the history

Commits on Jul 17, 2021

  1. Copy the full SHA
    8f42f28 View commit details
    Browse the repository at this point in the history

Commits on Jul 27, 2021

  1. Copy the full SHA
    f6a3e78 View commit details
    Browse the repository at this point in the history
  2. 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
    ichard26 committed Jul 27, 2021
    Copy the full SHA
    911d0d8 View commit details
    Browse the repository at this point in the history

Commits on Jul 31, 2021

  1. Just some cleanup

    ichard26 committed Jul 31, 2021
    Copy the full SHA
    1f0df05 View commit details
    Browse the repository at this point in the history

Commits on Aug 1, 2021

  1. Copy the full SHA
    58fbe9c View commit details
    Browse the repository at this point in the history

Commits on Aug 7, 2021

  1. 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
    ichard26 committed Aug 7, 2021
    Copy the full SHA
    c7de2ea View commit details
    Browse the repository at this point in the history

Commits on Aug 8, 2021

  1. Copy the full SHA
    b956802 View commit details
    Browse the repository at this point in the history
  2. Fix crashes and errors since merge from main

    Mostly just dataclasses nonsense + more pain from the TOML bare CR
    thing ... ugh
    ichard26 committed Aug 8, 2021
    Copy the full SHA
    eaa4f6c View commit details
    Browse the repository at this point in the history

Commits on Aug 14, 2021

  1. 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.
    ichard26 committed Aug 14, 2021
    Copy the full SHA
    e9834e0 View commit details
    Browse the repository at this point in the history

Commits on Aug 21, 2021

  1. 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.
    ichard26 committed Aug 21, 2021
    Copy the full SHA
    f103dc0 View commit details
    Browse the repository at this point in the history

Commits on Oct 28, 2021

  1. Copy the full SHA
    5fc39fe View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    2f238ca View commit details
    Browse the repository at this point in the history
  3. Copy the full SHA
    f561b0c View commit details
    Browse the repository at this point in the history

Commits on Oct 30, 2021

  1. Copy the full SHA
    11b4f09 View commit details
    Browse the repository at this point in the history

Commits on Oct 31, 2021

  1. Copy the full SHA
    b0b3709 View commit details
    Browse the repository at this point in the history

Commits on Nov 14, 2021

  1. Copy the full SHA
    bb86dcf View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    5ef46f4 View commit details
    Browse the repository at this point in the history
  3. Copy the full SHA
    7c52cdb View commit details
    Browse the repository at this point in the history

Commits on Nov 16, 2021

  1. Copy the full SHA
    f5f1099 View commit details
    Browse the repository at this point in the history