-
Notifications
You must be signed in to change notification settings - Fork 36
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
Black formatter v2024.0.0 doesn't work in jupyter notebook #447
Comments
@mika457 Can you check Output > Black Formatter? see if it actually triggers formatting. |
@karthiknadig Hello! Thanks for your reply. Here are the logs of both v2023.6.0 and v2024.0.0. v2024.0.0:
v2023.6.0:
|
Same here, I noticed that saving Jupyter notebooks became very slow as VS code was waiting for the black formatter to finish. It does format, but it takes a while as it's restarting the server process. Te notebook I have has 2 cells and VS code is configured to format on save. Unfold for Black Formatter output2024-02-07 23:03:47.800 [info] [Trace - 11:03:47 PM] Sending request 'textDocument/formatting - (1)'.
2024-02-07 23:03:47.800 [info] [Trace - 11:03:47 PM] Sending request 'textDocument/formatting - (2)'.
2024-02-07 23:03:47.801 [info] [Trace - 11:03:47 PM] Sending request 'textDocument/formatting - (3)'.
2024-02-07 23:03:47.801 [info] [Trace - 11:03:47 PM] Sending request 'textDocument/formatting - (4)'.
2024-02-07 23:03:47.801 [info] [Trace - 11:03:47 PM] Sending request 'textDocument/formatting - (5)'.
2024-02-07 23:03:47.802 [info] [Trace - 11:03:47 PM] Sending request 'textDocument/formatting - (6)'.
2024-02-07 23:03:47.802 [info] [Trace - 11:03:47 PM] Sending request 'textDocument/formatting - (7)'.
2024-02-07 23:03:47.802 [info] [Trace - 11:03:47 PM] Sending request 'textDocument/formatting - (8)'.
2024-02-07 23:03:47.808 [info] [Trace - 11:03:47 PM] Received notification 'window/logMessage'.
2024-02-07 23:03:47.808 [info] C:\ProgramData\Anaconda3\python.exe -m black --line-length 110 --stdin-filename l:\UserData\<SNIP>\Repositories\<SNIP>\some-name\notebooks\plot_aggregated_kpi.py -
2024-02-07 23:03:47.809 [info] [Trace - 11:03:47 PM] Received notification 'window/logMessage'.
2024-02-07 23:03:47.809 [info] CWD formatter: l:\UserData\<SNIP>\Repositories\<SNIP>\some-name
2024-02-07 23:03:47.824 [info] [Trace - 11:03:47 PM] Received notification 'window/logMessage'.
2024-02-07 23:03:47.824 [info] reformatted l:\UserData\<SNIP>\Repositories\<SNIP>\some-name\notebooks\plot_aggregated_kpi.py
All done! ✨ 🍰 ✨
1 file reformatted.
2024-02-07 23:03:47.825 [info] [Trace - 11:03:47 PM] Received response 'textDocument/formatting - (1)' in 25ms.
2024-02-07 23:03:55.323 [info] [Info - 11:03:55 PM] Connection to server got closed. Server will restart.
2024-02-07 23:03:55.323 [info] true
2024-02-07 23:03:55.499 [info] [Error - 11:03:55 PM] Server process exited with code 1.
2024-02-07 23:03:56.282 [info] CWD Server: l:\UserData\<SNIP>\Repositories\<SNIP>\some-name
2024-02-07 23:03:56.288 [info] C:\ProgramData\Anaconda3\python.exe -m black --version
2024-02-07 23:03:56.288 [info] CWD formatter: l:\UserData\<SNIP>\Repositories\<SNIP>\some-name
2024-02-07 23:03:56.463 [info] Version info for formatter running for L:\UserData\<SNIP>\Repositories\<SNIP>\some-name:
black, 24.1.1 (compiled: no)
Python (CPython) 3.9.18
2024-02-07 23:03:56.463 [info] SUPPORTED black>=22.3.0
FOUND black==24.1.1
2024-02-07 23:03:56.464 [info] Settings used to run Server:
[
{
"cwd": "l:\\UserData\\<SNIP>\\Repositories\\<SNIP>\\some-name",
"workspace": "file:///l%3A/UserData/<SNIP>/Repositories/<SNIP>/some-name",
"args": [
"--line-length",
"110"
],
"path": [],
"interpreter": [
"C:\\ProgramData\\Anaconda3\\python.exe"
],
"importStrategy": "useBundled",
"showNotifications": "onError"
}
]
2024-02-07 23:03:56.464 [info] Global settings:
{
"cwd": "C:\\Program Files\\Microsoft VS Code",
"workspace": "C:\\Program Files\\Microsoft VS Code",
"args": [
"--line-length",
"110"
],
"path": [],
"interpreter": [],
"importStrategy": "useBundled",
"showNotifications": "onError"
}
2024-02-07 23:03:56.464 [info] sys.path used to run Server:
c:\Users\<SNIP>\.vscode\extensions\ms-python.black-formatter-2024.0.0\bundled\libs
c:\Users\<SNIP>\.vscode\extensions\ms-python.black-formatter-2024.0.0\bundled\tool
C:\ProgramData\Anaconda3\python39.zip
C:\ProgramData\Anaconda3\DLLs
C:\ProgramData\Anaconda3\lib
C:\ProgramData\Anaconda3
C:\ProgramData\Anaconda3\lib\site-packages
C:\ProgramData\Anaconda3\lib\site-packages\oscillator_snap-1.0-py3.7.egg
C:\ProgramData\Anaconda3\lib\site-packages\win32
C:\ProgramData\Anaconda3\lib\site-packages\win32\lib
C:\ProgramData\Anaconda3\lib\site-packages\Pythonwin When I switch the black extension to the pre-release Unfold for Black Formatter output of pre-release version
VS Code info:
|
@mika457 try the pre-release version. This might also be related to psf/black#4205 where black just ignores formatting some files. |
@karthiknadig OK, thanks |
@GF-Huang You have not selected a python for your workspace. Please select one using |
Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on then we will be happy to re-open this issue to pick up where we left off. |
After I updated Black formatter to v2024.0.0, whenever I save the notebook, a notification of "Saving xx.ipynb: formatting" will show up while the formatting will never be done. However, Black formatter v2023.6.0 still works well in terms of formatting on save.
The text was updated successfully, but these errors were encountered: