Skip to content

DEP: extend deprecation of private namespaces also to fortran-generated modules #19907

@h-vetinari

Description

@h-vetinari

While looking at cleaning up the deprecations following #18279 (fitting into the larger picture of #14360), I noticed that scipy.interpolate.dfitpack is not deprecated, which seems like an oversight - in particular because it contains several functions that scipy.interpolate itself contains:

>>> import scipy.interpolate
>>> import scipy.interpolate.dfitpack
>>> dfitpack_funcs = set(scipy.interpolate.dfitpack.__dir__())
>>> interpolate_funcs = set(scipy.interpolate.__dir__())
>>> sorted([x for x in dfitpack_funcs & interpolate_funcs if not x.startswith("_")])
['spalde', 'splder', 'splev', 'splint', 'sproot']

But that's only half the story, because we have a new interface to fitpack...

# New interface to fitpack library:
from ._fitpack2 import *

and funnily enough that file wraps both dfitpack directly, as well as a separate wrapper layer, also around dfitpack (sidenote: looks like this tweet I saw today turned out to be prophetic 😅 ). Suffice it to say, despite different names, a lot (all?) of the remaining functions in dfitpack then also get accounted for.

It's looks likely that this was overlooked because there's no actual python code, we just directly generate the functions from fortran:

dfitpack_module = custom_target('dfitpack_module',
output: ['dfitpack-f2pywrappers.f', 'dfitpackmodule.c'],
input: 'src/fitpack.pyf',
command: [py3, generate_f2pymod, '@INPUT@', '-o', '@OUTDIR@']
)
# TODO: Add flags for 64 bit ints
dfitpack = py3.extension_module('dfitpack',
dfitpack_module,
c_args: [Wno_unused_variable],
link_args: version_link_args,
dependencies: [lapack, fortranobject_dep],
link_with: [fitpack_lib],
override_options: ['b_lto=false'],
install: true,
link_language: 'fortran',
subdir: 'scipy/interpolate'
)

Not sure how many other such should-be-private-but-has-no-underscore fortran libraries are about.

CC @rgommers @tupui @j-bowhay @ev-br

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions