Skip to content

Commit

Permalink
Merge pull request #354 from MilesCranmer/deprecate-jl-1.9
Browse files Browse the repository at this point in the history
Deprecate Julia 1.9
  • Loading branch information
MilesCranmer authored Oct 14, 2024
2 parents aab19ea + 69af984 commit 2cd8b10
Show file tree
Hide file tree
Showing 14 changed files with 36 additions and 75 deletions.
12 changes: 1 addition & 11 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ jobs:
- "part2"
- "part3"
julia-version:
- "1.6"
- "1.8"
- "1.10"
- "1"
os:
- ubuntu-latest
Expand All @@ -54,15 +53,6 @@ jobs:
- os: macOS-latest
julia-version: "1"
test: "part3"
- os: ubuntu-latest
julia-version: "~1.11.0-0"
test: "part1"
- os: ubuntu-latest
julia-version: "~1.11.0-0"
test: "part2"
- os: ubuntu-latest
julia-version: "~1.11.0-0"
test: "part3"

steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 1 addition & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ LossFunctions = "30fc2ffe-d236-52d8-8643-a9d8f7c094a7"
MLJModelInterface = "e80e1ace-859a-464e-9ed9-23947d8ae3ea"
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
Optim = "429524aa-4258-5aef-a3af-852621145aeb"
PackageExtensionCompat = "65ce6f38-6b18-4e1d-a461-8949797d7930"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Expand Down Expand Up @@ -58,7 +57,6 @@ LossFunctions = "0.10, 0.11"
MLJModelInterface = "~1.5, ~1.6, ~1.7, ~1.8, ~1.9, ~1.10, ~1.11"
MacroTools = "0.4, 0.5"
Optim = "~1.8, ~1.9"
PackageExtensionCompat = "1"
Pkg = "<0.0.1, 1"
PrecompileTools = "1"
Printf = "<0.0.1, 1"
Expand All @@ -69,7 +67,7 @@ SpecialFunctions = "0.10.1, 1, 2"
StatsBase = "0.33, 0.34"
SymbolicUtils = "0.19, ^1.0.5, 2, 3"
TOML = "<0.0.1, 1"
julia = "1.6"
julia = "1.10"

[extras]
Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9"
Expand Down
4 changes: 0 additions & 4 deletions src/Configure.jl
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,6 @@ function configure_workers(;
end

if we_created_procs
if VERSION < v"1.9.0"
# On newer Julia; environment is activated automatically
activate_env_on_workers(procs, project_path, options, verbosity)
end
import_module_on_workers(procs, file, options, verbosity)
end

Expand Down
34 changes: 17 additions & 17 deletions src/Dataset.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module DatasetModule

using DynamicQuantities: Quantity

using ..UtilsModule: subscriptify, get_base_type, @constfield
using ..UtilsModule: subscriptify, get_base_type
using ..ProgramConstantsModule: BATCH_DIM, FEATURE_DIM, DATA_TYPE, LOSS_TYPE
using ...InterfaceDynamicQuantitiesModule: get_si_units, get_sym_units

Expand Down Expand Up @@ -57,24 +57,24 @@ mutable struct Dataset{
XUS<:Union{AbstractVector{<:Quantity},Nothing},
YUS<:Union{Quantity,Nothing},
}
@constfield X::AX
@constfield y::AY
@constfield index::Int
@constfield n::Int
@constfield nfeatures::Int
@constfield weighted::Bool
@constfield weights::AW
@constfield extra::NT
@constfield avg_y::Union{T,Nothing}
const X::AX
const y::AY
const index::Int
const n::Int
const nfeatures::Int
const weighted::Bool
const weights::AW
const extra::NT
const avg_y::Union{T,Nothing}
use_baseline::Bool
baseline_loss::L
@constfield variable_names::Array{String,1}
@constfield display_variable_names::Array{String,1}
@constfield y_variable_name::String
@constfield X_units::XU
@constfield y_units::YU
@constfield X_sym_units::XUS
@constfield y_sym_units::YUS
const variable_names::Array{String,1}
const display_variable_names::Array{String,1}
const y_variable_name::String
const X_units::XU
const y_units::YU
const X_sym_units::XUS
const y_sym_units::YUS
end

"""
Expand Down
1 change: 0 additions & 1 deletion src/MLJInterface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ using DynamicQuantities:
ustrip,
dimension
using LossFunctions: SupervisedLoss
using Compat: allequal, stack
using ..InterfaceDynamicQuantitiesModule: get_dimensions_type
using ..CoreModule: Options, Dataset, AbstractMutationWeights, MutationWeights, LOSS_TYPE
using ..CoreModule.OptionsModule: DEFAULT_OPTIONS, OPTION_DESCRIPTIONS
Expand Down
1 change: 0 additions & 1 deletion src/MutationFunctions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ using DynamicExpressions:
count_nodes,
has_constants,
has_operators
using Compat: Returns, @inline
using ..CoreModule: AbstractOptions, DATA_TYPE

"""
Expand Down
2 changes: 1 addition & 1 deletion src/SearchUtils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ end

_addprocs_function = addprocs_function === nothing ? addprocs : addprocs_function

exeflags = if VERSION >= v"1.9" && concurrency == :multiprocessing
exeflags = if concurrency == :multiprocessing
heap_size_hint_in_megabytes = floor(
Int, (
if heap_size_hint_in_bytes === nothing
Expand Down
5 changes: 0 additions & 5 deletions src/SymbolicRegression.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ export Population,

using Distributed
using Printf: @printf, @sprintf
using PackageExtensionCompat: @require_extensions
using Pkg: Pkg
using TOML: parsefile
using Random: seed!, shuffle!
Expand Down Expand Up @@ -1087,10 +1086,6 @@ end
include("MLJInterface.jl")
using .MLJInterfaceModule: SRRegressor, MultitargetSRRegressor

function __init__()
@require_extensions
end

# Hack to get static analysis to work from within tests:
@ignore include("../test/runtests.jl")

Expand Down
5 changes: 0 additions & 5 deletions src/Utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,6 @@ function _save_kwargs(log_variable::Symbol, fdef::Expr)
end
end

# Allows using `const` fields in older versions of Julia.
macro constfield(ex)
return esc(VERSION < v"1.8.0" ? ex : Expr(:const, ex))
end

json3_write(args...) = error("Please load the JSON3.jl package.")

"""
Expand Down
7 changes: 2 additions & 5 deletions src/precompile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ macro maybe_compile_workload(mode, ex)
end
end

const PRECOMPILE_OPTIMIZATION = VERSION >= v"1.9.0-DEV.0"

"""`mode=:precompile` will use `@precompile_*` directives; `mode=:compile` runs."""
function do_precompilation(::Val{mode}) where {mode}
@maybe_setup_workload mode begin
Expand All @@ -57,13 +55,12 @@ function do_precompilation(::Val{mode}) where {mode}
simplify=1.0,
randomize=1.0,
do_nothing=1.0,
optimize=PRECOMPILE_OPTIMIZATION ? 1.0 : 0.0,
optimize=1.0,
),
fraction_replaced=0.2,
fraction_replaced_hof=0.2,
define_helper_functions=false,
optimizer_probability=PRECOMPILE_OPTIMIZATION ? 0.05 : 0.0,
should_optimize_constants=PRECOMPILE_OPTIMIZATION,
optimizer_probability=0.05,
save_to_file=false,
)
state = equation_search(
Expand Down
2 changes: 1 addition & 1 deletion test/test_aqua.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ using Aqua

Aqua.test_all(SymbolicRegression; ambiguities=false)

VERSION >= v"1.9" && Aqua.test_ambiguities(SymbolicRegression)
Aqua.test_ambiguities(SymbolicRegression)
14 changes: 5 additions & 9 deletions test/test_mlj.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,8 @@ end
@test ypred_mixed == hcat(ypred_good[:, 1], ypred_bad[:, 2], ypred_good[:, 3])

@test_throws AssertionError predict(mach, (data=X,))
VERSION >= v"1.8" &&
@test_throws "If specifying an equation index during" predict(mach, (data=X,))
VERSION >= v"1.8" &&
@test_throws "If specifying an equation index during" predict(mach, (X=X, idx=1))
@test_throws "If specifying an equation index during" predict(mach, (data=X,))
@test_throws "If specifying an equation index during" predict(mach, (X=X, idx=1))
end

@testitem "Variable names - named outputs" tags = [:part1] begin
Expand All @@ -112,7 +110,7 @@ end
test_outs = predict(mach, X)
@test isempty(setdiff((:c1, :c2), keys(test_outs)))
@test_throws AssertionError predict(mach, (a1=randn(32), b2=randn(32)))
VERSION >= v"1.8" && @test_throws "Variable names do not match fitted" predict(
@test_throws "Variable names do not match fitted" predict(
mach, (b1=randn(32), a2=randn(32))
)
end
Expand Down Expand Up @@ -146,15 +144,13 @@ end
rng = MersenneTwister(0)
mach = machine(model, randn(rng, 32, 3), randn(rng, 32); scitype_check_level=0)
@test_throws AssertionError @quiet(fit!(mach))
VERSION >= v"1.8" &&
@test_throws "For single-output regression, please" @quiet(fit!(mach))
@test_throws "For single-output regression, please" @quiet(fit!(mach))

model = SRRegressor()
rng = MersenneTwister(0)
mach = machine(model, randn(rng, 32, 3), randn(rng, 32, 2); scitype_check_level=0)
@test_throws AssertionError @quiet(fit!(mach))
VERSION >= v"1.8" &&
@test_throws "For multi-output regression, please" @quiet(fit!(mach))
@test_throws "For multi-output regression, please" @quiet(fit!(mach))

model = SRRegressor(; verbosity=0)
rng = MersenneTwister(0)
Expand Down
14 changes: 6 additions & 8 deletions test/test_operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,9 @@ end
@test_throws ErrorException SymbolicRegression.assert_operators_well_defined(
ComplexF64, options
)
VERSION >= v"1.8" &&
@test_throws "complex plane" SymbolicRegression.assert_operators_well_defined(
ComplexF64, options
)
@test_throws "complex plane" SymbolicRegression.assert_operators_well_defined(
ComplexF64, options
)
end

@testset "Operators which return the wrong type should fail" begin
Expand All @@ -111,10 +110,9 @@ end
@test_throws ErrorException SymbolicRegression.assert_operators_well_defined(
Float64, options
)
VERSION >= v"1.8" &&
@test_throws "returned an output of type" SymbolicRegression.assert_operators_well_defined(
Float64, options
)
@test_throws "returned an output of type" SymbolicRegression.assert_operators_well_defined(
Float64, options
)
@test_nowarn SymbolicRegression.assert_operators_well_defined(Float32, options)
end

Expand Down
6 changes: 2 additions & 4 deletions test/test_units.jl
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,7 @@ end
# TODO: Should return same quantity as input
@test typeof(ypred.a[begin]) <: Quantity
@test typeof(y.a[begin]) <: RealQuantity
VERSION >= v"1.8" &&
@eval @test(typeof(ypred.b[begin]) == typeof(y.b[begin]), broken = true)
@eval @test(typeof(ypred.b[begin]) == typeof(y.b[begin]), broken = true)
end
end

Expand All @@ -322,8 +321,7 @@ end

X = randn(11, 50)
y = randn(50)
VERSION >= v"1.8.0" &&
@test_throws("Number of features", Dataset(X, y; X_units=["m", "1"], y_units="kg"))
@test_throws("Number of features", Dataset(X, y; X_units=["m", "1"], y_units="kg"))
end

@testitem "Should print units" tags = [:part3] begin
Expand Down

0 comments on commit 2cd8b10

Please sign in to comment.