Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notebook divergence, update header and footer #402

Merged
merged 14 commits into from
Aug 4, 2022
Merged

Notebook divergence, update header and footer #402

merged 14 commits into from
Aug 4, 2022

Conversation

reshamas
Copy link
Contributor

@reshamas reshamas commented Jul 22, 2022

References

Helpful links

Notes for the Reviewer

  • I was not sure who the original author was.
  • I added one tag "hierarchical". I was not sure what other tags to add.

#DataUmbrellaPyMCSprint

cc: @symeneses

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@cluhmann
Copy link
Member

Looks like black modified some line wraps which caused the notebook to diverge from the jupytext. I think you can either run precommit locally or modify the notebook by hand (so that black doesn't see anything to "fix") and resave. The offending line is in the pre-commit check:

"ax=az.plot_trace({\"log(tau)\": short_trace.get_values(varname=\"tau_log__\", combine=False)}, legend=True)\n"

black wants this?

"ax = az.plot_trace(\n",
"    {\"log(tau)\": short_trace.get_values(varname=\"tau_log__\", combine=False)}, legend=True\n",
")\n",

@OriolAbril
Copy link
Member

The main issue is that the notebook needs to be executed sequentially and from start to end (you can do it with the restart and run all button for example). Otherwise pre-commit will (or should) continue to fail in the "check execution order step". Notebooks are not executed so we need the outputs to be included in the ipynb file or they won't appear on the website (I wrote a bit more extended explanation on ipynb+myst duplication in #403 (comment)).

@cluhmann
Copy link
Member

Good call. I saw that too, but wasn't sure what to make of it. @reshamas, my standard practice is to restart the jupyter kernel and rerun all cells once I am reasonably sure that my edits to a notebook are complete. That way everything is fresh and clean (until have to make more edits and then I have to rerun the entire thing again).

@reshamas
Copy link
Contributor Author

reshamas commented Aug 2, 2022

@OriolAbril
I am wondering if I should delete the myst file and recreate it.

@OriolAbril
Copy link
Member

OriolAbril commented Aug 2, 2022

Try and see if it works, it often helps. pre-commit is a bit tricky because it only runs on staged changes, so if you have unstaged changes in the repo they are ignored and it can generate more unstaged changes, worst case scenario even overwirte unstaged changes.

@symeneses
Copy link
Contributor

@reshamas It's better to delete it and execute in this order:

  1. Stage the notebook
  2. Run pre-commit, this will create the .myst file
  3. Stage the .myst file
    $. Run pre-commit and tests should now pass

@reshamas
Copy link
Contributor Author

reshamas commented Aug 2, 2022

@reshamas It's better to delete it and execute in this order:

  1. Stage the notebook
  2. Run pre-commit, this will create the .myst file
  3. Stage the .myst file
    $. Run pre-commit and tests should now pass

@symeneses I ran pre-commit and it didn't create the myst file. Not sure why. ???

@OriolAbril OriolAbril merged commit 76fae3f into pymc-devs:main Aug 4, 2022
@reshamas
Copy link
Contributor Author

reshamas commented Aug 4, 2022

Thanks for all of your help @OriolAbril !

@symeneses
It turns out I was running pre-commit on the WRONG file!!! Lesson learned. Thanks for the tip.

kuvychko pushed a commit to kuvychko/pymc-examples that referenced this pull request Oct 20, 2022
* notebook: divergences; update notebook formatting

* notebook divergence: updates,figure metadata

* Divergence nb: run notebook

* make code across one line

* make code one line to fix myst errors from precommit

* rm space around = sign

* nb divergence: fix myst error with spacing

* make Authorship section consistent betw notebook and myst

* remove myst file

* divergence notebook, after running pre-commit

* run myst for divergence nb

* added RS authorship to end

* rerun myst on divergence nb

* divergence nb: rerun myst
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants