Name | format-ipy-cells JSON |
Version |
0.1.11
JSON |
| download |
home_page | |
Summary | Format cells in interactive Python notebooks. |
upload_time | 2024-03-03 06:37:09 |
maintainer | |
docs_url | None |
author | |
requires_python | >=3.10 |
license | MIT License Copyright (c) 2021 Janosh Riebesell Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. The software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software. |
keywords |
code formatting
interactive
ipython
jupyter
pre-commit hook
python
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Format iPython Cells
[![Tests](https://github.com/janosh/format-ipy-cells/actions/workflows/test.yml/badge.svg)](https://github.com/janosh/format-ipy-cells/actions/workflows/test.yml)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/janosh/format-ipy-cells/main.svg)](https://results.pre-commit.ci/latest/github/janosh/format-ipy-cells/main)
[![Requires Python 3.10+](https://img.shields.io/badge/Python-3.10+-blue.svg?logo=python&logoColor=white)](https://python.org/downloads)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
[![PyPI](https://img.shields.io/pypi/v/format-ipy-cells?logo=pypi&logoColor=white)](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
- cell delimiters are preceded by two empty lines:
```py
# %% before
foo='bar'
# %%
```
```py
# %% after
foo='bar'
# %%
```
- empty cells are removed:
```py
# %% before
# %%
```
```py
# %% after
```
- comments on the same line as cell delimiters are separated by a single space:
```py
# %%some comment before
foo = 'bar'
# %% another comment
```
```py
# %% some comment after
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
```yml
# .pre-commit-config.yaml
repos
- repo: https://github.com/janosh/format-ipy-cells
rev: v0.1.10
hooks:
- id: format-ipy-cells
```
Raw data
{
"_id": null,
"home_page": "",
"name": "format-ipy-cells",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "",
"keywords": "code formatting,interactive,ipython,jupyter,pre-commit hook,python",
"author": "",
"author_email": "Janosh Riebesell <janosh.riebesell@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/4b/fd/ca4a5575ec863ff315ef1e39207a01c3937ede88d629b4bd6bfb2a265a6f/format-ipy-cells-0.1.11.tar.gz",
"platform": null,
"description": "# Format iPython Cells\n\n[![Tests](https://github.com/janosh/format-ipy-cells/actions/workflows/test.yml/badge.svg)](https://github.com/janosh/format-ipy-cells/actions/workflows/test.yml)\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/janosh/format-ipy-cells/main.svg)](https://results.pre-commit.ci/latest/github/janosh/format-ipy-cells/main)\n[![Requires Python 3.10+](https://img.shields.io/badge/Python-3.10+-blue.svg?logo=python&logoColor=white)](https://python.org/downloads)\n[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)\n[![PyPI](https://img.shields.io/pypi/v/format-ipy-cells?logo=pypi&logoColor=white)](https://pypi.org/project/format-ipy-cells)\n\nPython 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).\n\nThis formatter ensures\n\n- cell delimiters are preceded by two empty lines:\n\n ```py\n # %% before\n foo='bar'\n # %%\n ```\n\n ```py\n # %% after\n foo='bar'\n\n\n # %%\n ```\n\n- empty cells are removed:\n\n ```py\n # %% before\n\n # %%\n ```\n\n ```py\n # %% after\n ```\n\n- comments on the same line as cell delimiters are separated by a single space:\n\n ```py\n # %%some comment before\n foo = 'bar'\n # %% another comment\n ```\n\n ```py\n # %% some comment after\n foo = 'bar'\n # %% another comment\n ```\n\n## Installation\n\n```sh\npip install format-ipy-cells\n```\n\n## Usage\n\n### CLI\n\n```sh\nformat-ipy-cells path/to/file.py\n# or\nformat-ipy-cells **/*.py\n```\n\n### As `pre-commit` hook\n\n```yml\n# .pre-commit-config.yaml\n\nrepos\n - repo: https://github.com/janosh/format-ipy-cells\n rev: v0.1.10\n hooks:\n - id: format-ipy-cells\n```\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2021 Janosh Riebesell Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. The software is provided \"as is\", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software. ",
"summary": "Format cells in interactive Python notebooks.",
"version": "0.1.11",
"project_urls": {
"Homepage": "https://github.com/janosh/format-ipy-cells",
"Package": "https://pypi.org/project/format-ipy-cells"
},
"split_keywords": [
"code formatting",
"interactive",
"ipython",
"jupyter",
"pre-commit hook",
"python"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0a4ef48212cb72fa52de62e116abeaad565775a8cb3523a67ba4a95dff360013",
"md5": "a8a95b5f72a6abf1b6b16deeb98bb92d",
"sha256": "5c45674cfa1e7b96f5945e7cc29d4e89595f17cbd1c9f6e3462121e966f11f9d"
},
"downloads": -1,
"filename": "format_ipy_cells-0.1.11-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a8a95b5f72a6abf1b6b16deeb98bb92d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 5056,
"upload_time": "2024-03-03T06:37:05",
"upload_time_iso_8601": "2024-03-03T06:37:05.914203Z",
"url": "https://files.pythonhosted.org/packages/0a/4e/f48212cb72fa52de62e116abeaad565775a8cb3523a67ba4a95dff360013/format_ipy_cells-0.1.11-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4bfdca4a5575ec863ff315ef1e39207a01c3937ede88d629b4bd6bfb2a265a6f",
"md5": "10df7ccd6cf3645b61d77ce381746d3c",
"sha256": "9d2287ec9b8b661d181eec5bf31474271d0b3b02ec689341fc25227d6c9bdbf0"
},
"downloads": -1,
"filename": "format-ipy-cells-0.1.11.tar.gz",
"has_sig": false,
"md5_digest": "10df7ccd6cf3645b61d77ce381746d3c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 6105,
"upload_time": "2024-03-03T06:37:09",
"upload_time_iso_8601": "2024-03-03T06:37:09.131371Z",
"url": "https://files.pythonhosted.org/packages/4b/fd/ca4a5575ec863ff315ef1e39207a01c3937ede88d629b4bd6bfb2a265a6f/format-ipy-cells-0.1.11.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-03 06:37:09",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "janosh",
"github_project": "format-ipy-cells",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "format-ipy-cells"
}