Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

weakdeps InteractiveUtils #1746

Merged
merged 3 commits into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ TimeZones = "f269a46b-ccf7-5d73-abea-4c690281aa53"
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"

[weakdeps]
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59"

[extensions]
InteractiveUtilsExt = "InteractiveUtils"
InterpolationsExt = "Interpolations"

[compat]
Expand Down Expand Up @@ -95,7 +97,6 @@ julia = "1.8"
DifferentialEquations = "0c46a032-eb83-5123-abaf-570d42b7fbaa"
Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c"
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
LineSearches = "d3d80556-e9d4-5f37-9878-2ab0fcc64255"
Manopt = "0fc0a36d-df90-57f3-8f93-d78a9fc72bb5"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
module InteractiveUtilsExt

@info "IncrementalInference.jl is loading tools related to InteractiveUtils.jl."
@info "IncrementalInference.jl is loading extension related to InteractiveUtils.jl."

# this requires InteractiveUtils
using InteractiveUtils
using DocStringExtensions
using IncrementalInference: InferenceVariable, AbstractPrior, AbstractRelativeMinimize, AbstractManifoldMinimize
# using IncrementalInference: getCurrentWorkspaceFactors, getCurrentWorkspaceVariables, listTypeTree
import IncrementalInference: getCurrentWorkspaceFactors, getCurrentWorkspaceVariables, listTypeTree

export getCurrentWorkspaceFactors, getCurrentWorkspaceVariables
export listTypeTree
Expand All @@ -25,7 +30,7 @@ end
Return all variables currently registered in the workspace.
"""
function getCurrentWorkspaceVariables()
return InteractiveUtils.subtypes(IIF.InferenceVariable)
return InteractiveUtils.subtypes(InferenceVariable)
end

function _listTypeTree(mytype, printlevel::Int)
Expand All @@ -50,3 +55,5 @@ function listTypeTree(T)
println(T)
return _listTypeTree(T, 0)
end

end #module
4 changes: 4 additions & 0 deletions ext/WeakDepsPrototypes.jl
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@

# InteractiveUtils.jl
function getCurrentWorkspaceFactors end
function getCurrentWorkspaceVariables end
function listTypeTree end
4 changes: 4 additions & 0 deletions src/ExportAPI.jl
Original file line number Diff line number Diff line change
Expand Up @@ -358,4 +358,8 @@ export makeSolverData!

export MetaPrior

# weakdeps on InteractiveUtils.jl
export getCurrentWorkspaceFactors, getCurrentWorkspaceVariables
export listTypeTree

#
7 changes: 4 additions & 3 deletions src/IncrementalInference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,16 @@ include("services/SolverAPI.jl")
# Symbolic tree analysis files.
include("services/AnalysisTools.jl")

include("../ext/WeakDepsPrototypes.jl")

# deprecation legacy support
include("Deprecated.jl")

exportimg(pl) = error("Please do `using Gadfly` to allow image export.")
function __init__()
@require InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240" include(
"services/RequireInteractiveUtils.jl",
)
# @require InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240" include(
# "services/RequireInteractiveUtils.jl",
# )
@require Gadfly = "c91e804a-d5a3-530f-b6f0-dfbca275c004" include(
"services/EmbeddedPlottingUtils.jl",
)
Expand Down
14 changes: 14 additions & 0 deletions test/basicGraphsOperations.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using IncrementalInference
using InteractiveUtils
using Test

##
Expand Down Expand Up @@ -42,6 +43,19 @@ varT = _TestManiKde
manikde!(varT, pts)


##
end


@testset "test InteractiveUtilsExt" begin
##

IIF.listTypeTree(AbstractManifoldMinimize)

IIF.getCurrentWorkspaceFactors()
IIF.getCurrentWorkspaceVariables()


##
end

Expand Down