diff --git a/example/25-MetadataTools.jl b/example/25-MetadataTools.jl new file mode 100644 index 00000000..48f7b22d --- /dev/null +++ b/example/25-MetadataTools.jl @@ -0,0 +1,21 @@ +using MetadataTools, Query, DataFrames + +pkg = values(get_all_pkg()) + +# This query creates a list of packages on which at least one other +# package depends, and orders that list by the number of packages that +# depend on a given package. + +q = @from i in pkg begin + @where length(i.versions)>0 + @let j = last(i.versions) + @from k in j.requires + @group k by String(k.package) into g + @where g.key!="julia" + @let num_deps = length(g) + @orderby descending(num_deps) + @select {Name=g.key, Num_Deps=num_deps} + @collect DataFrame +end + +println(q) diff --git a/test/REQUIRE b/test/REQUIRE index 831c673a..cad0ca65 100644 --- a/test/REQUIRE +++ b/test/REQUIRE @@ -9,3 +9,4 @@ JSON Feather NullableArrays IndexedTables +MetadataTools diff --git a/test/runtests.jl b/test/runtests.jl index bbfafc2b..b26f88df 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -615,7 +615,8 @@ end "../example/21-nulls.jl", "../example/22-datastreams-sink.jl", "../example/23-dict-sink.jl", - "../example/24-DataTable.jl"] + "../example/24-DataTable.jl", + "../example/25-MetadataTools.jl"] color = Base.have_color ? "--color=yes" : "--color=no" compilecache = "--compilecache=" * (Bool(Base.JLOptions().use_compilecache) ? "yes" : "no")