Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "LogDensityProblems"
uuid = "6fdf6af0-433a-55f7-b3ed-c6c6e0b8df7c"
authors = ["Tamas K. Papp <[email protected]>"]
version = "2.1.2"
version = "2.2.0"

[deps]
ArgCheck = "dce04be8-c92d-5529-be00-80e4d2c0e197"
Expand Down
15 changes: 15 additions & 0 deletions src/LogDensityProblems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@ using ArgCheck: @argcheck
using DocStringExtensions: SIGNATURES, TYPEDEF
using Random: AbstractRNG, default_rng

# https://github.com/JuliaLang/julia/pull/50105
@static if VERSION >= v"1.11.0-DEV.469"
Copy link
Owner

Choose a reason for hiding this comment

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

Why not just use Compat.@compat public? I am fine with the dependency.

Copy link
Collaborator Author

@devmotion devmotion Oct 13, 2025

Choose a reason for hiding this comment

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

To avoid the dependency. IMO it's a bit annoying if simple interface packages such as LogDensityProblems introduce more dependencies than necessary. Moreover, the Compat macro doesn't do anything more than what's done in the PR explicitly: It returns an empty expression on Julia < 1.11 and an Expr(:public, ...) on Julia >= 1.11: https://github.com/JuliaLang/Compat.jl/blob/f2a3730a5dc49098dfd394ba2cbf4b202467f435/src/compatmacro.jl#L43-L50 It seemed a bit much - in particular for an interface package - to load a whole package just to get access to this trivial macro.

Copy link
Owner

Choose a reason for hiding this comment

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

Makes sense, thanks! Merging.

eval(
Expr(
:public,
:capabilities,
:LogDensityOrder,
:dimension,
:logdensity,
:logdensity_and_gradient,
:logdensity_gradient_and_hessian,
)
)
end

####
#### interface for problems
####
Expand Down
15 changes: 15 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,18 @@ end
@test 50 ≤ length(failures) ≤ 100
@test all(x -> all(x .< 0), failures)
end

####
#### public API
####

@testset "public API" begin
if isdefined(Base, :ispublic)
@test Base.ispublic(LogDensityProblems, :capabilities)
@test Base.ispublic(LogDensityProblems, :LogDensityOrder)
@test Base.ispublic(LogDensityProblems, :dimension)
@test Base.ispublic(LogDensityProblems, :logdensity)
@test Base.ispublic(LogDensityProblems, :logdensity_and_gradient)
@test Base.ispublic(LogDensityProblems, :logdensity_gradient_and_hessian)
end
end
Loading