Closed GraemeWatt closed 7 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 89.58%. Comparing base (
3ed9148
) to head (d51570d
). Report is 12 commits behind head on main.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@clelange @alexander-held : I made a crude but simple attempt in this PR to address #99 by only importing ROOT functions in the hepdata_lib
functions where they are actually needed. This means that import hepdata_lib
now works without a ROOT installation as does the basic functionality (e.g. demonstrated in the Getting_started.ipynb notebook).
This is very nice to see, thanks for taking care of this!
Hi @GraemeWatt -- thanks for this! I'm wondering, however, if for hepdata_lib/root_utils.py
(and probably also hepdata_lib/c_file_reader.py
) it's not OK to actually keep the top-level ROOT import in a try
-catch
statement and rather print out a warning if the ROOT import failed.
My main issue with these changes is that while they move some of the ROOT import failures to later and therefore import hepdata_lib
will not fail immediately, we currently don't have visibility how this would fail. It would be nice to actually have tests without a ROOT installation and then label in the docs which features work without a ROOT installation.
What do you think?
@clelange : Yes, I agree that keeping the top-level ROOT import and adding a try
/except
condition is a better (and simpler) solution than my first attempt at only importing ROOT functions in the hepdata_lib
functions where they are actually needed. I've added a new commit on top of the upgrade-pylint
branch and force-pushed to the change-root-import
branch, so you should merge PR #260 before this one. I've added an explanation at the end of the README.md
file. I don't see an easy way to modify the CI to work without a ROOT installation, but I tested locally (in a Python 3.11 virtual environment with an incompatible ROOT built with Python 3.12) that the code behaves as expected. Feel free to expand the tests run by the CI if you think it is important and you can work out how to do it.
Feel free to expand the tests run by the CI if you think it is important and you can work out how to do it.
I think we can just run some of the tests without installing ROOT, i.e. a separate set of tests. However, we can do that in a later PR.
There's a conflict for hepdata_lib/c_file_reader.py
. Could you please check if you can fix it? You could also rebase on top of the current main
branch now that #260 is merged, whichever is easier for you.
@clelange : I used a Pytest custom marker to add a marker needs_root
to the tests that require a ROOT installation. I then introduced an additional element to the CI matrix without a ROOT installation root-version = ""
and ran the tests using pytest -m 'not needs_root'
. I also resolved the conflict with the main
branch.
reading_scikithep_histograms.ipynb
.pytest -m 'not needs_root'
.📚 Documentation preview 📚: https://hepdata-lib--259.org.readthedocs.build/en/259/