You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I"m trying to use this package with the Phenopacket protobuf files (see https://github.com/phenopackets/phenopacket-schema). However, when I cannot work out how to load the generated code to avoid hitting an UndefVarError.
ERROR: LoadError: UndefVarError: ga4gh not defined
Stacktrace:
[1] getproperty(x::Module, f::Symbol)
@ Base ./Base.jl:31
[2] top-level scope
@ ~/.julia/dev/Phenopackets/dev/out/org/phenopackets/schema/v2/core/interpretation_pb.jl:20
[3] include(mod::Module, _path::String)
@ Base ./Base.jl:419
[4] include(x::String)
@ Main.org.phenopackets.schema.v2.core ~/.julia/dev/Phenopackets/dev/out/org/phenopackets/schema/v2/core/core.jl:1
[5] top-level scope
@ ~/.julia/dev/Phenopackets/dev/out/org/phenopackets/schema/v2/core/core.jl:7
[6] include(mod::Module, _path::String)
@ Base ./Base.jl:419
[7] include(x::String)
@ Main.org.phenopackets.schema.v2 ~/.julia/dev/Phenopackets/dev/out/org/phenopackets/schema/v2/v2.jl:1
[8] top-level scope
@ ~/.julia/dev/Phenopackets/dev/out/org/phenopackets/schema/v2/v2.jl:5
[9] include(mod::Module, _path::String)
@ Base ./Base.jl:419
[10] include(x::String)
@ Main.org.phenopackets.schema ~/.julia/dev/Phenopackets/dev/out/org/phenopackets/schema/schema.jl:1
[11] top-level scope
@ ~/.julia/dev/Phenopackets/dev/out/org/phenopackets/schema/schema.jl:3
[12] include(mod::Module, _path::String)
@ Base ./Base.jl:419
[13] include(x::String)
@ Main.org.phenopackets ~/.julia/dev/Phenopackets/dev/out/org/phenopackets/phenopackets.jl:1
[14] top-level scope
@ ~/.julia/dev/Phenopackets/dev/out/org/phenopackets/phenopackets.jl:3
[15] include(mod::Module, _path::String)
@ Base ./Base.jl:419
[16] include(x::String)
@ Main.org ~/.julia/dev/Phenopackets/dev/out/org/org.jl:1
[17] top-level scope
@ ~/.julia/dev/Phenopackets/dev/out/org/org.jl:5
[18] include(fname::String)
@ Base.MainInclude ./client.jl:476
[19] top-level scope
@ ~/.julia/dev/Phenopackets/dev/build.jl:20
[20] include(fname::String)
@ Base.MainInclude ./client.jl:476
[21] top-level scope
@ REPL[1]:1
in expression starting at /home/tec/.julia/dev/Phenopackets/dev/out/org/phenopackets/schema/v2/core/interpretation_pb.jl:20
in expression starting at /home/tec/.julia/dev/Phenopackets/dev/out/org/phenopackets/schema/v2/core/core.jl:1
in expression starting at /home/tec/.julia/dev/Phenopackets/dev/out/org/phenopackets/schema/v2/v2.jl:1
in expression starting at /home/tec/.julia/dev/Phenopackets/dev/out/org/phenopackets/schema/schema.jl:1
in expression starting at /home/tec/.julia/dev/Phenopackets/dev/out/org/phenopackets/phenopackets.jl:1
in expression starting at /home/tec/.julia/dev/Phenopackets/dev/out/org/org.jl:1
in expression starting at /home/tec/.julia/dev/Phenopackets/dev/build.jl:20
If I try to include("out/org/ga4gh/ga4gh.jl") I get
WARNING: could not import Main.google into v1
ERROR: LoadError: UndefVarError: google not defined
Stacktrace:
[1] top-level scope
@ ~/.julia/dev/Phenopackets/dev/out/org/ga4gh/vrsatile/v1/vrsatile_pb.jl:13
I can solve this issue by running include("out/google/google.jl"), but then if I try include("out/org/ga4gh/ga4gh.jl") again I now see
WARNING: replacing module ga4gh.
ERROR: LoadError: UndefVarError: ga4gh not defined
Stacktrace:
[1] getproperty(x::Module, f::Symbol)
@ Base ./Base.jl:31
[2] top-level scope
@ ~/.julia/dev/Phenopackets/dev/out/org/ga4gh/vrsatile/v1/vrsatile_pb.jl:229
The text was updated successfully, but these errors were encountered:
Thanks @tecosaur for reporting this issue. You are correct that the root cause is us not being able to handle mutual dependencies in submodules -- org.phenopackets requires types from org.ga4gh and vice versa (in this case, the julia module ga4gh doesn't yet exist as we include phenopackets first).
A quick workaround would be to use the older version of this library which (add [email protected]) which uses dicts to represent fields of protobuf messages and thus doesn't require all proto types to be statically known when defining the julia struct.
As you noticed including sub-packages directly rarely works -- currently, whenever a reference is made to a definition in a different package or submodule, we always reach out to the top of the current package to grab the package name and then we use it to fully qualify the reference. So, as-is, we only support including the top level file which is in your case "out/org/org.jl".
I'm afraid that to get that the current version of ProtoBuf.jl won't work without a change to the original proto files or a manual rewrite of the generated code. Sorry about that!
I'm going to keep this issue open to discuss different approaches to handle mutual dependencies.
Hello, I"m trying to use this package with the Phenopacket protobuf files (see https://github.com/phenopackets/phenopacket-schema). However, when I cannot work out how to load the generated code to avoid hitting an
UndefVarError
.The setup
Artifacts.toml
build.jl
Generated files
out.tar.gz
Output
If I try to
include("out/org/ga4gh/ga4gh.jl")
I getI can solve this issue by running
include("out/google/google.jl")
, but then if I tryinclude("out/org/ga4gh/ga4gh.jl")
again I now seeThe text was updated successfully, but these errors were encountered: