Skip to content

Recent deprecation warnings #5179

@titodalcanton

Description

@titodalcanton

The "unittest" action currently raises this bunch of deprecation warnings:

.tox/py-unittest/lib/python3.12/site-packages/astropy/cosmology/core.py:30
  /home/runner/work/pycbc/pycbc/.tox/py-unittest/lib/python3.12/site-packages/astropy/cosmology/core.py:30: DeprecationWarning: The module `astropy.cosmology.core` is deprecated since v7.1 and will be removed in a future version. Import from `astropy.cosmology` instead.
    warnings.warn(

.tox/py-unittest/lib/python3.12/site-packages/pykerr/qnm.py:2
  /home/runner/work/pycbc/pycbc/.tox/py-unittest/lib/python3.12/site-packages/pykerr/qnm.py:2: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
    import pkg_resources

.tox/py-unittest/lib/python3.12/site-packages/pkg_resources/__init__.py:3146
  /home/runner/work/pycbc/pycbc/.tox/py-unittest/lib/python3.12/site-packages/pkg_resources/__init__.py:3146: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('ligo')`.
  Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
    declare_namespace(pkg)

.tox/py-unittest/lib/python3.12/site-packages/pkg_resources/__init__.py:3146
  /home/runner/work/pycbc/pycbc/.tox/py-unittest/lib/python3.12/site-packages/pkg_resources/__init__.py:3146: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('sphinxcontrib')`.
  Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
    declare_namespace(pkg)

test/test_bhspec.py::TestBHSpecModel::test_file_io
  /home/runner/work/pycbc/pycbc/.tox/py-unittest/lib/python3.12/site-packages/astropy/cosmology/_src/funcs/optimize.py:138: AstropyUserWarning: fval is not bracketed by func(zmin)=3.630907107506232e-13 Mpc3 and func(zmax)=164042102234.23068 Mpc3. This means either there is no solution, or that there is more than one solution between zmin and zmax satisfying fval = func(z).
    warnings.warn(

test/test_bhspec.py::TestBHSpecModel::test_file_io
  /home/runner/work/pycbc/pycbc/.tox/py-unittest/lib/python3.12/site-packages/astropy/cosmology/_src/funcs/optimize.py:138: AstropyUserWarning: fval is not bracketed by func(zmin)=3.630907107506232e-13 Mpc3 and func(zmax)=3763143105730.4414 Mpc3. This means either there is no solution, or that there is more than one solution between zmin and zmax satisfying fval = func(z).
    warnings.warn(

test/test_coordinates_space.py: 18600 warnings
test/test_transforms.py: 12 warnings
  /home/runner/work/pycbc/pycbc/.tox/py-unittest/lib/python3.12/site-packages/pycbc/coordinates/space.py:182: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)
    latitude = np.float64(np.arcsin(-k[2]))

test/test_coordinates_space.py: 18600 warnings
test/test_transforms.py: 12 warnings
  /home/runner/work/pycbc/pycbc/.tox/py-unittest/lib/python3.12/site-packages/pycbc/coordinates/space.py:183: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)
    longitude = np.float64(np.arctan2(-k[1]/np.cos(latitude),

test/test_infmodel.py::TestModels::test_brute_pol_phase_marg
test/test_infmodel.py::TestWaveformErrors::test_brute_pol_phase_marg
test/test_infmodel.py::TestWaveformErrors::test_brute_pol_phase_marg
test/test_infmodel.py::TestMarginalizedPolModels::test_gaussian_models
  /home/runner/work/pycbc/pycbc/.tox/py-unittest/lib/python3.12/site-packages/pycbc/inference/models/tools.py:136: DeprecationWarning: use marginalize_vector_samples rather than 'polarization_samples'
    warnings.warn("use marginalize_vector_samples rather "

test/test_infmodel.py::TestModels::test_brute_pol_phase_marg
test/test_infmodel.py::TestWaveformErrors::test_brute_pol_phase_marg
test/test_infmodel.py::TestWaveformErrors::test_brute_pol_phase_marg
  /home/runner/work/pycbc/pycbc/.tox/py-unittest/lib/python3.12/multiprocessing/popen_fork.py:66: DeprecationWarning: This process (pid=8844) is multi-threaded, use of fork() may lead to deadlocks in the child.
    self.pid = os.fork()

test/test_infmodel.py::TestModels::test_relative_phase_marg
test/test_infmodel.py::TestModels::test_relative_phase_marg
test/test_infmodel.py::TestModels::test_relative_phase_marg
test/test_infmodel.py::TestWaveformErrors::test_relative_phase_marg
test/test_infmodel.py::TestWaveformErrors::test_relative_phase_marg
test/test_infmodel.py::TestWaveformErrors::test_relative_phase_marg
  /home/runner/work/pycbc/pycbc/.tox/py-unittest/lib/python3.12/site-packages/pycbc/inference/models/relbin.py:226: DeprecationWarning: __array__ implementation doesn't accept a copy keyword, so passing copy=False failed. __array__ must implement 'dtype' and 'copy' keyword arguments. To learn more, see the migration guide https://numpy.org/devdocs/numpy_2_0_migration_guide.html#adapting-to-changes-in-the-copy-keyword
    self.f[ifo] = numpy.array(d0.sample_frequencies)

test/test_injection.py: 60 warnings
  /home/runner/work/pycbc/pycbc/.tox/py-unittest/lib/python3.12/site-packages/pycbc/waveform/waveform.py:372: DeprecationWarning: numpy.core is deprecated and has been renamed to numpy._core. The numpy._core namespace contains private NumPy internals and its use is discouraged, as NumPy internals can change without warning in any release. In practice, most real-world usage of numpy.core is to access functionality in the public NumPy API. If that is the case, use the public NumPy API. If not, you are using NumPy internals. If you would still like to access an internal attribute, use numpy._core.records.
    if isinstance(obj, numpy.core.records.record):

test/test_io_gracedb.py: 40 warnings
  /home/runner/work/pycbc/pycbc/.tox/py-unittest/lib/python3.12/site-packages/pycbc/io/ligolw.py:267: DeprecationWarning: `row_stack` alias is deprecated. Use `np.vstack` directly.
    data = numpy.row_stack((

test/test_io_gracedb.py: 40 warnings
  /home/runner/work/pycbc/pycbc/.tox/py-unittest/lib/python3.12/site-packages/pycbc/io/ligolw.py:273: DeprecationWarning: `row_stack` alias is deprecated. Use `np.vstack` directly.
    data = numpy.row_stack((

test/test_io_gracedb.py: 20 warnings
  /home/runner/work/pycbc/pycbc/.tox/py-unittest/lib/python3.12/site-packages/igwn_auth_utils/requests.py:56: DeprecationWarning: Support for identity-based X.509 credentials for LIGO.ORG is being dropped.
  Calls to this utility will stop working on/around 20 May 2025.
  
  For details on this change please see
  
  https://computing.docs.ligo.org/guide/compsoft/roadmap/LVK/x509_retirement/
  
  If you have questions about this message, or its implications, please
  consider opening an IGWN Computing Help Desk ticket:
  
  https://git.ligo.org/computing/helpdesk/-/issues/new
    return func(*args, **kwargs)

test/test_live_coinc_compare.py::TestPyCBCLiveCoinc::test_coincer_runs
  /home/runner/work/pycbc/pycbc/.tox/py-unittest/lib/python3.12/site-packages/pycbc/events/coinc.py:824: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)
    return coincbuffer_numgreater(self.buffer, self.index, value)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

Not all of them come from PyCBC code, but some look fairly trivial to address.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions