Skip to content

Commit

Permalink
Move Statistics to an extension (#146)
Browse files Browse the repository at this point in the history
* Move Statistics to an extension

* bump version to v0.7.5
  • Loading branch information
jishnub authored Jul 27, 2023
1 parent 6027f24 commit 5f3bf67
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
11 changes: 9 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
name = "IntervalSets"
uuid = "8197267c-284f-5f27-9208-e0e47529a953"
version = "0.7.4"
version = "0.7.5"

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

[weakdeps]
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

[extensions]
IntervalSetsStatisticsExt = "Statistics"

[compat]
julia = "1.6"

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

[targets]
test = ["Test", "Random", "OffsetArrays", "Unitful"]
test = ["Test", "Random", "OffsetArrays", "Statistics", "Unitful"]
8 changes: 8 additions & 0 deletions ext/IntervalSetsStatisticsExt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module IntervalSetsStatisticsExt

using IntervalSets
using Statistics

Statistics.mean(d::AbstractInterval) = IntervalSets.mean(d)

end
6 changes: 4 additions & 2 deletions src/IntervalSets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ using Base: @pure
import Base: eltype, convert, show, in, length, isempty, isequal, isapprox, issubset, ==, hash,
union, intersect, minimum, maximum, extrema, range, clamp, mod, float, , ,

using Statistics
import Statistics: mean
using Random

using Dates
Expand Down Expand Up @@ -283,4 +281,8 @@ end
include("interval.jl")
include("findall.jl")

if !isdefined(Base, :get_extension)
include("../ext/IntervalSetsStatisticsExt.jl")
end

end # module

2 comments on commit 5f3bf67

@dlfivefifty
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/88448

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.7.5 -m "<description of version>" 5f3bf6790c08f8df5e91a56740d049be0c16437e
git push origin v0.7.5

Please sign in to comment.