From 3f1abf7b76db57f9094761d0463092b10bba6a99 Mon Sep 17 00:00:00 2001 From: "Brett M. Morris" Date: Tue, 3 Dec 2024 11:15:13 -0500 Subject: [PATCH] Removing filter warning for mpl-scatter-density (#3327) * removing filter warning for mpl-scatter-density * replace deprecated pkg_resources call in linelists --- jdaviz/core/linelists.py | 8 +++----- pyproject.toml | 2 -- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/jdaviz/core/linelists.py b/jdaviz/core/linelists.py index 7a004343c8..3c43e11a3d 100644 --- a/jdaviz/core/linelists.py +++ b/jdaviz/core/linelists.py @@ -1,4 +1,4 @@ -import pkg_resources +from importlib import resources import json from astropy.table import QTable @@ -8,8 +8,7 @@ def get_linelist_metadata(): """Return metadata for line lists.""" - metadata_file = pkg_resources.resource_filename("jdaviz", - "data/linelists/linelist_metadata.json") + metadata_file = resources.files("jdaviz").joinpath("data/linelists/linelist_metadata.json") with open(metadata_file) as f: metadata = json.load(f) return metadata @@ -34,8 +33,7 @@ def load_preset_linelist(name): raise ValueError("Line name not in available set of line lists. " + "Valid list names are: {}".format(list(metadata.keys()))) fname_base = metadata[name]["filename_base"] - fname = pkg_resources.resource_filename("jdaviz", - "data/linelists/{}.csv".format(fname_base)) + fname = resources.files("jdaviz").joinpath("data/linelists/{}.csv".format(fname_base)) units = metadata[name]["units"] linetable = QTable.read(fname) diff --git a/pyproject.toml b/pyproject.toml index 83f8179694..98d2ccb61a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -138,8 +138,6 @@ filterwarnings = [ "ignore::DeprecationWarning:glue", "ignore::DeprecationWarning:asteval", "ignore:::specutils.spectra.spectrum1d", - # Remove the following line once https://github.com/astrofrog/mpl-scatter-density/issues/46 is addressed - "ignore:pkg_resources is deprecated as an API:DeprecationWarning:mpl_scatter_density", # Ignore numpy 2.0 warning, see https://github.com/astropy/astropy/pull/15495 # and https://github.com/scipy/scipy/pull/19275 "ignore:.*numpy\\.core.*:DeprecationWarning",