Format cells in interactive Python notebooks.
Project description
Format iPython Cells
Python code formatter (and pre-commit
hook) for cell delimiters (# %%
) in VS Code-style interactive Python notebooks.
This formatter ensures
-
cell delimiters are preceded by two empty lines:
# %% before foo='bar' # %%
# %% after foo='bar' # %%
-
empty cells are removed:
# %% before # %%
# %% after
-
comments on the same line as cell delimiters are separated by a single space:
# %%some comment before foo = 'bar' # %% another comment
# %% some comment after foo = 'bar' # %% another comment
Installation
pip install format-ipy-cells
Usage
CLI
format-ipy-cells path/to/file.py
# or
format-ipy-cells **/*.py
As pre-commit
hook
# .pre-commit-config.yaml
repos
- repo: https://github.com/janosh/format-ipy-cells
rev: v0.1.10
hooks:
- id: format-ipy-cells
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for format_ipy_cells-0.1.11-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c45674cfa1e7b96f5945e7cc29d4e89595f17cbd1c9f6e3462121e966f11f9d |
|
MD5 | a8a95b5f72a6abf1b6b16deeb98bb92d |
|
BLAKE2b-256 | 0a4ef48212cb72fa52de62e116abeaad565775a8cb3523a67ba4a95dff360013 |