style: Apply Ruff rules to most notebooks#2690
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2690 +/- ##
=======================================
Coverage 98.27% 98.27%
=======================================
Files 65 65
Lines 4289 4289
Branches 461 461
=======================================
Hits 4215 4215
Misses 46 46
Partials 28 28
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
matthewfeickert
left a comment
There was a problem hiding this comment.
@kratsg These changes delete some of the output images that we had in the notebooks. If we had a system that built all of the notebooks and kept the images for the docs that would be okay, but we don't AFAIK.
fixed |
There was a problem hiding this comment.
In some of the notebooks there are changes which result in code getting commented out but not removed. For example, in docs/examples/notebooks/learn/TensorizingInterpolations.ipynb there is now the comment
# allset_all_histo_nom = histogramssets[:, :, 1]If this can be commented out we can remove it, yes? Is there any reason to keep this?
Also, a curiosity/question, but not a problem: I'm very happy to see the use of np.random.default_rng now, but is there a linting rule in Ruff that sets all seeds to 42?
np.random.default_rng(seed=42)That seems like a "not great" lint/formatting rule to have, as people can very reasonably want different seeds (that don't have to be tied to Hitchhiker's Guide to the Galaxy).
Also in docs/examples/notebooks/XML_ImportExport.ipynb we have the import pyhf there at the top even though we do everything through ipython magics at the command line to verify that people have things installed to be able to run the notebook. Can we keep that with a some sort of #noqa ignore?
I don't understand this comment. |
@kratsg sorry. What I mean is the diff of
or $ git diff upstream/main -- docs/examples/notebooks/XML_ImportExport.ipynb
diff --git a/docs/examples/notebooks/XML_ImportExport.ipynb b/docs/examples/notebooks/XML_ImportExport.ipynb
index d80cde21..9b3d942f 100644
--- a/docs/examples/notebooks/XML_ImportExport.ipynb
+++ b/docs/examples/notebooks/XML_ImportExport.ipynb
@@ -13,8 +13,7 @@
"metadata": {},
"outputs": [],
"source": [
- "# NB: python -m pip install pyhf[xmlio]\n",
- "import pyhf"
+ "# NB: python -m pip install pyhf[xmlio]"
]
},
{As Can/should we keep this? |
matthewfeickert
left a comment
There was a problem hiding this comment.
LGTM. Thanks a bunch @kratsg!

Pull Request Description
See #2689 for remaining outdated notebooks.
Checklist Before Requesting Reviewer
Before Merging
For the PR Assignees: