Skip to content

Commit 0aa34ba

Browse files
committed
Move RecipesBase dependency to an extension
1 parent ae3f434 commit 0aa34ba

File tree

5 files changed

+26
-20
lines changed

5 files changed

+26
-20
lines changed

Project.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ version = "4.1.0"
77
[deps]
88
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
99
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
10-
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
1110
Setfield = "efcf1570-3423-57d1-acb7-fd33fddbac46"
1211
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
1312

@@ -16,12 +15,14 @@ ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
1615
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
1716
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
1817
MutableArithmetics = "d8a4904e-b15c-11e9-3269-09a3773c0cb0"
18+
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
1919

2020
[extensions]
2121
PolynomialsChainRulesCoreExt = "ChainRulesCore"
2222
PolynomialsFFTWExt = "FFTW"
2323
PolynomialsMakieExt = "Makie"
2424
PolynomialsMutableArithmeticsExt = "MutableArithmetics"
25+
PolynomialsRecipesBaseExt = "RecipesBase"
2526

2627
[compat]
2728
Aqua = "0.8"
@@ -51,9 +52,10 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
5152
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
5253
MutableArithmetics = "d8a4904e-b15c-11e9-3269-09a3773c0cb0"
5354
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
55+
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
5456
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
5557
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
5658
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
5759

5860
[targets]
59-
test = ["Aqua", "ChainRulesCore", "DualNumbers", "FFTW", "LinearAlgebra", "MutableArithmetics", "SparseArrays", "OffsetArrays", "SpecialFunctions", "Test"]
61+
test = ["Aqua", "ChainRulesCore", "DualNumbers", "FFTW", "LinearAlgebra", "MutableArithmetics", "SparseArrays", "OffsetArrays", "RecipesBase", "SpecialFunctions", "Test"]

src/plots.jl renamed to ext/PolynomialsRecipesBaseExt.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
## XXX todo: make this an extension when minimum Julia supports that
1+
module PolynomialsRecipesBaseExt
2+
3+
using Polynomials
24
using RecipesBase
35

46
function poly_interval(p::AbstractPolynomial)
@@ -51,3 +53,5 @@ end
5153
ys = p.(xs)
5254
xs, ys
5355
end
56+
57+
end

test/StandardBasis.jl

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,22 +1687,6 @@ end
16871687
@test printpoly_to_string(SparsePolynomial(Dict(.=>(-2:2, -1:3)))) == "-x^-2 + 1 + 2*x + 3*x^2"
16881688
end
16891689

1690-
@testset "Plotting" begin
1691-
p = fromroots([-1, 1]) # x^2 - 1
1692-
rec = apply_recipe(Dict{Symbol,Any}(), p)
1693-
@test rec[1].plotattributes[:label] == "-1 + x^2"
1694-
@test rec[1].plotattributes[:xlims] == (-1.4, 1.4)
1695-
1696-
1697-
rec = apply_recipe(Dict{Symbol,Any}(), p, -1, 1)
1698-
@test rec[1].plotattributes[:label] == "-1 + x^2"
1699-
1700-
p = ChebyshevT([1,1,1])
1701-
rec = apply_recipe(Dict{Symbol,Any}(), p)
1702-
@test !isnothing(match(r"T_0", rec[1].plotattributes[:label]))
1703-
@test rec[1].plotattributes[:xlims] == (-1.0, 1.0) # uses domain(p)
1704-
end
1705-
17061690
@testset "Promotion" begin
17071691

17081692
# Test different types work together

test/runtests.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ using Test
33
using LinearAlgebra
44
using Polynomials
55
using SpecialFunctions
6-
using RecipesBase: apply_recipe
76

87
import SparseArrays: sparse, nnz
98
using OffsetArrays

test/test-extensions.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
11
using FFTW
22
using Makie
33
using ChainRulesCore
4+
using RecipesBase: apply_recipe
5+
6+
@testset "Plotting" begin
7+
p = fromroots([-1, 1]) # x^2 - 1
8+
rec = apply_recipe(Dict{Symbol,Any}(), p)
9+
@test rec[1].plotattributes[:label] == "-1 + x^2"
10+
@test rec[1].plotattributes[:xlims] == (-1.4, 1.4)
11+
12+
13+
rec = apply_recipe(Dict{Symbol,Any}(), p, -1, 1)
14+
@test rec[1].plotattributes[:label] == "-1 + x^2"
15+
16+
p = ChebyshevT([1,1,1])
17+
rec = apply_recipe(Dict{Symbol,Any}(), p)
18+
@test !isnothing(match(r"T_0", rec[1].plotattributes[:label]))
19+
@test rec[1].plotattributes[:xlims] == (-1.0, 1.0) # uses domain(p)
20+
end

0 commit comments

Comments
 (0)