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
File details
Details for the file format-ipy-cells-0.1.11.tar.gz
.
File metadata
- Download URL: format-ipy-cells-0.1.11.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d2287ec9b8b661d181eec5bf31474271d0b3b02ec689341fc25227d6c9bdbf0 |
|
MD5 | 10df7ccd6cf3645b61d77ce381746d3c |
|
BLAKE2b-256 | 4bfdca4a5575ec863ff315ef1e39207a01c3937ede88d629b4bd6bfb2a265a6f |
File details
Details for the file format_ipy_cells-0.1.11-py3-none-any.whl
.
File metadata
- Download URL: format_ipy_cells-0.1.11-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c45674cfa1e7b96f5945e7cc29d4e89595f17cbd1c9f6e3462121e966f11f9d |
|
MD5 | a8a95b5f72a6abf1b6b16deeb98bb92d |
|
BLAKE2b-256 | 0a4ef48212cb72fa52de62e116abeaad565775a8cb3523a67ba4a95dff360013 |