Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kiwi0fruit/ipynb-py-convert
Convert .py files runnable in VSCode or Atom/Hydrogen to Jupyter .ipynb notebooks and vice versa
https://github.com/kiwi0fruit/ipynb-py-convert
atom-editor converter ipynb jupyter vscode
Last synced: about 2 months ago
JSON representation
Convert .py files runnable in VSCode or Atom/Hydrogen to Jupyter .ipynb notebooks and vice versa
- Host: GitHub
- URL: https://github.com/kiwi0fruit/ipynb-py-convert
- Owner: kiwi0fruit
- License: mit
- Fork: true (nojvek/vscode-ipynb-py-converter)
- Created: 2019-01-23T07:54:04.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-04-06T17:43:49.000Z (over 2 years ago)
- Last Synced: 2024-09-24T21:33:54.650Z (about 2 months ago)
- Topics: atom-editor, converter, ipynb, jupyter, vscode
- Language: Python
- Homepage:
- Size: 435 KB
- Stars: 45
- Watchers: 4
- Forks: 16
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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)