Skip to content

Commit

Permalink
Merge pull request #531 from SciML/ap/partial_functions
Browse files Browse the repository at this point in the history
Proper numargs for PartialFunctions
  • Loading branch information
ChrisRackauckas authored Oct 26, 2023
2 parents b1d71ed + 4bf8ab4 commit 37042e1
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SciMLBase"
uuid = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
authors = ["Chris Rackauckas <[email protected]> and contributors"]
version = "2.4.3"
version = "2.5.0"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Expand Down Expand Up @@ -33,12 +33,14 @@ TruncatedStacktraces = "781d530d-4396-4725-bb49-402e4bee1e77"
ZygoteRules = "700de1a5-db45-46bc-99cf-38207098b444"

[weakdeps]
PartialFunctions = "570af359-4316-4cb7-8c74-252c00c2016b"
PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0"
PythonCall = "6099a3de-0909-46bc-b1f4-468b9a2dfc0d"
RCall = "6f49c342-dc21-5d91-9882-a32aef131414"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

[extensions]
SciMLBasePartialFunctionsExt = "PartialFunctions"
SciMLBasePyCallExt = "PyCall"
SciMLBasePythonCallExt = "PythonCall"
SciMLBaseRCallExt = "RCall"
Expand All @@ -55,6 +57,7 @@ EnumX = "1"
FillArrays = "1.6"
FunctionWrappersWrappers = "0.1.3"
IteratorInterfaceExtensions = "^0.1, ^1"
PartialFunctions = "1.1"
PrecompileTools = "1"
Preferences = "1.3"
RCall = "0.13.18"
Expand All @@ -76,6 +79,7 @@ Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
DelayDiffEq = "bcd4f6db-9728-5f36-b5f7-82caef46ccdb"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
PartialFunctions = "570af359-4316-4cb7-8c74-252c00c2016b"
PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0"
PythonCall = "6099a3de-0909-46bc-b1f4-468b9a2dfc0d"
RCall = "6f49c342-dc21-5d91-9882-a32aef131414"
Expand All @@ -86,4 +90,4 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

[targets]
test = ["Pkg", "PyCall", "PythonCall", "SafeTestsets", "Test", "StaticArrays", "StochasticDiffEq", "Aqua", "Zygote"]
test = ["Pkg", "PyCall", "PythonCall", "SafeTestsets", "Test", "StaticArrays", "StochasticDiffEq", "Aqua", "Zygote", "PartialFunctions"]
7 changes: 7 additions & 0 deletions ext/SciMLBasePartialFunctionsExt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module SciMLBasePartialFunctionsExt

using PartialFunctions, SciMLBase

SciMLBase.numargs(::PartialFunctions.PartialFunction{KL, UL}) where {KL, UL} = [length(UL)]

end
15 changes: 15 additions & 0 deletions test/downstream/partial_functions.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using SciMLBase, PartialFunctions, Test

partial_add = @$ +(_, _)
partial_add2 = @$ +(_, 2)
partial_add3 = @$ +(3, _)

@test only(SciMLBase.numargs(partial_add)) == 2
@test only(SciMLBase.numargs(partial_add2)) == 1
@test only(SciMLBase.numargs(partial_add3)) == 1

f1(args...) = args

@test only(SciMLBase.numargs(@$ f1(_, _, _))) == 3
@test only(SciMLBase.numargs(@$ f1(_, _, _, _, 4))) == 4
@test only(SciMLBase.numargs(@$ f1(_, _, _, _, _))) == 5
3 changes: 3 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ end
@time @safetestset "Autodiff Remake" begin
include("downstream/remake_autodiff.jl")
end
@time @safetestset "Partial Functions" begin
include("downstream/partial_functions.jl")
end
end

if !is_APPVEYOR && GROUP == "Python"
Expand Down

2 comments on commit 37042e1

@avik-pal
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/94194

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 v2.5.0 -m "<description of version>" 37042e1c19f2d35e4bb036ae32f8dc6fed597229
git push origin v2.5.0

Please sign in to comment.