#21833·scipy

SPEC 7 Transition Tracker

Author: mdhaberCreated Nov 8, 2024Updated Sep 28, 2026
Labelsmaintenance

Partial list of functions that use legacy seed or random_state behavior. Per SPEC 7, we're changing the keyword to rng.

Generated mostly by searching for check_random_state. Feel to add to this if I missed anything.

Boxes are checked when the transition_to_rng decorator has been applied. After two releases, we will enable warning messages, and in two more releases, we'll remove the decorator.

  • scipy.cluster

    • kmeans #21878
    • kmeans2 #21878
  • scipy.integrate

    • qmc_quad Doesn't actually accept PRNG directly. Just need to ensure that qmc.check_random_state deprecates use of RandomState.
  • scipy.interpolate

    • BarycentricInterpolator (gh-21812)
  • scipy.linalg

    • clarkson_woodruff_transform (gh-21880)
  • scipy.optimize

    • basinhopping (gh-21847)
    • differential_evolution (gh-21774)
    • dual_annealing (gh-21823)
    • check_grad (gh-21845)
    • quadratic_assignment (gh-21848)
  • scipy.sparse

    • random (gh-21888)
    • rand (gh-21888)
    • random_array (gh-21888)
    • linalg.svds (gh-21899)
  • scipy.spatial

    • Rotation.random (gh-21914)
    • scipy.spatial.distance.directed_hausdorff (gh-21913)
  • scipy.stats (no need to adjust old univariate or multivariate distributions)

    • BootstrapMethod (gh-21886)
    • PermutationMethod (gh-21886)
    • goodness_of_fit (gh-21881)
    • permutation_test (gh-21854, can remove dead code in _pairings_permutations_gen once only Generators are accepted)
    • bootstrap (gh-21854)
    • scipy.stats.sampling.NumericalInverseHermite
    • scipy.stats.sampling.NumericalInversePolynomial
    • scipy.stats.sampling.TransformedDensityRejection
    • scipy.stats.sampling.SimpleRatioUniforms
    • scipy.stats.sampling.RatioUniforms
    • scipy.stats.sampling.DiscreteAliasUrn
    • scipy.stats.sampling.DiscreteGuideTable
    • scipy.stats.sampling.FastGeneratorInversion (another oddball; doesn't follow any convention)
    • ttest_ind (gh-21921)
    • multiscale_graphcorr
  • scipy.stats (these need special care because the seed argument works differently than the rest of stats - probably can just add DeprecationWarning about RandomState in qmc.check_random_state)

    • dunnett (gh-21881)
    • scipy.stats.qmc (gh-21931)
      • Halton
      • LatinHypercube
      • MultinomialQMC
      • MultivariateNormalQMC
      • PoissonDisk
      • QMCEngine
      • Sobol
    • sobol_indices (gh-21881)

Checklist for PRs:

  • Applies the _transition_to_rng decorator
    • Passes correct old_name to decorator factory
    • Passes correct position_num to decorator factory
  • replaces old keyword in signature with rng
  • replaces documentation of old keyword with final documentation recommended by SPEC 7
  • replaces most uses of old keyword in tests / other functions with rng / Generator
  • notes remaining uses of old keyword (left to test backward compatibility during transition)
  • check that decorator has replaced documentation correctly