sbromberger / LightGraphs.jl

An optimized graphs package for the Julia programming language
Other
670 stars 185 forks source link

Both Plots and LightGraphs export "grid" #1574

Closed tfburns closed 2 years ago

tfburns commented 3 years ago

Version 1.5.2 (2020-09-23)

julia> using LightGraphs

julia> using Plots

julia> grid WARNING: both Plots and LightGraphs export "grid"; uses of it in module Main must be qualified ERROR: UndefVarError: grid not defined

With Julia version 1.5.2 (2020-09-23) and the following packages.

(v1.5) pkg> status LightGraphs Plots Status G:\G_Documents\.julia\environments\v1.5\Project.toml [093fc24a] LightGraphs v1.3.5 [91a5bcdd] Plots v1.9.1

Not sure how to get around this safely. Sidenote: I think most of the graph constructors could probably get more descriptive function names, e.g. construct_grid_graph.

sbromberger commented 3 years ago

This is a common(ish) situation for lots of packages. The message is just a warning, and it only appears when you call the unqualified function.

To use LG's grid function, just qualify it: LightGraphs.grid(...). To use Plots, use Plots.grid(...).

We will not be renaming functions to accommodate other packages.

juliohm commented 3 years ago

Yes, and I can say that Plots.jl is the offender here. It currently exports a bunch of names it shouldn't such as Point, grid, ...

I would suggest opening an issue in Plots.jl asking them to stop reexporting these names. A plotting package should only export the minimum amount of names for the plotting commands, not the types used internally to implement these commands.

tfburns commented 2 years ago

Gotcha, thanks for the practical advice (using LightGraphs.grid and Plots.grid) and information that this is common situation for lots of packages (and particularly over-exportation in Plots.jl).