-
Notifications
You must be signed in to change notification settings - Fork 18
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
Fix TypeError when formatting with black 22.1.0+ #30
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @wlcx, thanks a lot for your help with this! Your fix is correct, but you also need to fix our tests because Black 22.1 dropped Python 2 support.
For that, please go to
target-version = ['py27'] |
and change it for
target-version = ['py39']
Then here
python-lsp-black/tests/test_plugin.py
Lines 175 to 178 in 80403a7
def test_load_config_target_version(): | |
config = load_config(str(fixtures_dir / "target_version" / "example.py")) | |
assert config["target_version"] == {black.TargetVersion.PY27} |
please change PY27
to PY39
.
That should be enough.
@haplo, I think this requires an urgent 1.1.0 release. |
Agreed. I'm reproducing the error and validating this fix. @wlcx Will you be able to implement @ccordoba12's suggestion to fix the test suite? I can help with it if necessary, just let me know. |
Damn that was quick! On it now, also wrangling mypy errors. |
Do we need to retain backwards compatibility with prior black versions or can we require 22.1.0 as a minimum? |
I would like to retain backwards-compatibility, some users might not be able to upgrade for some reason. Is something in particular making it difficult? |
Resolve an TypeError issue caused by the return type of `find_project_root` changing in black 22.1.0.
This being said, I do believe python-lsp-black will only officially support the latest black version, so I will be adding a note about that in the README. |
Ok, think we're good to go, just need that first-time-contributor workflow approval |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested fix with old and new black versions, both work. 👍
Thank you for your help @wlcx, I will prepare a release immediately. |
No worries, thanks for such an awesome and speedy response both! |
Thanks @haplo for your help with this! |
Resolve an TypeError issue caused by the return type of
find_project_root
changing in black 22.1.0.Closes #29