format-ipy-cells-0.1.10
توضیحات
Format cells in interactive Python notebooks.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | format-ipy-cells-0.1.10 |
| نام | format-ipy-cells |
| نسخه کتابخانه | 0.1.10 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Janosh Riebesell |
| ایمیل نویسنده | janosh.riebesell@gmail.com |
| آدرس صفحه اصلی | https://github.com/janosh/format-ipy-cells |
| آدرس اینترنتی | https://pypi.org/project/format-ipy-cells/ |
| مجوز | MIT |
# Format iPython Cells
[](https://github.com/janosh/format-ipy-cells/actions/workflows/test.yml)
[](https://results.pre-commit.ci/latest/github/janosh/format-ipy-cells/main)
[](https://python.org/downloads)
[](https://github.com/pre-commit/pre-commit)
[](https://pypi.org/project/format-ipy-cells)
Python code formatter (and [`pre-commit`](https://pre-commit.com) hook) for cell delimiters (`# %%`) in [VS Code-style interactive Python notebooks](https://code.visualstudio.com/docs/python/jupyter-support-py).
This formatter ensures
- cells are preceded by two empty lines:
```py
# %%
foo='bar'
# %%
```
```py
# %%
foo='bar'
# %%
```
- empty cells are removed:
```py
# %%
# %%
```
```py
# %%
```
- same-line comments are separated by a single space:
```py
# %%some comment
foo = 'bar'
# %% another comment
```
```py
# %% some comment
foo = 'bar'
# %% another comment
```
## Installation
```sh
pip install format-ipy-cells
```
## Usage
### CLI
```sh
format-ipy-cells path/to/file.py
# or
format-ipy-cells **/*.py
```
## As `pre-commit` hook
Add this to your `.pre-commit-config.yaml`:
```yml
repos
- repo: https://github.com/janosh/format-ipy-cells
rev: v0.1.7
hooks:
- id: format-ipy-cells
```
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.8 | Python |
نحوه نصب
نصب پکیج whl format-ipy-cells-0.1.10:
pip install format-ipy-cells-0.1.10.whl
نصب پکیج tar.gz format-ipy-cells-0.1.10:
pip install format-ipy-cells-0.1.10.tar.gz