Return pip install black[jupyter] hint with syntax to match platform #3254
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This change updates the message returned when Jupyter dependencies are not installed, so that it contains syntax corresponding to the platform.
Previously, attempting to apply black formatting to an ipynb notebook without black[jupyter] installed always returned the hint to run
pip install black[jupyter]
. This command does not work on Ubuntu with python3.With this change, in the same scenario, the hint is
pip install 'black[jupyter]'
if"linux"
is in the platform name, and the old hintpip install black[jupyter]
otherwise.The only function changed in the main codebase was
black.handle_ipynb_magics.jupyter_dependencies_are_installed
I updated
tests/test_no_ipynb.py
to mock linux and non-linux versions of the existing tests.Because this PR does not impact formatter rules or behavior, I did not update the CHANGELOG or documentation. However if I skipped any steps or missed anything please let me know, and I will take care of it :)
Checklist - did you ...
tests/test_no_ipynb.py
)