Skip to content

Commit fb9c1d1

Browse files
Make Julia v1.10 (LTS) min version (#432)
- Make Julia v1.10 (LTS) min version - Remove some code that was only necessary for older versions - Remove Compat.jl dependency as it is not needed anymore (we can always add it back) - Add tests for squash(::AbstractGraph) in order to not decrease code coverage
1 parent 58d6f63 commit fb9c1d1

File tree

10 files changed

+34
-36
lines changed

10 files changed

+34
-36
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
matrix:
1919
version:
2020
- '1'
21-
- '1.6'
21+
- '1.10'
2222
- 'pre'
2323
os:
2424
- ubuntu-latest

Project.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ version = "1.12.1"
44

55
[deps]
66
ArnoldiMethod = "ec485272-7323-5ecc-a04f-4719b315124d"
7-
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
87
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
98
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
109
Inflate = "d25df0c9-e2be-5dd7-82c8-3ad0b3e990b9"
@@ -18,15 +17,14 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
1817
[compat]
1918
Aqua = "0.6"
2019
ArnoldiMethod = "0.4"
21-
Compat = "3.40, 4"
2220
DataStructures = "0.17, 0.18"
2321
Documenter = "0.27"
2422
Inflate = "0.1.3"
2523
JuliaFormatter = "1"
2624
SimpleTraits = "0.9"
2725
StableRNGs = "1"
2826
Statistics = "1"
29-
julia = "1.6"
27+
julia = "1.10"
3028

3129
[extras]
3230
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"

src/Experimental/ShortestPaths/johnson.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11

22
# Currently used to support the ismutable function that is not available in Julia < v1.7
3-
using Compat
4-
53
"""
64
struct Johnson <: ShortestPathAlgorithm
75
@@ -34,7 +32,7 @@ function shortest_paths(
3432
shortest_paths(g, vertices(g), distmx, BellmanFord())
3533
)
3634

37-
@compat if !ismutable(distmx) && type_distmx != Graphs.DefaultDistance
35+
if !ismutable(distmx) && type_distmx != Graphs.DefaultDistance
3836
distmx = sparse(distmx) # Change reference, not value
3937
end
4038

@@ -58,7 +56,7 @@ function shortest_paths(
5856
dists[:, v] .+= wt_transform[v] # Vertical traversal preferred
5957
end
6058

61-
@compat if ismutable(distmx)
59+
if ismutable(distmx)
6260
for e in edges(g)
6361
distmx[src(e), dst(e)] += wt_transform[dst(e)] - wt_transform[src(e)]
6462
end

src/Graphs.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ using SimpleTraits
66
using ArnoldiMethod: LM, SR, LR, partialschur, partialeigen
77
using Statistics: mean
88

9-
# Currently used to support the ismutable function that is not available in Julia < v1.7
10-
using Compat
11-
129
using Inflate: InflateGzipStream
1310
using DataStructures:
1411
IntDisjointSets,

src/Parallel/shortestpaths/johnson.jl

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11

2-
# Currently used to support the ismutable function that is not available in Julia < v1.7
3-
using Compat
4-
52
function johnson_shortest_paths(
63
g::AbstractGraph{U}, distmx::AbstractMatrix{T}=weights(g)
74
) where {T<:Number} where {U<:Integer}
@@ -10,7 +7,7 @@ function johnson_shortest_paths(
107
# Change when parallel implementation of Bellman Ford available
118
wt_transform = bellman_ford_shortest_paths(g, vertices(g), distmx).dists
129

13-
@compat if !ismutable(distmx) && type_distmx != Graphs.DefaultDistance
10+
if !ismutable(distmx) && type_distmx != Graphs.DefaultDistance
1411
distmx = sparse(distmx) # Change reference, not value
1512
end
1613

@@ -30,7 +27,7 @@ function johnson_shortest_paths(
3027
dists[:, v] .+= wt_transform[v] # Vertical traversal preferred
3128
end
3229

33-
@compat if ismutable(distmx)
30+
if ismutable(distmx)
3431
for e in edges(g)
3532
distmx[src(e), dst(e)] += wt_transform[dst(e)] - wt_transform[src(e)]
3633
end

src/core.jl

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -429,14 +429,8 @@ can accommodate all vertices.
429429
May also return the original graph if the eltype does not change.
430430
"""
431431
function squash(g::AbstractGraph)
432-
433-
# TODO this version check can be removed when we increase the required Julia version
434432
deprecation_msg = "squash(::AbstractGraph) is deprecated in favor of methods that specialize on the graph type."
435-
if VERSION >= v"1.5.2"
436-
Base.depwarn(deprecation_msg, :squash; force=true)
437-
else
438-
Base.depwarn(deprecation_msg, :squash)
439-
end
433+
Base.depwarn(deprecation_msg, :squash; force=true)
440434

441435
gtype = is_directed(g) ? DiGraph : Graph
442436
validtypes = [UInt8, UInt16, UInt32, UInt64, Int64]

src/shortestpaths/johnson.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function johnson_shortest_paths(
3636
wt_transform =
3737
bellman_ford_shortest_paths(g, collect_if_not_vector(vertices(g)), distmx).dists
3838

39-
@compat if !ismutable(distmx) && type_distmx != Graphs.DefaultDistance
39+
if !ismutable(distmx) && type_distmx != Graphs.DefaultDistance
4040
distmx = sparse(distmx) # Change reference, not value
4141
end
4242

@@ -60,7 +60,7 @@ function johnson_shortest_paths(
6060
dists[:, v] .+= wt_transform[v] # Vertical traversal preferred
6161
end
6262

63-
@compat if ismutable(distmx)
63+
if ismutable(distmx)
6464
for e in edges(g)
6565
distmx[src(e), dst(e)] += wt_transform[dst(e)] - wt_transform[src(e)]
6666
end

test/core.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,21 @@
9696
@test @inferred(density(g)) == 0.4
9797
end
9898
end
99+
100+
@testset "squash" for (g_in, g_expected) in [
101+
(SimpleGraph{Int64}(), SimpleGraph{UInt8}()),
102+
(SimpleDiGraph{UInt8}(), SimpleDiGraph{UInt8}()),
103+
(path_graph(Int16(126)), path_graph(UInt8(126))),
104+
(path_digraph(Int16(127)), path_digraph(UInt8(127))),
105+
(path_graph(Int16(254)), path_graph(UInt8(254))),
106+
(path_digraph(Int16(255)), path_digraph(UInt16(255))),
107+
(path_graph(UInt16(255)), path_graph(UInt16(255))),
108+
(star_graph(Int16(32766)), star_graph(UInt16(32766))),
109+
(star_digraph(Int32(32767)), star_digraph(UInt16(32767))),
110+
(cycle_graph(Int128(123)), cycle_graph(UInt8(123))),
111+
]
112+
g_actual = squash(generic_graph(g_in))
113+
@test typeof(g_actual) === typeof(g_expected)
114+
@test g_actual == g_expected
115+
end
99116
end

test/runtests.jl

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ using Graphs.Test
99
using Test
1010
using SparseArrays
1111
using LinearAlgebra
12-
using Compat
1312
using DelimitedFiles
1413
using Base64
1514
using Random
@@ -153,15 +152,13 @@ tests = [
153152

154153
@testset verbose = true "Graphs" begin
155154
@testset "Code quality (JET.jl)" begin
156-
if VERSION >= v"1.9"
157-
@assert get_pkg_version("JET") >= v"0.8.4"
158-
JET.test_package(
159-
Graphs;
160-
target_defined_modules=true,
161-
ignore_missing_comparison=true,
162-
mode=:typo, # TODO: switch back to `:basic` once the union split caused by traits is fixed
163-
)
164-
end
155+
@assert get_pkg_version("JET") >= v"0.8.4"
156+
JET.test_package(
157+
Graphs;
158+
target_defined_modules=true,
159+
ignore_missing_comparison=true,
160+
mode=:typo, # TODO: switch back to `:basic` once the union split caused by traits is fixed
161+
)
165162
end
166163

167164
@testset "Code quality (Aqua.jl)" begin

test/utils.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
@test Graphs.rng_from_rng_or_seed(nothing, nothing) === Random.GLOBAL_RNG
3939
@test Graphs.rng_from_rng_or_seed(nothing, -10) === Random.GLOBAL_RNG
4040
@test Graphs.rng_from_rng_or_seed(nothing, 456) == Graphs.getRNG(456)
41-
@compat if ismutable(Random.GLOBAL_RNG)
41+
if ismutable(Random.GLOBAL_RNG)
4242
@test Graphs.rng_from_rng_or_seed(nothing, 456) !== Random.GLOBAL_RNG
4343
end
4444
rng = Random.MersenneTwister(789)

0 commit comments

Comments
 (0)