Skip to content

Commit

Permalink
Update to use package extensions (#5)
Browse files Browse the repository at this point in the history
* update to use package extensions

* try to make aqua happy

* add ext to extras
  • Loading branch information
MasonProtter authored Jan 27, 2024
1 parent a1654c7 commit cf8b4b2
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
10 changes: 9 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Folds"
uuid = "41a02a25-b8f0-4f67-bc48-60067656b558"
authors = ["Takafumi Arakaki <[email protected]> and contributors"]
version = "0.2.9"
version = "0.2.10"

[deps]
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
Expand All @@ -26,16 +26,24 @@ DefineSingletons = "0.1.1"
ExternalDocstrings = "0.1"
InitialValues = "0.2.10, 0.3"
MicroCollections = "0.1, 0.2"
OnlineStatsBase = "1"
Referenceables = "0.1.2"
Requires = "0.5, 1.0"
ThreadedScans = "0.1"
Transducers = "0.4.35"
julia = "1.6"

[extensions]
FoldsOnlineStatsBaseExt = "OnlineStatsBase"

[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
OnlineStatsBase = "925886fa-5bf2-5e8e-b522-a9147a512338"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Aqua", "Documenter", "Test"]

[weakdeps]
OnlineStatsBase = "925886fa-5bf2-5e8e-b522-a9147a512338"
14 changes: 14 additions & 0 deletions src/interop/onlinestats.jl → ext/FoldsOnlineStatsBaseExt.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
module FoldsOnlineStatsBaseExt

@static if isdefined(Base, :get_extension)
using Folds: Folds
using Folds.Implementations: FoldsInit, SequentialEx, Executor, reducingfunction
using OnlineStatsBase: OnlineStatsBase
else
using ..Folds: Folds
using ..Folds.Implementations: FoldsInit, SequentialEx, Executor, reducingfunction
using ..OnlineStatsBase: OnlineStatsBase
end

function Folds.reduce(stat::OnlineStatsBase.OnlineStat, itr, ex::Executor; init = FoldsInit)
ex isa SequentialEx || validate_reduce_ostat(stat)
return Folds.reduce(reducingfunction(stat), itr, ex; init = init)
Expand All @@ -14,3 +26,5 @@ function validate_reduce_ostat(stat)
end
return stat
end

end
6 changes: 4 additions & 2 deletions src/Folds.jl
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,10 @@ include("collect.jl")
include("misc.jl")

function __init__()
@require OnlineStatsBase="925886fa-5bf2-5e8e-b522-a9147a512338" begin
include("interop/onlinestats.jl")
@static if !isdefined(Base, :get_extension)
@require OnlineStatsBase="925886fa-5bf2-5e8e-b522-a9147a512338" begin
include("../ext/FoldsOnlineStatsBaseExt.jl")
end
end
end

Expand Down

2 comments on commit cf8b4b2

@MasonProtter
Copy link
Member Author

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/99677

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

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.2.10 -m "<description of version>" cf8b4b23f76d29617fd84fd92a690d9893523cbe
git push origin v0.2.10

Please sign in to comment.