-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create/Find a repo that uses every python syntax + Add to Primer #2407
Comments
I think the cpython test suite is our best bet for this. I think there's a few files in there that have syntax errors on purpose so we need to be a little careful, but we can just exclude those files. |
So I spent a few hours getting most of cpython passing black. We have 16 files that fail with HEAD in main today. I also wanted to make sure it was not WAY to slow for CI. It seems reasonable, but lets see on a lot less CPU GitHub action container how long this takes. Test Checkout
Test RuntimesThe following times were captured via testing out on my 8 Core Apple M1 16gb of ram laptop. Run with esp:
Run without string processing:
Total Error Files: 16
PR coming with all failing files excluded for now. We will need to dig into why each file fails ... |
- cpython tests is probably the best repo for black to test on as the stdlib's unittests should use all syntax - Limit to running in recent versions of the python runtime - e.g. today >= 3.9 - This allows us to parse more syntax - Exclude all failing files for now - Definately have bugs to explore there - Refer to #2407 for more details there - Some test files on purpose have syntax errors, so we will never be able to parse them - Add new black command arguments logging in debug mode; very handy for seeing how CLI arguments are formatted cython now succeeds ignoring 16 files: ``` Oh no! 💥 💔 💥 1859 files would be reformatted, 148 files would be left unchanged. ``` Testing - Ran locally with and without string processing - Very little runtime difference BUT 3 more failed files ``` time /tmp/tb/bin/black --experimental-string-processing --check . 2>&1 | tee /tmp/black_cpython_esp ... Oh no! 💥 💔 💥 1859 files would be reformatted, 148 files would be left unchanged, 16 files would fail to reformat. real 4m8.563s user 16m21.735s sys 0m6.000s ``` - Add unittest for new covienence config file flattening that allows long arguments to be broke up into an array/list of strings Addresses #2407
* Add CPython repository into primer runs - CPython tests is probably the best repo for black to test on as the stdlib's unittests should use all syntax - Limit to running in recent versions of the python runtime - e.g. today >= 3.9 - This allows us to parse more syntax - Exclude all failing files for now - Definitely have bugs to explore there - Refer to #2407 for more details there - Some test files on purpose have syntax errors, so we will never be able to parse them - Add new black command arguments logging in debug mode; very handy for seeing how CLI arguments are formatted CPython now succeeds ignoring 16 files: ``` Oh no! 💥 💔 💥 1859 files would be reformatted, 148 files would be left unchanged. ``` Testing - Ran locally with and without string processing - Very little runtime difference BUT 3 more failed files ``` time /tmp/tb/bin/black --experimental-string-processing --check . 2>&1 | tee /tmp/black_cpython_esp ... Oh no! 💥 💔 💥 1859 files would be reformatted, 148 files would be left unchanged, 16 files would fail to reformat. real 4m8.563s user 16m21.735s sys 0m6.000s ``` - Add unittest for new covienence config file flattening that allows long arguments to be broke up into an array/list of strings Addresses #2407 --- Commit history before merge: * Add new `timeout_seconds` support into primer.json - If present, will set forked process limit to that value in seconds - Otherwise, stay with default 10 minutes (600 seconds) * Add new "base_path" concept to black-primer - Rather than start at the repo root start at a configured path within the repository - e.g. for cpython only run black on `Lib` * Disable by default - It's too much for GitHub Actions. But let's leave config for others to use * Minor tweak to _flatten_cli_args Co-authored-by: Richard Si <[email protected]>
I did some analysis on the crashing files, here's the summary: Unavoidable crashes (5/16):
... these all have syntax errors (majority on purpose) and we can't do anything about that ¯_(ツ)_/¯ Pre-existing issues (3/16):
... these use unsupported syntax -- parenthesized with statements and pattern matching respectively New issues (5/16):
The "we shouldn't worry about it" crashes (3/16):
... these are just the result of not having the |
zOMG - Legendary stuff here. I'll try add comments next to the files we can't / shouldn't try to remove from the exceptions. Then we'd love all the help we can making this pass on all other files. |
I tried to figure out what is going on with |
Also I think we should consider the fact that we crash on that function with 800 locals to be a feature. |
Small update: black can now parse |
It would be nice to have a repo cpython developers add in their new syntax sugar every time the latest betas add the new support. That way we can have black run over that code super early and let us know what we fail on with more time before it becomes main stream.
I wonder if we could try format just the cpython test suite .py files for this.
The text was updated successfully, but these errors were encountered: