Skip to content

Commit 45e18a4

Browse files
authored
Remove deprecations; update norm behavior (#412)
* Remove deprecations; update `norm` behavior * update docs, misc tweaks * fix latex * fix * allow building docs while skipping examples * smaller `huber` example * fix docstring * do the norm deprecation in 2 steps * leave for next PR * add `vecnorm` to NEWS * oops, not needed
1 parent 481fa02 commit 45e18a4

File tree

18 files changed

+218
-204
lines changed

18 files changed

+218
-204
lines changed

NEWS.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
# Changes in v0.14.0
2+
3+
## Breaking changes
4+
5+
* Changes to the `sign` of atoms:
6+
* The sign of `sumlargesteigs` has been changed from `Positive` to `NoSign()` instead of `Positive()`, to allow non-positive-semidefinite inputs. This has the potential
7+
to break code that required that sign to be positive. If you run into this problem, please file an issue so we can figure out a workaround. [#412](https://github.com/jump-dev/Convex.jl/pull/412)
8+
* Removal of deprecations
9+
* `lambdamin` and `lambdamax` has been deprecated to `eigmin` and `eigmax` since Convex v0.13.0. This deprecation has been removed, so your code must be updated to call `eigmin` or `eigmax` instead. [#412](https://github.com/jump-dev/Convex.jl/pull/412)
10+
* `norm(x, p)` where `x` is a matrix expression has been deprecated to `opnorm(x,p)` since Convex v0.8.0. This deprecation has been removed, so your code must be updated to call `opnorm(x, p)` instead. Currently, `norm(x,p)` for a matrix
11+
expression `x` will error, but in Convex.jl v0.15.0 it will return `norm(vec(x), p)`. [#412](https://github.com/jump-dev/Convex.jl/pull/412)
12+
* `Convex.clearmemory()` has been deprecated and unnecessary since Convex v0.12.5. This deprecation has been removed, so if this function is in your code, just delete it. [#412](https://github.com/jump-dev/Convex.jl/pull/412)
13+
* `vecnorm(x, p)` has been deprecated to `norm(vec(x), p)` since Convex v0.8.0. This deprecation has been removed, so your code must be updated to call `norm(vec(x),p)` instead.
14+
15+
## Other changes
16+
17+
* updated `nuclearnorm` and `sumlargesteigs` to allow complex variables, and allow the argument of `sumlargesteigs` to be non-positive-semi-definite [#409](https://github.com/jump-dev/Convex.jl/pull/409). Thanks to @dstahlke!
18+
119
# Changes in v0.13.8
220

321
* add unary `+` for `Sign` and `ComplexSign` to allow single-argument `hcat` and `vcat` to work [#405](https://github.com/jump-dev/Convex.jl/pull/405). Thanks to @dstahlke!

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "Convex"
22
uuid = "f65535da-76fb-5f13-bab9-19810c17039a"
3-
version = "0.13.8"
3+
version = "0.14.0-DEV"
44

55
[deps]
66
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"

docs/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
1919
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
2020

2121
[compat]
22-
Documenter = "0.24"
22+
Documenter = "0.26"

docs/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ julia --project=docs -e 'using Pkg; Pkg.instantiate(); include("docs/make.jl")'
1414
to generate the examples notebooks (which will be placed in `docs/notebooks`)
1515
and the documentation itself, which is generated into the `doc/build` folder,
1616
and can be previewed by opening a webserver there. Note that this command can
17-
take some time.
17+
take some time. To generate the documentation without updating the examples,
18+
set `ENV["CONVEX_SKIP_EXAMPLES"]="true"` before including `docs/make.jl`.
1819

1920
To generate a single Jupyter notebook, run e.g.
2021

docs/examples_literate/general_examples/huber_regression.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ if big_example
77
n = 300
88
number_tests = 50
99
else
10-
n = 100
11-
number_tests = 20
10+
n = 50
11+
number_tests = 10
1212
end
1313

1414
# Generate data for Huber regression.

docs/make.jl

Lines changed: 101 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -4,129 +4,135 @@ using Documenter, Convex, Literate, Pkg
44
previous_GKSwstype = get(ENV, "GKSwstype", "")
55
ENV["GKSwstype"] = "100"
66

7-
@info "Building examples..."
8-
9-
filename(str) = first(splitext(last(splitdir(str))))
10-
filename_to_name(str) = uppercasefirst(replace(replace(filename(str), "-" => " "), "_" => " "))
11-
12-
fix_math_md(content) = replace(content, r"\$\$(.*?)\$\$"s => s"```math\1```")
13-
14-
literate_path = joinpath(@__DIR__(), "examples_literate")
157
build_path = joinpath(@__DIR__, "src", "examples")
168
rm(build_path; force=true, recursive=true)
179
isdir(build_path) || mkdir(build_path)
1810

11+
literate_path = joinpath(@__DIR__(), "examples_literate")
12+
notebooks_path = joinpath(@__DIR__, "notebooks")
1913

20-
@info "[Examples] Preparing notebooks..."
14+
filename(str) = first(splitext(last(splitdir(str))))
15+
filename_to_name(str) = uppercasefirst(replace(replace(filename(str), "-" => " "), "_" => " "))
16+
fix_math_md(content) = replace(content, r"\$\$(.*?)\$\$"s => s"```math\1```")
2117

22-
notebooks_path = joinpath(@__DIR__, "notebooks")
23-
rm(notebooks_path, recursive=true, force=true)
24-
mkdir(notebooks_path)
25-
26-
for dir in readdir(literate_path)
27-
dir_path = joinpath(literate_path, dir)
28-
isdir(dir_path) || continue
29-
@info "Processing directory $dir"
30-
notebook_dir = joinpath(notebooks_path, dir)
31-
isdir(notebook_dir) || mkdir(notebook_dir)
32-
for file in readdir(dir_path)
33-
file_path = joinpath(dir_path, file)
34-
out_path = joinpath(notebooks_path, dir, file)
35-
if endswith(file, ".jl")
36-
Literate.notebook(file_path, notebook_dir, execute=false)
37-
else
38-
cp(file_path, out_path)
18+
19+
SKIP_EXAMPLES = get(ENV, "CONVEX_SKIP_EXAMPLES", false) == "true"
20+
21+
if SKIP_EXAMPLES
22+
@info "Skipping examples"
23+
examples_nav = String[]
24+
else
25+
@info "Building examples..."
26+
27+
@info "[Examples] Preparing notebooks..."
28+
29+
rm(notebooks_path, recursive=true, force=true)
30+
mkdir(notebooks_path)
31+
32+
for dir in readdir(literate_path)
33+
dir_path = joinpath(literate_path, dir)
34+
isdir(dir_path) || continue
35+
@info "Processing directory $dir"
36+
notebook_dir = joinpath(notebooks_path, dir)
37+
isdir(notebook_dir) || mkdir(notebook_dir)
38+
for file in readdir(dir_path)
39+
file_path = joinpath(dir_path, file)
40+
out_path = joinpath(notebooks_path, dir, file)
41+
if endswith(file, ".jl")
42+
Literate.notebook(file_path, notebook_dir, execute=false)
43+
else
44+
cp(file_path, out_path)
45+
end
3946
end
4047
end
41-
end
4248

43-
# Copy `Project.toml` to notebooks
44-
cp(joinpath(@__DIR__, "Project.toml"), joinpath(notebooks_path, "Project.toml"))
49+
# Copy `Project.toml` to notebooks
50+
cp(joinpath(@__DIR__, "Project.toml"), joinpath(notebooks_path, "Project.toml"))
4551

46-
# Add a README file to notebooks
47-
open(joinpath(notebooks_path, "README.md"), "w") do io
48-
print(io, """
49-
# Convex.jl example notebooks
52+
# Add a README file to notebooks
53+
open(joinpath(notebooks_path, "README.md"), "w") do io
54+
print(io, """
55+
# Convex.jl example notebooks
5056
51-
Start Julia in this directory and set the project flag to point to this directory. E.g. run the command
57+
Start Julia in this directory and set the project flag to point to this directory. E.g. run the command
5258
53-
```julia
54-
julia --project=.
55-
```
59+
```julia
60+
julia --project=.
61+
```
5662
57-
in this directory.
63+
in this directory.
5864
59-
Then add `IJulia` if it's not installed already in your global environment by
65+
Then add `IJulia` if it's not installed already in your global environment by
6066
61-
```julia
62-
pkg> add IJulia
63-
```
67+
```julia
68+
pkg> add IJulia
69+
```
6470
65-
Also call `instantiate` to download the required packages:
71+
Also call `instantiate` to download the required packages:
6672
67-
```julia
68-
pkg> instantiate
69-
```
73+
```julia
74+
pkg> instantiate
75+
```
7076
71-
Then launch Jupyter:
77+
Then launch Jupyter:
7278
73-
```julia
74-
julia> using IJulia
79+
```julia
80+
julia> using IJulia
7581
76-
julia> notebook(dir=pwd(); detached=true)
77-
```
82+
julia> notebook(dir=pwd(); detached=true)
83+
```
7884
79-
This should allow you to try any of the notebooks.
80-
""")
81-
end
85+
This should allow you to try any of the notebooks.
86+
""")
87+
end
8288

83-
# zip up the notebooks directory
84-
zip_path = joinpath(build_path, "notebooks.zip")
85-
run(Cmd(`zip $zip_path -r notebooks`; dir = @__DIR__))
86-
87-
@info "[Examples] Preparing markdown files..."
88-
89-
for dir in readdir(literate_path)
90-
dir_path = joinpath(literate_path, dir)
91-
isdir(dir_path) || continue
92-
@info "Processing directory $dir"
93-
build_dir = joinpath(build_path, dir)
94-
isdir(build_dir) || mkdir(build_dir)
95-
for file in readdir(dir_path)
96-
file_path = joinpath(dir_path, file)
97-
out_path = joinpath(build_path, dir, file)
98-
if endswith(file, ".jl")
99-
postprocess = function(content)
100-
"""
101-
All of the examples can be found in Jupyter notebook form [here](../$(filename(zip_path)).zip).
102-
103-
```@setup $(filename(file))
104-
__START_TIME = time_ns()
105-
@info "Starting example $(filename(file))"
106-
```
107-
""" * content * """
108-
```@setup $(filename(file))
109-
__END_TIME = time_ns()
110-
elapsed = string(round((__END_TIME - __START_TIME)*1e-9; sigdigits = 3), "s")
111-
@info "Finished example $(filename(file)) after " * elapsed
112-
```
113-
"""
89+
# zip up the notebooks directory
90+
zip_path = joinpath(build_path, "notebooks.zip")
91+
run(Cmd(`zip $zip_path -r notebooks`; dir = @__DIR__))
92+
93+
@info "[Examples] Preparing markdown files..."
94+
95+
for dir in readdir(literate_path)
96+
dir_path = joinpath(literate_path, dir)
97+
isdir(dir_path) || continue
98+
@info "Processing directory $dir"
99+
build_dir = joinpath(build_path, dir)
100+
isdir(build_dir) || mkdir(build_dir)
101+
for file in readdir(dir_path)
102+
file_path = joinpath(dir_path, file)
103+
out_path = joinpath(build_path, dir, file)
104+
if endswith(file, ".jl")
105+
postprocess = function(content)
106+
"""
107+
All of the examples can be found in Jupyter notebook form [here](../$(filename(zip_path)).zip).
108+
109+
```@setup $(filename(file))
110+
__START_TIME = time_ns()
111+
@info "Starting example $(filename(file))"
112+
```
113+
""" * content * """
114+
```@setup $(filename(file))
115+
__END_TIME = time_ns()
116+
elapsed = string(round((__END_TIME - __START_TIME)*1e-9; sigdigits = 3), "s")
117+
@info "Finished example $(filename(file)) after " * elapsed
118+
```
119+
"""
120+
end
121+
Literate.markdown(file_path, build_dir; preprocess = fix_math_md, documenter = true, postprocess = postprocess)
122+
else
123+
cp(file_path, out_path)
114124
end
115-
Literate.markdown(file_path, build_dir; preprocess = fix_math_md, documenter = true, postprocess = postprocess)
116-
else
117-
cp(file_path, out_path)
118125
end
119126
end
120-
end
121-
122-
@info "Starting `makedocs`"
127+
# Build nav tree for examples
128+
function nav_dir(dir, path)
129+
sort([ joinpath("examples", dir, file) for file in readdir(path) if endswith(file, ".md") && file != "index.md" ])
130+
end
123131

124-
# Build nav tree for examples
125-
function nav_dir(dir, path)
126-
sort([ joinpath("examples", dir, file) for file in readdir(path) if endswith(file, ".md") && file != "index.md" ])
132+
examples_nav = [ filename_to_name(dir) => nav_dir(dir, joinpath(build_path, dir)) for dir in readdir(build_path) if isdir(joinpath(build_path, dir)) ]
127133
end
128134

129-
examples_nav = [ filename_to_name(dir) => nav_dir(dir, joinpath(build_path, dir)) for dir in readdir(build_path) if isdir(joinpath(build_path, dir)) ]
135+
@info "Starting `makedocs`"
130136

131137
makedocs(;
132138
modules = [Convex],

0 commit comments

Comments
 (0)