Python Forum
How to use nb-black python cde formatter
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to use nb-black python cde formatter
#3
(Jun-03-2020, 11:38 AM)ErnestTBass Wrote: I am using a jupyter notebook on Ubuntu with python 3.7.7.
We have talk a lot about setup and environment in your previous Thread.
If you use Anaconda as in your other post,most remember to activate base.
Then test with pip -V and it should now point to the Anaconda placement.
Here a quick test on Windows now,could do the same on Linux no difference.
G:\Anaconda3
λ G:\Anaconda3\Scripts\activate

(base) G:\Anaconda3
λ pip -V
pip 20.0.2 from G:\Anaconda3\lib\site-packages\pip (python 3.7)

(base) G:\Anaconda3
λ pip install nb-black
Collecting nb-black
.....
Successfully built nb-black
Installing collected packages: nb-black
Successfully installed nb-black-1.0.7

(base) G:\Anaconda3
λ jupyter lab
[I 17:11:58.129 LabApp] JupyterLab extension loaded from g:\anaconda3\lib\site-packages\jupyterlab
So no have installed nb-black and start jupyter lab all in base environment.

Test
%load_ext lab_black  

def foo():
 return 42

thisdict = {"brand": "Ford", "model": "Mustang", "year": 1964, "brand": "Bmw", "model": "M3", "year": 1980} 
Run cell:
def foo():
    return 42


thisdict = {
    "brand": "Ford",
    "model": "Mustang",
    "year": 1964,
    "brand": "Bmw",
    "model": "M3",
    "year": 1980,
}
So if work as expected black dos it's job and formatting the code in NoteBook.
Reply


Messages In This Thread
RE: How to use nb-black python cde formatter - by snippsat - Jun-03-2020, 03:42 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  remove all color but red, then replace it with black kucingkembar 14 7,397 Dec-29-2021, 07:50 PM
Last Post: deanhystad
  VS Code Python Formatter muzikman 6 3,010 Sep-16-2021, 04:40 PM
Last Post: DeaD_EyE
  Checkbuttons always come up as black boxes regardless of the state kenwatts275 5 4,843 Jul-07-2020, 08:00 PM
Last Post: kenwatts275
  Finance: Black Scholes Model not working pwt 5 4,037 May-27-2020, 10:14 AM
Last Post: buran
  after using openpyxl to add colors to script, black shows up white online in excel Soundtechscott 1 3,737 Jun-08-2019, 10:33 PM
Last Post: Soundtechscott
  Because the emoji appears black and white at the exit ? nerd 3 5,677 Jan-28-2019, 11:34 PM
Last Post: nerd
  Python interface only black and white........ Wilson 3 6,253 Jul-15-2017, 01:20 PM
Last Post: sparkz_alot

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020