-
Notifications
You must be signed in to change notification settings - Fork 124
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
Correctly render the "layers" tree view #281
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #281 +/- ##
==========================================
+ Coverage 97.50% 97.67% +0.16%
==========================================
Files 6 6
Lines 641 687 +46
==========================================
+ Hits 625 671 +46
Misses 16 16 ☔ View full report in Codecov by Sentry. |
I made some changes unrelated to my PR to get all of the tests (except the python 3.7 ones) to pass:
|
Thanks for the PR! I would likely gate this behind a row setting at least to begin with before officially making this the default behavior. |
For what it's worth, I don't think it makes sense to gate this behind a setting. Is the idea just to be gradual about making changes, or is there some way in which the current tree view is superior to the proposed one that I'm not appreciating? |
More about being gradual with changes - some people may rely on the output matching exactly so there needs to be at least one version announcing the change before we switch. There may also be some bugs with this implementation that we can fix in between releases. Apologies for taking so long to get to this PR, I haven't had the time recently to get this project up to date. Will get to a thorough review and merge soon (I need to fix some pre-commit stuff first). |
Ok, that makes sense. Let me know if you want me to add the option, or if you'd rather do that yourself. |
The best way to explain this PR is to show an example before and after:
Before:
After:
Note that the extra vertical bars have been removed, and the
├
character is consistently used when the vertical bar should continue into the next line.Minor comments:
I used the walrus operator pretty extensively in
formatting_test.py
, so the tests won't pass for python 3.7. Technically python 3.7 is past its EOL, so I wrote the code the way I did in the hopes that you'll be willing to make 3.8 the minimum supported version. If not, let me know and I'll find another way to write those tests.I had to configure pytest to find files named
*_test.py
, otherwise the pre-commit check wouldn't pass. I'm worried that I'm doing something wrong, because I don't see how the pre-commit check could've worked for anyone before this, but presumably it did.While writing this code, I noticed that the "Param #" column for named parameters didn't respect the
ascii_only
setting; it would always use the unicode└
or├
characters. Since I was changing a lot of the relevant code anyways, I fixed this bug while I was at it.I changed the ASCII-only format from:
to:
My main motivation was to make the "Param #" column less confusing. With the original format, this column ends up just looking like a bunch of positive numbers, rather than a tree view.