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

MAINT: Fixing python 3.12 compatibility #2838

Merged
merged 6 commits into from
Sep 25, 2023
Merged

Conversation

bsipocz
Copy link
Member

@bsipocz bsipocz commented Sep 22, 2023

This will require astropy/pyvo#488

@pllim - the tarfile one feels a bit tricky, doing these workarounds basically accepts everything not just in the ESA modules but in general. Everything feels very hacky, would you hacking a bit around with the imports be worth it? E.g. importing tarfile as esatar, or similar? Or should I just add the default back at the end of the file?

@bsipocz bsipocz added this to the v0.4.7 milestone Sep 22, 2023
@@ -39,6 +39,12 @@
__all__ = ['Jwst', 'JwstClass']


# We do trust the ESA tar files, this is to avoid the new to Python 3.12 deprecation warning
# https://docs.python.org/3.12/library/tarfile.html#tarfile-extraction-filter
if hasattr(tarfile, "fully_trusted_filter"):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What exactly was the warning that you saw before this patch? I cannot find it in the logs. (Though it does looks like you finally have to drop astropy-helpers.)

Also, I am not sure about this. Can we always trust any TAR files that are given?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a new python 3.12 deprecation:

DeprecationWarning: Python 3.14 will, by default, filter extracted tar archives and reject files or modify their metadata. Use the filter argument to control this behavior.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, would the archive people be able to provide a way to inspect and decide if the TAR is trusted or not?

Anyway, I think this is okay for now but should probably have a follow-up issue to revisit.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, weird, but locally I was all in the clear, not sure why it worked.

Anyway, if that's the case, then I would separate the actual fixes from the CI and put in the fixes, as we're in fact python3.12 compatible, and installing an from a wheel works just well on py3.12 without the helpers

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I'll deal with the helpers after the 0.4.7 release, and when switching to a date based versioning scheme)

@codecov
Copy link

codecov bot commented Sep 25, 2023

Codecov Report

Merging #2838 (f4287da) into main (72510b4) will increase coverage by 0.00%.
The diff coverage is 95.23%.

@@           Coverage Diff           @@
##             main    #2838   +/-   ##
=======================================
  Coverage   66.48%   66.49%           
=======================================
  Files         235      235           
  Lines       18077    18081    +4     
=======================================
+ Hits        12019    12023    +4     
  Misses       6058     6058           
Files Coverage Δ
astroquery/esa/xmm_newton/core.py 64.77% <100.00%> (+0.21%) ⬆️
astroquery/gaia/core.py 71.83% <100.00%> (ø)
astroquery/ipac/ned/core.py 88.37% <100.00%> (ø)
astroquery/query.py 62.54% <100.00%> (ø)
astroquery/utils/tap/taputils.py 67.85% <100.00%> (ø)
astroquery/esa/jwst/core.py 80.78% <85.71%> (+0.08%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@bsipocz bsipocz merged commit 6eefe6d into astropy:main Sep 25, 2023
10 checks passed
@bsipocz bsipocz deleted the CI_add_py312 branch December 8, 2023 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants