Skip to content

Commit 5f3bf67

Browse files
authored
Move Statistics to an extension (#146)
* Move Statistics to an extension * bump version to v0.7.5
1 parent 6027f24 commit 5f3bf67

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

Project.toml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
11
name = "IntervalSets"
22
uuid = "8197267c-284f-5f27-9208-e0e47529a953"
3-
version = "0.7.4"
3+
version = "0.7.5"
44

55
[deps]
66
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
77
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
88
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
99

10+
[weakdeps]
11+
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
12+
13+
[extensions]
14+
IntervalSetsStatisticsExt = "Statistics"
15+
1016
[compat]
1117
julia = "1.6"
1218

1319
[extras]
1420
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
1521
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
22+
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
1623
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1724
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
1825

1926
[targets]
20-
test = ["Test", "Random", "OffsetArrays", "Unitful"]
27+
test = ["Test", "Random", "OffsetArrays", "Statistics", "Unitful"]

ext/IntervalSetsStatisticsExt.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module IntervalSetsStatisticsExt
2+
3+
using IntervalSets
4+
using Statistics
5+
6+
Statistics.mean(d::AbstractInterval) = IntervalSets.mean(d)
7+
8+
end

src/IntervalSets.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ using Base: @pure
44
import Base: eltype, convert, show, in, length, isempty, isequal, isapprox, issubset, ==, hash,
55
union, intersect, minimum, maximum, extrema, range, clamp, mod, float, , ,
66

7-
using Statistics
8-
import Statistics: mean
97
using Random
108

119
using Dates
@@ -283,4 +281,8 @@ end
283281
include("interval.jl")
284282
include("findall.jl")
285283

284+
if !isdefined(Base, :get_extension)
285+
include("../ext/IntervalSetsStatisticsExt.jl")
286+
end
287+
286288
end # module

0 commit comments

Comments
 (0)