Skip to content

Commit ee9906d

Browse files
authored
Declare StatsAPI functionality as public on Julia >= 1.11 (#35)
* Declare StatsAPI functionality as `public` on Julia >= 1.11 * Bump version to 1.8.0
1 parent d2bedd3 commit ee9906d

File tree

3 files changed

+86
-2
lines changed

3 files changed

+86
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "StatsAPI"
22
uuid = "82ae8749-77ed-4fe6-ae5f-f523153014b0"
33
authors = ["Milan Bouchet-Valat <[email protected]"]
4-
version = "1.7.1"
4+
version = "1.8.0"
55

66
[deps]
77
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"

src/StatsAPI.jl

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,71 @@
11
module StatsAPI
22

3-
using LinearAlgebra
3+
using LinearAlgebra: Symmetric, diag
4+
5+
# https://github.com/JuliaLang/julia/pull/50105
6+
@static if VERSION >= v"1.11.0-DEV.469"
7+
# statisticalmodel.jl
8+
eval(Expr(
9+
:public,
10+
:StatisticalModel,
11+
:coef,
12+
:coefnames,
13+
:coeftable,
14+
:confint,
15+
:deviance,
16+
:islinear,
17+
:nulldeviance,
18+
:loglikelihood,
19+
:nullloglikelihood,
20+
:score,
21+
:nobs,
22+
:dof,
23+
:mss,
24+
:rss,
25+
:informationmatrix,
26+
:stderror,
27+
:vcov,
28+
:weights,
29+
:isfitted,
30+
:fit,
31+
:fit!,
32+
:aic,
33+
:aicc,
34+
:bic,
35+
:r2,
36+
:r²,
37+
:adjr2,
38+
:adjr²,
39+
))
40+
41+
# regressionmodel.jl
42+
eval(Expr(
43+
:public,
44+
:RegressionModel,
45+
:fitted,
46+
:response,
47+
:responsename,
48+
:meanresponse,
49+
:modelmatrix,
50+
:crossmodelmatrix,
51+
:leverage,
52+
:cooksdistance,
53+
:residuals,
54+
:predict,
55+
:predict!,
56+
:dof_residual,
57+
:reconstruct,
58+
:reconstruct!,
59+
:offset,
60+
:linearpredictor,
61+
:linearpredictor!,
62+
:vif,
63+
:gvif,
64+
))
65+
66+
# StatsAPI.jl
67+
eval(Expr(:public, :params, :params!, :pairwise, :pairwise!, :HypothesisTest, :pvalue))
68+
end
469

570
include("statisticalmodel.jl")
671
include("regressionmodel.jl")

test/runtests.jl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,25 @@ using Test, StatsAPI
22

33
@testset "StatsAPI" begin
44

5+
# Check that all names in StatsAPI are public
6+
if isdefined(Base, :ispublic)
7+
names_statsapi = names(StatsAPI; all = true)
8+
filter!(names_statsapi) do name
9+
if name == :eval || name == :include
10+
# Ignore `eval` and `include` (available in every `module`)
11+
return false
12+
elseif startswith(string(name), "#")
13+
# Ignore names of the form `#xyz...`
14+
return false
15+
else
16+
return true
17+
end
18+
end
19+
@testset "public: $(name)" for name in names_statsapi
20+
@test Base.ispublic(StatsAPI, name)
21+
end
22+
end
23+
524
include("regressionmodel.jl")
625
include("statisticalmodel.jl")
726

0 commit comments

Comments
 (0)