From 0a903f36614561d1fc8a48b04b644dd4e7c427cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20M=C3=BCller-Widmann?= Date: Mon, 29 Sep 2025 15:30:11 +0200 Subject: [PATCH 1/2] Declare StatsAPI functionality as `public` on Julia >= 1.11 --- src/StatsAPI.jl | 67 +++++++++++++++++++++++++++++++++++++++++++++++- test/runtests.jl | 19 ++++++++++++++ 2 files changed, 85 insertions(+), 1 deletion(-) diff --git a/src/StatsAPI.jl b/src/StatsAPI.jl index eef2fdf..886eb2b 100644 --- a/src/StatsAPI.jl +++ b/src/StatsAPI.jl @@ -1,6 +1,71 @@ module StatsAPI -using LinearAlgebra +using LinearAlgebra: Symmetric, diag + +# https://github.com/JuliaLang/julia/pull/50105 +@static if VERSION >= v"1.11.0-DEV.469" + # statisticalmodel.jl + eval(Expr( + :public, + :StatisticalModel, + :coef, + :coefnames, + :coeftable, + :confint, + :deviance, + :islinear, + :nulldeviance, + :loglikelihood, + :nullloglikelihood, + :score, + :nobs, + :dof, + :mss, + :rss, + :informationmatrix, + :stderror, + :vcov, + :weights, + :isfitted, + :fit, + :fit!, + :aic, + :aicc, + :bic, + :r2, + :r², + :adjr2, + :adjr², + )) + + # regressionmodel.jl + eval(Expr( + :public, + :RegressionModel, + :fitted, + :response, + :responsename, + :meanresponse, + :modelmatrix, + :crossmodelmatrix, + :leverage, + :cooksdistance, + :residuals, + :predict, + :predict!, + :dof_residual, + :reconstruct, + :reconstruct!, + :offset, + :linearpredictor, + :linearpredictor!, + :vif, + :gvif, + )) + + # StatsAPI.jl + eval(Expr(:public, :params, :params!, :pairwise, :pairwise!, :HypothesisTest, :pvalue)) +end include("statisticalmodel.jl") include("regressionmodel.jl") diff --git a/test/runtests.jl b/test/runtests.jl index 30d9dc0..8a9a413 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -2,6 +2,25 @@ using Test, StatsAPI @testset "StatsAPI" begin +# Check that all names in StatsAPI are public +if isdefined(Base, :ispublic) + names_statsapi = names(StatsAPI; all = true) + filter!(names_statsapi) do name + if name == :eval || name == :include + # Ignore `eval` and `include` (available in every `module`) + return false + elseif startswith(string(name), "#") + # Ignore names of the form `#xyz...` + return false + else + return true + end + end + @testset "public: $(name)" for name in names_statsapi + @test Base.ispublic(StatsAPI, name) + end +end + include("regressionmodel.jl") include("statisticalmodel.jl") From 116366657a07364cecaadbbd09444d05a5756cd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20M=C3=BCller-Widmann?= Date: Mon, 29 Sep 2025 15:32:40 +0200 Subject: [PATCH 2/2] Bump version to 1.8.0 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 09480dc..ddf6f31 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "StatsAPI" uuid = "82ae8749-77ed-4fe6-ae5f-f523153014b0" authors = ["Milan Bouchet-Valat