JuliaDynamics/Agents.jl

Not getting access to agents functions as expected

Open

#927 创建于 2022年9月7日

在 GitHub 查看
 (2 评论) (0 反应) (0 负责人)Julia (904 star) (146 fork)batch import
help wantedplotting

描述

I'm not sure if this is an issue of me not understanding how Requires.jl works; it not being implemented correctly in this repo; or something else, but I have a MWE where I would expect to get access to the agents/ functions from InteractiveDynamics, but for some reason they don't get loaded.

If I generate a new package "TestMod", activate the environment, and add only "InteractiveDynamics" and "Agents", I get a Project.toml that looks like this:

name = "TestMod"
uuid = "43a1a35d-8048-4c0f-b05e-6c9f886ced7d"
authors = ["me <me@myemail.com>"]
version = "0.1.0"

[deps]
Agents = "46ada45e-f475-11e8-01d0-f70cc89e6671"
InteractiveDynamics = "ec714cd0-5f51-11eb-0b6e-452e7367ff84"

Then if my TestMod.jl file is simply:

module TestMod;

using Agents
using InteractiveDynamics

@show(names(InteractiveDynamics, all=true))

import InteractiveDynamics.agent2string

end

And I run:

(@v1.8) pkg> activate .
julia> using TestMod

[ Info: Precompiling TestMod [43a1a35d-8048-4c0f-b05e-6c9f886ced7d]
names(InteractiveDynamics, all = true) = [Symbol("##meta#58"), Symbol("##record_interaction#1"), Symbol("##record_interaction#4"), Symbol("#10#19"), Symbol("#11#20"), Symbol("#12#21"), Symbol("#13#22"), Symbol("#14#23"), Symbol("#15#24"), Symbol("#16#25"), Symbol("#17#26"), Symbol("#2#3"), Symbol("#5#6"), Symbol("#7#8"), Symbol("#9#18"), Symbol("#__init__"), Symbol("#colors_from_map"), Symbol("#darken_color"), Symbol("#eval"), Symbol("#get_value"), Symbol("#has_key"), Symbol("#include"), Symbol("#lighten_color"), Symbol("#pushupdate!"), Symbol("#randomcolor"), Symbol("#record_interaction"), Symbol("#record_interaction##kw"), Symbol("#record_interaction#1"), Symbol("#record_interaction#4"), Symbol("#rotate2D"), Symbol("#scale"), Symbol("#set_value!"), Symbol("#subscript"), Symbol("#superscript"), Symbol("#to_alpha"), Symbol("#translate"), :COLORSCHEME, :CYCLIC_COLORS, :CyclicContainer, :DEFAULT_BG, :InteractiveDynamics, :JULIADYNAMICS_BLACK, :JULIADYNAMICS_CMAP, :JULIADYNAMICS_CMAP_DIVERGING, :JULIADYNAMICS_COLORS, :MARKER, :Point2f, :Polygon, :__init__, :colors_from_map, :darken_color, :eval, :get_value, :has_key, :include, :lighten_color, :pushupdate!, :randomcolor, :record_interaction, :rotate2D, :scale, :set_value!, :subscript, :superscript, :to_alpha, :translate]
WARNING: could not import InteractiveDynamics.agent2string into TestMod

I would expect to get access to all the functions within the src/agents/ files, but we can see that I don't get access to any of them.

Is this expected behavior? How can I get access to these functions from inside my "TestMod.jl" module?

Thanks

贡献者指南