@@ -44,12 +44,12 @@ function metadata_pkg(
44
44
package_license= license,
45
45
)
46
46
ex = quote
47
- MLJModelInterface. package_name (:: Type{<:$T} ) = $ package_name
48
- MLJModelInterface. package_uuid (:: Type{<:$T} ) = $ package_uuid
49
- MLJModelInterface. package_url (:: Type{<:$T} ) = $ package_url
50
- MLJModelInterface. is_pure_julia (:: Type{<:$T} ) = $ is_pure_julia
51
- MLJModelInterface. package_license (:: Type{<:$T} ) = $ package_license
52
- MLJModelInterface. is_wrapper (:: Type{<:$T} ) = $ is_wrapper
47
+ $ MLJModelInterface. package_name (:: Type{<:$T} ) = $ package_name
48
+ $ MLJModelInterface. package_uuid (:: Type{<:$T} ) = $ package_uuid
49
+ $ MLJModelInterface. package_url (:: Type{<:$T} ) = $ package_url
50
+ $ MLJModelInterface. is_pure_julia (:: Type{<:$T} ) = $ is_pure_julia
51
+ $ MLJModelInterface. package_license (:: Type{<:$T} ) = $ package_license
52
+ $ MLJModelInterface. is_wrapper (:: Type{<:$T} ) = $ is_wrapper
53
53
end
54
54
parentmodule (T). eval (ex)
55
55
end
59
59
function _extend! (program:: Expr , trait:: Symbol , value, T)
60
60
if value != = nothing
61
61
push! (program. args, quote
62
- MLJModelInterface.$ trait (:: Type{<:$T} ) = $ value
62
+ $ MLJModelInterface.$ trait (:: Type{<:$T} ) = $ value
63
63
end )
64
64
return nothing
65
65
end
66
66
end
67
67
68
+ const DEPWARN_DOCSTRING =
69
+ " `metadata_model` should not be called with the keyword argument " *
70
+ " `descr` or `docstring`. Implementers of the MLJ model interface " *
71
+ " should instead create an MLJ-compliant docstring in the usual way. " *
72
+ " See https://alan-turing-institute.github.io/MLJ.jl/dev/adding_models_for_general_use/#Document-strings for details. "
73
+
68
74
"""
69
- metadata_model(`T` ; args...)
75
+ metadata_model(T ; args...)
70
76
71
77
Helper function to write the metadata for a model `T`.
72
78
@@ -78,6 +84,7 @@ Helper function to write the metadata for a model `T`.
78
84
* `supports_weights=false`: whether the model supports sample weights
79
85
* `supports_class_weights=false`: whether the model supports class weights
80
86
* `load_path="unknown"`: where the model is (usually `PackageName.ModelName`)
87
+ * `human_name=nothing`: human name of the model
81
88
82
89
## Example
83
90
@@ -110,6 +117,7 @@ function metadata_model(
110
117
load_path:: Union{Nothing,String} = path,
111
118
human_name:: Union{Nothing,String} = nothing
112
119
)
120
+ docstring === nothing || Base. depwarn (DEPWARN_DOCSTRING, :metadata_model )
113
121
114
122
program = quote end
115
123
0 commit comments