Skip to content

lewislovelock/jupyter2pyClean

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 

Repository files navigation

README for jupyter_converter.sh πŸ“βœ¨


Jupyter Converter Script πŸš€

This shell script quickly converts Jupyter Notebook files (.ipynb) into clean Python scripts (.py), removing unnecessary cell notations (# In[ ]:) and formatting the code with black for a polished final product. Perfect for integrating your Jupyter work into your development projects!

Prerequisites πŸ“‹

Before using the script, ensure you have the following installed:

pip install jupyter nbconvert black

How to Use πŸ› οΈ

  1. Download the Script:

    • Save jupyter_converter.sh to your local machine.
  2. Make It Executable:

    • In your terminal, navigate to the script's directory and run:

      chmod +x jupyter_converter.sh
  3. Convert Your Notebook:

    • Run the script with your .ipynb file:

      ./jupyter_converter.sh <notebook.ipynb>
    • Example:

      ./jupyter_converter.sh example_notebook.ipynb
  4. Get Your Cleaned Script:

    • The output will be a formatted Python file named example_notebook.py.

Example πŸ§‘β€πŸ’»

Convert data_analysis.ipynb to a Python script:

./jupyter_converter.sh data_analysis.ipynb

You'll find data_analysis.py in the same directory, ready to use.

Troubleshooting πŸ› οΈ

  • command not found: Make sure jupyter and black are installed and in your PATH.
  • No such file or directory: Ensure the notebook file exists where you specified.

Feedback and Contributions ❀️

Have feedback or want to contribute? Feel free to open an issue or submit a pull request!


Happy coding! πŸš€πŸ˜Š

About

A shell script convert a jupyter notebook to a python script without cell notation.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages