DP0: how to get a fresh copy of tutorial notebooks?

Hi, apologies if that’s documented somewhere already, I couldn’t find info about it…
But how would I obtain a fresh copy of the most current tutorial NBs, while logged into the JupyterLab NB aspect of RSP? Can I git clone from somewhere, is there another mechanism?
(To clarify: say I’ve edited myself into some broken state in one of the NBs in /notebooks/tutorial-notebooks/, how do I start from scratch?)

Thank you!

Hi! I got to a similar situation and solved it this way:

  1. go to terminal inside jupyter lab and go to notebooks directory
  2. git restore 01_Intro_to_DP0_Notebooks.ipynb; git pull

I hope it helps =)

1 Like

Hi @JuliaGschwend Thank you! Before I try: this will overwrite my changes I guess? (I better make some copies…)

Thanks @rnikutta for the question and @JuliaGschwend’s suggestion of using the git restore command should fix things for you.

I encountered a similar error recently and documented the solutions in this GitHub Issue thread, which might also be of use to you here. It includes instructions for how to keep your changes.

1 Like

Thank you @MelissaGraham !
In the meantime I also figured out how to just get the latest and freshest copy into a new directory:

mkdir my
cd my
git clone https://github.com/rubin-dp0/tutorial-notebooks

And now I can navigate in JupyterLab to my/tutorial-notebooks/ and work there. (I’m sure this is documented somewhere, just that I couldn’t find it…)

Thank you!

That will get you a new, additional copy of the tutorial-notebooks, yes, but git clone into a new directory is not the preferred method in this case. The tutorials in your my/tutorial-notebooks/ directory will not automatically be updated when we release new versions or new notebooks to the prod branch, like the ones in your /notebooks/tutorial-notebooks/ directory will be. Since the DP0-era RSP is in active development, such updates might happen on weeks-to-months timescales.

This git clone option is fine so long as those details are understood, though! And probably you’ll still want to do the git restore method in your /notebooks/tutorial-notebooks/to undo the broken states of those notebooks.

Absolutely, will restore, and will always consider the version in /notebooks/tutorial-notebooks/ as the truth state. Thank you.

1 Like

In order to ensure the contents of your notebooks/tutorial-notebooks/ directory are up to date, you have several options, but they all start with checking that you have your git user and email set up.

You can check this with :

egrep 'email|name' ~/.gitconfig

If you get nothing back the email and name have not been set. Set them with:

git config --global user.email yourEmail@yourdomain
git config --global user.name GItUsername

This will allow you to use the options below.

Option 1. Fully log out, stop the server, and log back in again. This will automatically refresh the contents of your notebooks/tutorial-notebooks/ directory. To fully stop your server, use the control panel at https://data.lsst.cloud/nb/hub/home. Click the red button that says “Stop My Server”.

Option 2. However, you will not have the most up-to-date versions of all the notebooks if you have made and saved changes to any of the notebooks (recall that Jupyter auto-saves changes, so just executing the notebook will save a changed version). In other words, git will not overwrite your changes to these notebooks. Use git status from a terminal command line in the notebooks/tutorial-notebooks/ directory to see if any files have changed.

If you are in this situation, use the documented the solutions in this GitHub Issue thread to use git restore.

Option 3. As a last resort, to completely blow away any changes you’ve made and get a fresh set of all of the tutorial notebooks, use the following in the notebooks/tutorial-notebooks/ directory:

git reset --hard origin/main
git pull

Using git is the preferred way to make your tutorial-notebooks/ directory completely refreshed with the most up-to-date versions of the tutorials. However, a final last resort is to delete the entire tutorial-notebooks directory, log out and stop the server (see instructions above), and then log back in again.

1 Like

Hi Melissa.
I downloaded an independent copy of the latest w_2021_25 set of DP0 notebooks. I reached a halt-point at the step where I started to access the TAP service…
THENNN, I recalled that I likely will not be able to run these, due to not having a delegate statuses account. That’s fine, just wanted to confirm with you. Am I correct?
Hope you have the kind of Friday you think you deserve. :grinning:
Fred, Dallas, Tx

1 Like

Hi Fred,
Yes I can confirm, that is correct.
Happy Friday to you too! :tada: