Skip to content

Commit 53892ae

Browse files
committed
adjust metadata loading to address use of API pkgs in Metadata.toml keys
1 parent 22ca37a commit 53892ae

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

src/metadata.jl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,18 @@ end
6161
# to define INFO_GIVEN_HANDLE
6262
function info_given_handle(metadata_file)
6363
metadata = LittleDict(TOML.parsefile(metadata_file))
64-
metadata_given_pkg = decode_dic(metadata)
64+
metadata_given_api_pkg = decode_dic(metadata)
6565

6666
# build info_given_handle dictionary:
6767
ret = Dict{Handle}{Any}()
68-
packages = keys(metadata_given_pkg)
69-
for pkg in packages
70-
info_given_name = metadata_given_pkg[pkg]
68+
packages = keys(metadata_given_api_pkg)
69+
for api_pkg in packages
70+
info_given_name = metadata_given_api_pkg[api_pkg]
7171
for name in keys(info_given_name)
72+
info = info_given_name[name]
73+
pkg = info[:package_name]
7274
handle = Handle(name, pkg)
73-
ret[handle] = info_given_name[name]
75+
ret[handle] = info
7476
end
7577
end
7678
return ret

test/registry.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,21 @@ using Suppressor
2020
close(stream)
2121
registry = dirname(filename) # we need to rename project file to ..../Project.toml
2222
mv(filename, joinpath(registry, "Project.toml"); force=true)
23+
rm(joinpath(registry, "Manifest.toml"); force=true)
2324

2425
# open a new Julia process in which to activate the registry project and attempt to
2526
# load all models:
2627
id = only(addprocs(1))
2728

2829
# define the programs to run in that process:
2930
# 1. To instantiate the registry environment:
31+
this_package = joinpath(@__DIR__, "..")
3032
program1 = quote
3133
using Pkg
3234
Pkg.activate($registry)
35+
Pkg.develop(path=$this_package) # MLJModels
3336
Pkg.instantiate()
37+
Pkg.status()
3438
using MLJModels
3539
!isempty(keys(Pkg.dependencies()))
3640
end
@@ -42,7 +46,9 @@ using Suppressor
4246
# remove `@suppress` to debug:
4347
@test @suppress remotecall_fetch(Main.eval, id, program1)
4448
@info "Attempting to load all MLJ Model Registry models into a Julia process. "
45-
@info "Be patient, this may take five minutes or so..."
49+
@info "Be patient, this may take a few minutes ..."
4650
@test @suppress remotecall_fetch(Main.eval, id, program2)
4751
rmprocs(id)
4852
end
53+
54+
true

0 commit comments

Comments
 (0)