spedas / pyspedas

Python-based Space Physics Environment Data Analysis Software
https://pyspedas.readthedocs.io/
MIT License
143 stars 58 forks source link

Use filter argument when unpacking tar files, when supported #883

Closed jameswilburlewis closed 2 weeks ago

jameswilburlewis commented 2 weeks ago

We are getting deprecation messages in Python 3.12 when unpacking tar files (for example, when downloading Cluster data via CSA):

Starting analysis magnetic nulls tests at Wed Jun 12 03:16:09 UTC 2024
12-Jun-24 03:16:13: Downloading Cluster data, please wait....
12-Jun-24 03:16:40: Download complete.
12-Jun-24 03:16:40: /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/tarfile.py:2221: 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.
  warnings.warn(

The 'filter' feature was just introduced in Python 3.12. We need to support older Python versions for at least the next two years, so we should probably do a Python version test and use the filter argument when it's supported.

thepug432 commented 2 weeks ago

I submitted a pr that should fix this.