Skip to content

Commit

Permalink
Add deprecation messages
Browse files Browse the repository at this point in the history
  • Loading branch information
sunxd3 committed Dec 16, 2023
1 parent dc1877d commit ce61726
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Turing.jl
Expand Up @@ -54,6 +54,8 @@ using .Variational
include("optimisation/Optimisation.jl")
using .Optimisation

include("deprecated.jl") # to be removed in the next minor version release

###########
# Exports #
###########
Expand Down Expand Up @@ -129,7 +131,11 @@ export @model, # modelling
get_parameter_bounds,
optim_objective,
optim_function,
optim_problem
optim_problem,

setbackend, # deprecated
setchunksize,
setadsafe

if !isdefined(Base, :get_extension)
using Requires
Expand Down
19 changes: 19 additions & 0 deletions src/deprecated.jl
@@ -0,0 +1,19 @@
function setbackend(::Union{Symbol, Val})
Base.depwarn("`ADBACKEND` and `setbackend` are deprecated. Please specify the chunk size directly in the sampler constructor, e.g., `HMC(0.1, 5; adtype=AutoForwardDiff(; chunksize=0))`.\n This function has no effects.", :setbackend; force=true)
nothing

Check warning on line 3 in src/deprecated.jl

View check run for this annotation

Codecov / codecov/patch

src/deprecated.jl#L1-L3

Added lines #L1 - L3 were not covered by tests
end

function setchunksize(::Int)
Base.depwarn("`CHUNKSIZE` and `setchunksize` are deprecated. Please specify the chunk size directly in the sampler constructor, e.g., `HMC(0.1, 5; adtype=AutoForwardDiff(; chunksize=0))`.\n This function has no effects.", :setchunksize; force=true)
nothing

Check warning on line 8 in src/deprecated.jl

View check run for this annotation

Codecov / codecov/patch

src/deprecated.jl#L6-L8

Added lines #L6 - L8 were not covered by tests
end

function setrdcache(::Bool)
Base.depwarn("`RDCACHE` and `setrdcache` are deprecated. Please specify the chunk size directly in the sampler constructor, e.g., `HMC(0.1, 5; adtype=AutoReverseDiff(false))`.\n This function has no effects.", :setrdcache; force=true)
nothing

Check warning on line 13 in src/deprecated.jl

View check run for this annotation

Codecov / codecov/patch

src/deprecated.jl#L11-L13

Added lines #L11 - L13 were not covered by tests
end

function setadsafe(::Bool)
Base.depwarn("`ADSAFE` and `setadsafe` are outdated and no longer in use.", :setadsafe; force=true)
nothing

Check warning on line 18 in src/deprecated.jl

View check run for this annotation

Codecov / codecov/patch

src/deprecated.jl#L16-L18

Added lines #L16 - L18 were not covered by tests
end

0 comments on commit ce61726

Please sign in to comment.