# ipynb-py-convert
Atom/Hydrogen or VSCode/Python allows creating a python files split into cells with `# %%` separators with the ability to run cells via backend Jupyter session and interactively show results back.
More examples: [Jupyter Python VSCode examples](https://github.com/DonJayamanne/pythonVSCode/wiki/Jupyter-Examples), [Atom/Hydrogen Getting Started](https://nteract.gitbooks.io/hydrogen/docs/Usage/GettingStarted.html).
[ipynb-py-convert](https://pypi.python.org/pypi/ipynb-py-convert) python module converts files: .ipynb to .py and .py to .ipynb.
**ipynb-py-convert** is a fork of the [vscode-ipynb-py-converter](https://github.com/nojvek/vscode-ipynb-py-converter).
## Install
```bash
conda install -c defaults -c conda-forge ipynb-py-convert
```
or
```bash
pip install ipynb-py-convert
```
## Troubleshooting
* If encoding problems on Windows try using `python>=3.7`, setting `set PYTHONUTF8=1` in Windows console and use `ipynb-py-convert` for UTF-8 files only. If using [Git-Bash on Windows](https://git-scm.com/download/win) setting:
```bash
export LANG=C.UTF-8
export PYTHONIOENCODING=utf-8
export PYTHONUTF8=1
```
should be enough. Also try setting default Bash settings to UTF-8: [Options] - [Text] - [Locale / Character set] - [C / UTF-8]. It might affect all Bash runs so there would be no need to setting encoding every time.
## Example
`ipynb-py-convert examples/plot.py examples/plot.ipynb`
or
`ipynb-py-convert examples/plot.ipynb examples/plot.py`
**VSCode**
![](https://github.com/kiwi0fruit/ipynb-py-convert/raw/master/examples/vscode.png)
Markdown cells are converted to python multiline strings `'''`. Code cells are left as is. `# %%` is used by vscode as the cell marker on which 'Run Cell' action is available.
**Jupyter ipynb notebook**
![](https://github.com/kiwi0fruit/ipynb-py-convert/raw/master/examples/jupyter.png)
Raw data
{
"_id": null,
"home_page": "https://github.com/kiwi0fruit/ipynb-py-convert",
"name": "ipynb-py-convert",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "vscode,jupyter,convert,ipynb,py,atom,hydrogen",
"author": "Noj Vek",
"author_email": "nojvek@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/43/90/37ff1b9f553583e60c327e1ea8cbfea469c38c9d8791ad1f7ee6d3482efa/ipynb-py-convert-0.4.6.tar.gz",
"platform": "",
"description": "# ipynb-py-convert\n\nAtom/Hydrogen or VSCode/Python allows creating a python files split into cells with `# %%` separators with the ability to run cells via backend Jupyter session and interactively show results back.\n\nMore examples: [Jupyter Python VSCode examples](https://github.com/DonJayamanne/pythonVSCode/wiki/Jupyter-Examples), [Atom/Hydrogen Getting Started](https://nteract.gitbooks.io/hydrogen/docs/Usage/GettingStarted.html).\n\n[ipynb-py-convert](https://pypi.python.org/pypi/ipynb-py-convert) python module converts files: .ipynb to .py and .py to .ipynb.\n\n**ipynb-py-convert** is a fork of the [vscode-ipynb-py-converter](https://github.com/nojvek/vscode-ipynb-py-converter).\n\n\n## Install\n\n```bash\nconda install -c defaults -c conda-forge ipynb-py-convert\n```\nor\n```bash\npip install ipynb-py-convert\n```\n\n\n## Troubleshooting\n\n* If encoding problems on Windows try using `python>=3.7`, setting `set PYTHONUTF8=1` in Windows console and use `ipynb-py-convert` for UTF-8 files only. If using [Git-Bash on Windows](https://git-scm.com/download/win) setting:\n\n```bash\nexport LANG=C.UTF-8\nexport PYTHONIOENCODING=utf-8\nexport PYTHONUTF8=1\n```\nshould be enough. Also try setting default Bash settings to UTF-8: [Options] - [Text] - [Locale / Character set] - [C / UTF-8]. It might affect all Bash runs so there would be no need to setting encoding every time. \n\n\n## Example\n\n`ipynb-py-convert examples/plot.py examples/plot.ipynb`\n\nor\n\n`ipynb-py-convert examples/plot.ipynb examples/plot.py`\n\n\n**VSCode**\n\n![](https://github.com/kiwi0fruit/ipynb-py-convert/raw/master/examples/vscode.png)\n\nMarkdown cells are converted to python multiline strings `'''`. Code cells are left as is. `# %%` is used by vscode as the cell marker on which 'Run Cell' action is available.\n\n\n**Jupyter ipynb notebook**\n\n![](https://github.com/kiwi0fruit/ipynb-py-convert/raw/master/examples/jupyter.png)",
"bugtrack_url": null,
"license": "MIT",
"summary": "Convert .py files runnable in VSCode/Python or Atom/Hydrogen to jupyter .ipynb notebooks and vice versa",
"version": "0.4.6",
"split_keywords": [
"vscode",
"jupyter",
"convert",
"ipynb",
"py",
"atom",
"hydrogen"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "439037ff1b9f553583e60c327e1ea8cbfea469c38c9d8791ad1f7ee6d3482efa",
"md5": "abe11460b9b1a894ad4e793e454522ec",
"sha256": "06c09644f85949939fa749a00fb7f398a0bfcad0e34320ca6666e0cb44b7ea74"
},
"downloads": -1,
"filename": "ipynb-py-convert-0.4.6.tar.gz",
"has_sig": false,
"md5_digest": "abe11460b9b1a894ad4e793e454522ec",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3903,
"upload_time": "2020-07-29T08:08:58",
"upload_time_iso_8601": "2020-07-29T08:08:58.066776Z",
"url": "https://files.pythonhosted.org/packages/43/90/37ff1b9f553583e60c327e1ea8cbfea469c38c9d8791ad1f7ee6d3482efa/ipynb-py-convert-0.4.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2020-07-29 08:08:58",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "kiwi0fruit",
"github_project": "ipynb-py-convert",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "ipynb-py-convert"
}