Skip to content

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

Notifications You must be signed in to change notification settings

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