-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BREAKING] Move functionality to extension packages #328
Conversation
Thanks! Yes, I think it's a good idea. We should try to keep it working for Julia v1.6 as well as long as it's the LTS. In order to do that, we can simply keep the old behavior on Julia v1.6 as done in NLopt: https://github.com/JuliaOpt/NLopt.jl/blob/master/src/NLopt.jl#L633-L637 Can you post timings for comparison with Julia v1.9 or v1.10 ? |
I think GenericLinearAlgebra is probably not a good candidate for this but RecipesBase seems to be a good one. |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #328 +/- ##
==========================================
- Coverage 88.95% 88.92% -0.04%
==========================================
Files 37 37
Lines 3170 3170
==========================================
- Hits 2820 2819 -1
- Misses 350 351 +1 ☔ View full report in Codecov by Sentry. |
@blegat Thank you for your recommendations regarding compatibility and additional extensions. I have used the strategy in NLopt to maintain 1.6 compatibility and I also moved RecipesBase and GeometryBasics to extensions. Although these changes could be considered breaking in Julia 1.9 and above, the recommended usage in the docs and examples always loads the extension packages and so I expect these changes wouldn't impact very many users. One exception is that 3d plotting would require loading the plotting package (Makie/MeshCat) before calling For example, the following works: using Polyhedra, GLMakie
v = convexhull([0, 0, 0]) + conichull([1, 0, 0], [0, 1, 0], [0, 0, 1])
p = polyhedron(v)
m = Polyhedra.Mesh(p)
mesh(m; color=:blue) but this would no longer work using Polyhedra
v = convexhull([0, 0, 0]) + conichull([1, 0, 0], [0, 1, 0], [0, 0, 1])
p = polyhedron(v)
m = Polyhedra.Mesh(p)
using GLMakie
mesh(m; color=:blue) |
Starting from this gist I wrote some tests for precompilation times with the help of the juliaup installer Test scriptfor (url, rev) in [("https://github.com/lxvm/Polyhedra.jl", "ext"), ("https://github.com/JuliaPolyhedra/Polyhedra.jl", "master")]
code = """
import Pkg
@show @time Pkg.add(url="$url", rev="$rev")
@show @time Pkg.precompile()
@show @time using Polyhedra
"""
for jl in [`julia +lts`, `julia +release`]
@info "" jl ver=read(`$jl -E 'VERSION'`, String) |> strip
mktempdir() do depot
mkdir(joinpath(depot, "registries"))
cp(expanduser("~/.julia/registries/General"), joinpath(depot, "registries/General"))
# alternatively:
# run(addenv(`$jl -e 'using Pkg; pkg"registry add https://github.com/JuliaRegistries/General"'`, Dict("JULIA_DEPOT_PATH" => depot)))
for (i, date) in enumerate(["2023-12-28"])
cd(joinpath(depot, "registries/General")) do
commit = read(`git rev-list -n 1 --first-parent --before=$date master`, String) |> strip
run(`git checkout $commit`)
end
mktempdir() do env
cd(env)
write("script.jl", code)
# if i == 1
# @info "Initial run in depot"
# run(addenv(`$jl --project script.jl`, Dict("JULIA_DEPOT_PATH" => depot)))
# end
@info "$i-th run in depot"
run(addenv(`$jl --project script.jl`, Dict("JULIA_DEPOT_PATH" => depot)))
end
end
end
end
end Relevant results are summarized here, taken from the raw output below
It looks like the speed-up of updating from v1.6.7 to v1.10.0 is more relevant than the improvements from moving some dependencies to extensions, although I notice Script output
|
Also, regarding the CI, I think it breaks on v1.10 due to changed printing of rationals and the documentation build broke because I originally set the version to 0.8 and have since reverted to 0.7.7, assuming this can be considered non-breaking. |
I think the breaking change with |
Can you rebase on top of the master branch ? |
@blegat I've rebased, uncommented the lines you requested, and added an error message for using Polyhedra
v = convexhull([0, 0, 0]) + conichull([1, 0, 0], [0, 1, 0], [0, 0, 1])
p = polyhedron(v)
m = Polyhedra.Mesh(p) throws
|
I took the opportunity of making a breaking change to run the Aqua tests, which most notably caught the type piracy in the Moreover, this pr's changes are now summarized in a NEWS.md file |
Indeed, it's type piracy. You can move this to a separate PR if you don't want it to block this one. We could make a breaking change and then a breaking release so that CDDLib is allowed to be updated. However, I would rather keep |
Sounds good, I think it would be better to deal with the issues Aqua raises in a separate pr to get this one through, so I'll revert those commits to keep only the changes to extensions. |
We should be clear to run the tests again. If all goes well, I think we should revisit the version number and news file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
* move jump to extension * support for regular dependency in julia 1.6 * reorganize JuMP ext * move RecipesBase and GeometryBasics to ext * uncomment verbose statement * add error message for Mesh * add news file describing breaking change * update docs * update examples * simplify doc * fix verbose print of model * remove exported JuMP function * import functions missing in GeometryBasicsExt * add missing compat entry
* move jump to extension * support for regular dependency in julia 1.6 * reorganize JuMP ext * move RecipesBase and GeometryBasics to ext * uncomment verbose statement * add error message for Mesh * add news file describing breaking change * update docs * update examples * simplify doc * fix verbose print of model * remove exported JuMP function * import functions missing in GeometryBasicsExt * add missing compat entry
* move jump to extension * support for regular dependency in julia 1.6 * reorganize JuMP ext * move RecipesBase and GeometryBasics to ext * uncomment verbose statement * add error message for Mesh * add news file describing breaking change * update docs * update examples * simplify doc * fix verbose print of model * remove exported JuMP function * import functions missing in GeometryBasicsExt * add missing compat entry
* move jump to extension * support for regular dependency in julia 1.6 * reorganize JuMP ext * move RecipesBase and GeometryBasics to ext * uncomment verbose statement * add error message for Mesh * add news file describing breaking change * update docs * update examples * simplify doc * fix verbose print of model * remove exported JuMP function * import functions missing in GeometryBasicsExt * add missing compat entry
This pr reduces Polyhedra.jl dependencies by moving the functionality it uses with JuMP.jl to an extension package.
These changes will be breaking because it now requires loading JuMP and requires Julia v1.9.See the checklist below for what needs to be done:or GenericLinearAlgebra.jland GeometryBasics.jl)detect_new_linearities
?I would appreciate additional feedback from maintainers on the utility of this pr as well as its approach. Thank you!