Metadata-Version: 2.4
Name: j-to-py
Version: 0.1.0
Summary: Convert Jupyter notebooks to Python scripts while preserving IPython magics.
Author: Prankapple
License: MIT
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: ipython
Requires-Dist: ipython; extra == "ipython"
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Dynamic: license-file

# j-to-py

`j-to-py` converts Jupyter Notebook files (`.ipynb`) into Python scripts (`.py`) while preserving IPython shell commands (`!`) and magics (`%`, `%%`).

## Installation

```bash
pip install j-to-py
```


To run generated scripts containing IPython syntax:

```bash
pip install python
```

## Command-line usage

```bash
j-to-py notebook.ipynb
j-to-py notebook.ipynb -o scripts/notebook.py
j-to-py --help
```

You can also run it as a module:

```bash
python -m j_to_py notebook.ipynb
```

## Python API

```python
from j_to_py import convert_notebook

convert_notebook("notebook.ipynb")
convert_notebook("notebook.ipynb", "scripts/notebook.py")
```

## Running converted notebooks

If the notebook uses `!` shell commands or `%`/`%%` magics, run the generated script with IPython:

```bash
ipython notebook.py
```

## License

MIT License. See [LICENSE](LICENSE).
