-
Notifications
You must be signed in to change notification settings - Fork 85
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
feat: Use Python 3.12+ tarfile data extraction filter #2455
Conversation
* In Python 3.12 extraction filters are added and in will become default in Python 3.14. To start using them for when Python 3.12 support is added, and to guard against a Python 3.14 DeprecatinoWarning, use the data extraction filter for extracting tarfiles in pyhf.contrib.utils.download. - c.f. https://docs.python.org/3.12/library/tarfile.html#extraction-filters
# TODO: Simplify after pyhf is Python 3.12+ only | ||
# c.f. https://docs.python.org/3.12/library/tarfile.html#extraction-filters | ||
if hasattr(tarfile, "data_filter"): | ||
archive.extractall(output_directory, filter="data") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't ever get run in the current tests and so Codecov is going to complain, but is passes on the testing Python 3.12 branch that I have and so will get covered in the future.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2455 +/- ##
==========================================
- Coverage 98.28% 98.23% -0.05%
==========================================
Files 69 69
Lines 4539 4541 +2
Branches 803 804 +1
==========================================
Hits 4461 4461
- Misses 45 46 +1
- Partials 33 34 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
I'm going to approve and merge this myself. As always, PRs approved by a single core dev can be reverted as needed by the rest of the dev team. |
@meeseeksdev backport to release/v0.7.x |
* Backport PR #2455 * In Python 3.12 extraction filters are added and will become default in Python 3.14. To start using them for when Python 3.12 support is added, and to guard against a Python 3.14 DeprecationWarning, use the data extraction filter for extracting tarfiles in pyhf.contrib.utils.download. - c.f. https://docs.python.org/3.12/library/tarfile.html#extraction-filters Co-authored-by: Matthew Feickert <matthew.feickert@cern.ch>
Description
Resolves #2454
In Python 3.12 extraction filters are added and will become default in Python 3.14. To start using them for when Python 3.12 support is added, and to guard against a Python 3.14 DeprecationWarning, use the data extraction filter for extracting tarfiles in
pyhf.contrib.utils.download
.Checklist Before Requesting Reviewer
Before Merging
For the PR Assignees: