Giter VIP home page Giter VIP logo

blackcellmagic's People

Contributors

csurfer avatar neffmallon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

blackcellmagic's Issues

Feature Request: Auto Reformat on Execute & Save

Hello!

I would love if

  • my cell was automatically formatted on save
  • automatically format all cells on save (hopefully this isn't slow, but I guess a dirty flag could be set?)

I'm using VS Code. When I'm working on .py files, VS Code automatically does black formatting (and import sorting!) when I save. I wish I had that in my notebooks in VS Code as well. ๐Ÿฅฒ

If I have time I may dig into how I add that.

New line at end of cell

It seems a little weird to have a new line at the end of the cell. As far as I understand, the purpose for the new line at the end of the file is for versioning, but in jupyder notebooks, the code of each cell is already contained just a single line. Should the default behavior be to not end each cell with a new line?

Incompatible with black 19.3b0

Running with 19.3b0 gives the following error:

[blah-blah]python3.6/site-packages/blackcellmagic.py in black(self, line, cell)
     39         if cell:
     40             self.shell.set_next_input(
---> 41                 format_str(src_contents=cell, line_length=line_length),
     42                 replace=True,
     43             )

TypeError: format_str() got an unexpected keyword argument 'line_length'

It seems like this is a result of some changes to how format_str works. I believe line_length is determined by mode now.

Downgrading black by pip install black==18.9b0 fixes this issue.

%%black will not format cell with magic in it

When formatting cells with magic in it, like

  [...]
  import matplotlib.pyplot as plt
  import seaborn as sns
  import pandas as pd
  %matplotlib inline

the %%black magic returns the error
cannot parse: 12:0 %matplotlib inline

This happens with any line that has a % sign to indicate magic.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.