Skip to content

herzogmar/black-magic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

black-magic

Pre-commit hook to sanitize and restore magic commands for code formatters like Black

Handles magic commands induced into .py files by Databricks notebooks, such as:

%load_ext autoreload
%autoreload 2

Firstly blackmagic-sanitize is run to make .py backups, comment out the magic commands, then a formatter hook can be run. Finally, blackmagic-restore unpacks the original .py files from backups.

Sample install:

.pre-commit-hooks.yaml

repos:
  - repo: https://github.com/MarvinHerzogTE/black-magic
    rev: 0.1.6
    hooks:
      - id: blackmagic
        # All black arguments are valid
        args: [--line-length=120, --diff]

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages