This is what my code looks like when I push it to github via my command line. Although I’m just glad it pushed at all, I would like it to be in a format easier to read. Is there any efficient way to do this or is github just incompatible with Jupyter Lab?
I tried to run a command I found online:
conda create -y -n patagonia python=3.8 conda activate patagonia conda install -y -c conda-forge pylint black jupyterlab jupyterlab_code_formatter
but I wasn’t sure exactly where to run it nor what it actually does.
It seems like you are trying to set up a Conda environment and install some tools for code formatting in Jupyter Lab. The commands you provided are intended to be run in your terminal or command prompt, not within a Jupyter Notebook or Jupyter Lab cell.
Here’s a breakdown of what those commands do:
conda create -y -n patagonia python=3.8
-y
-n patagonia
python=3.8: Specifies the Python version for the environment.
python=3.8
Activate the ‘patagonia’ Conda environment:
conda activate patagonia
This command activates the specified Conda environment.
conda install -y -c conda-forge pylint black jupyterlab jupyterlab_code_formatter
-c conda-forge
pylint black jupyterlab jupyterlab_code_formatter
Now, for the readability of Jupyter Notebooks or Jupyter Lab, you can use tools like black and jupyterlab_code_formatter to automatically format your code cells.
black
jupyterlab_code_formatter
After you have set up your environment and installed the necessary tools, you can use the following commands to format your code in Jupyter Lab:
jupyter nbextension enable --py widgetsnbextension jupyter labextension install @jupyter-widgets/jupyterlab-manager jupyter labextension install @ryantam626/jupyterlab_code_formatter
After running these commands, you should be able to use the “Code Formatter” option in the Jupyter Lab interface to format your code cells. Additionally, make sure to select the ‘patagonia’ environment when running your Jupyter Lab.
Remember that you should run these commands in your terminal or command prompt, not within a Jupyter Notebook or Jupyter Lab cell.