Skip to content

Commit 6175bd9

Browse files
Compat admonitions and NEWS for Julia 1.1 (#30230)
Addition of NEWS and compat admonitions for important changes between Julia 1.0 and 1.1, including: - Custom .css-style for compat admonitions. - Information about compat annotations to CONTRIBUTING.md. - NEWS.md entry for PRs #30090, #30035, #30022, #29978, #29969, #29858, #29845, #29754, #29638, #29636, #29615, #29600, #29506, #29469, #29316, #29259, #29178, #29153, #29033, #28902, #28761, #28745, #28708, #28696, #29997, #28790, #29092, #29108, #29782 - Compat annotation for PRs #30090, #30013, #29978, #29890, #29858, #29827, #29754, #29679, #29636, #29623, #29600, #29440, #29316, #29259, #29178, #29157, #29153, #29033, #28902, #28878, #28761, #28708, #28156, #29733, #29670, #29997, #28790, #29092, #29108, #29782, #25278 - Documentation for broadcasting CartesianIndices (#30230). - Documentation for Base.julia_cmd(). - Documentation for colon constructor of CartesianIndices (#29440). - Documentation for ^(::Matrix, ::Number) and ^(::Number, ::Matrix). - Run NEWS-update.jl. Co-authored-by: Morten Piibeleht <[email protected]> Co-authored-by: Fredrik Ekre <[email protected]>
1 parent 6594acc commit 6175bd9

35 files changed

+318
-10
lines changed

CONTRIBUTING.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,21 @@ A doctest needs to match an interactive REPL including the `julia>` prompt. To r
184184

185185
For new functionality and other substantial changes, add a brief summary to `NEWS.md`. The news item should cross reference the pull request (PR) parenthetically, in the form `([#pr])`; after adding this, run `./julia doc/NEWS-update.jl` from the `julia` directory to update the cross-reference links. To add the PR reference number, first create the PR, then push an additional commit updating `NEWS.md` with the PR reference number.
186186

187+
#### Annotations for new features, deprecations and behavior changes
188+
189+
API additions and deprecations, and minor behavior changes are allowed in minor version releases.
190+
For documented features that are part of the public API, a compatibility note should be added into
191+
the manual or the docstring. It should state the Julia minor version that made changed the behavior
192+
and have a brief message describing the change.
193+
194+
At the moment, this should always be done with the following `compat` admonition
195+
(so that it would be possible to programmatically find the annotations in the future):
196+
197+
```
198+
!!! compat "Julia 1.X"
199+
This method was added in Julia 1.X.
200+
```
201+
187202
### Contributing to core functionality or base libraries
188203
189204
*By contributing code to Julia, you are agreeing to release it under the [MIT License](https://github.com/JuliaLang/julia/tree/master/LICENSE.md).*

NEWS.md

Lines changed: 90 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ New library functions
3939
* `isnothing(::Any)` function, to check whether something is a `Nothing`, returns a `Bool` ([#29679]).
4040
* `getpid(::Process)` method ([#24064]).
4141
* `eachrow`, `eachcol` and `eachslice` functions provide efficient iterators over slices of arrays ([#29749]).
42+
* `fieldtypes(T::Type)` which return the declared types of the field in type T ([#29600]).
43+
* `uuid5` has been added to the `UUIDs` standard library ([#28761]).
4244

4345
Standard library changes
4446
------------------------
@@ -50,7 +52,7 @@ Standard library changes
5052
* `range` can accept the stop value as a positional argument, e.g. `range(1,10,step=2)` ([#28708]).
5153
* `edit` can now be called on a module to edit the file that defines it ([#29636]).
5254
* `diff` now supports arrays of arbitrary dimensionality and can operate over any dimension ([#29827]).
53-
* `sprandn` now supports result types like `ComplexF64` or `Float32` ([#30083]).
55+
* `sprandn` now supports specifying the output element type ([#30083]).
5456
* All compiler-reflection tools (i.e. the `code_` class of functions and macros) now print accurate
5557
line number and inlining information in a common style, and take an optional parameter (debuginfo=:default)
5658
to control the verbosity of the metadata shown ([#29893]).
@@ -66,11 +68,42 @@ Standard library changes
6668
* `Base.tail` now works on named tuples ([#29595]).
6769
* `randperm` and `randcycle` now use the type of their argument to determine the element type of
6870
the returned array ([#29670]).
71+
* The process id is appended to malloc log files in order to track memory allocations of
72+
multiple processes ([#29969]).
73+
* `Base.julia_cmd` now propagates the `--inline=(yes|no)` flag ([#29858]).
74+
* New `DateTime(::Date, ::Time)` constructor ([#29754]).
75+
* `isdiag` and `isposdef` for `Diagonal` and `UniformScaling` ([#29638]).
76+
* `mul!`, `rmul!` and `lmul!` methods for `UniformScaling` ([#29506]).
77+
* `Symmetric` and `Hermitian` matrices now preserve the wrapper when scaled with a number ([#29469]).
78+
* New `edit(m::Module)` method which opens the main source file for module `m` ([#29636]).
79+
* `Base.@kwdef` can now be used for parametric structs, and for structs with supertypes ([#29316]).
80+
* `merge(::NamedTuple, ::NamedTuple...)` can now be used with more than 2 `NamedTuple`s ([#29259]).
81+
* `Future.copy!` has been moved to `Base` ([#29178]).
82+
* New `ncodeunits(c::Char)` method as a fast equivalent to `ncodeunits(string(c))` ([#29153]).
83+
* `mean` and `var` now handles the empty case ([#29033]).
84+
* New `sort!(::AbstractArray; dims)` method that can sort the array along the `dims` dimension ([#28902]).
85+
* `range` now accept `stop` as a positional argument ([#28708]).
86+
* `parse(Bool, str)` is now supported ([#29997]).
87+
* `copyto!(::AbstractMatrix, ::UniformScaling)` supports rectangular matrices now ([#28790]).
88+
* In `put!(c::Channel{T}, v)`, `v` now gets converted to `T` as `put!` is being called ([#29092]).
89+
* `current_project()` now searches the parent directories of a Git repository for a `Project.toml` file.
90+
This also affects the behavior of the `--project` command line option when using the default
91+
`--project=@.` ([#29108]).
92+
* Exponentiation operator `^` now supports raising a `Irrational` to an `AbstractMatrix` power ([#29782]).
6993
* A new method `rand(::Tuple)` implements sampling from the values of a tuple ([#25278]).
7094

7195
Compiler/Runtime improvements
7296
-----------------------------
7397

98+
External dependencies
99+
---------------------
100+
101+
* 7zip (bundled with Julia on Windows) has been upgraded from version 16.04 to 18.05 ([#30035]).
102+
* Busybox is no longer bundled with Julia on Windows ([#30022]).
103+
* OpenBLAS has been upgraded from 0.3.2 to 0.3.3 ([#29845]).
104+
* The source code for Pkg is no longer included in JuliaLang/julia. Pkg is instead
105+
downloaded during the build process ([#29615]).
106+
* LLVM has been upgraded to 6.0.1 and support for LLVM < 6.0 has been dropped ([#28745], [#28696]).
74107

75108
Deprecated or removed
76109
---------------------
@@ -80,9 +113,65 @@ Deprecated or removed
80113
to get an appropriate task-local buffer and pass it to `grisu()` instead ([#29907]).
81114
* The internal function `Base._default_type(T)` has been removed. Calls to it should be
82115
replaced with just the argument `T` ([#29739]).
116+
* `peakflops` has been scheduled to move from `InteractiveUtils` to `LinearAlgebra`
117+
but is already now available as `LinearAlgebra.peakflops` ([#29978]).
83118

84119
<!--- generated by NEWS-update.jl: -->
120+
[#21233]: https://github.com/JuliaLang/julia/issues/21233
121+
[#24064]: https://github.com/JuliaLang/julia/issues/24064
122+
[#25278]: https://github.com/JuliaLang/julia/issues/25278
85123
[#28156]: https://github.com/JuliaLang/julia/issues/28156
124+
[#28506]: https://github.com/JuliaLang/julia/issues/28506
125+
[#28696]: https://github.com/JuliaLang/julia/issues/28696
126+
[#28708]: https://github.com/JuliaLang/julia/issues/28708
127+
[#28745]: https://github.com/JuliaLang/julia/issues/28745
128+
[#28761]: https://github.com/JuliaLang/julia/issues/28761
129+
[#28790]: https://github.com/JuliaLang/julia/issues/28790
86130
[#28878]: https://github.com/JuliaLang/julia/issues/28878
131+
[#28902]: https://github.com/JuliaLang/julia/issues/28902
132+
[#29033]: https://github.com/JuliaLang/julia/issues/29033
133+
[#29092]: https://github.com/JuliaLang/julia/issues/29092
134+
[#29108]: https://github.com/JuliaLang/julia/issues/29108
135+
[#29127]: https://github.com/JuliaLang/julia/issues/29127
136+
[#29153]: https://github.com/JuliaLang/julia/issues/29153
137+
[#29157]: https://github.com/JuliaLang/julia/issues/29157
138+
[#29173]: https://github.com/JuliaLang/julia/issues/29173
139+
[#29178]: https://github.com/JuliaLang/julia/issues/29178
140+
[#29211]: https://github.com/JuliaLang/julia/issues/29211
141+
[#29259]: https://github.com/JuliaLang/julia/issues/29259
142+
[#29316]: https://github.com/JuliaLang/julia/issues/29316
143+
[#29429]: https://github.com/JuliaLang/julia/issues/29429
87144
[#29440]: https://github.com/JuliaLang/julia/issues/29440
88145
[#29442]: https://github.com/JuliaLang/julia/issues/29442
146+
[#29469]: https://github.com/JuliaLang/julia/issues/29469
147+
[#29506]: https://github.com/JuliaLang/julia/issues/29506
148+
[#29595]: https://github.com/JuliaLang/julia/issues/29595
149+
[#29600]: https://github.com/JuliaLang/julia/issues/29600
150+
[#29615]: https://github.com/JuliaLang/julia/issues/29615
151+
[#29636]: https://github.com/JuliaLang/julia/issues/29636
152+
[#29638]: https://github.com/JuliaLang/julia/issues/29638
153+
[#29670]: https://github.com/JuliaLang/julia/issues/29670
154+
[#29679]: https://github.com/JuliaLang/julia/issues/29679
155+
[#29733]: https://github.com/JuliaLang/julia/issues/29733
156+
[#29739]: https://github.com/JuliaLang/julia/issues/29739
157+
[#29749]: https://github.com/JuliaLang/julia/issues/29749
158+
[#29754]: https://github.com/JuliaLang/julia/issues/29754
159+
[#29781]: https://github.com/JuliaLang/julia/issues/29781
160+
[#29782]: https://github.com/JuliaLang/julia/issues/29782
161+
[#29819]: https://github.com/JuliaLang/julia/issues/29819
162+
[#29827]: https://github.com/JuliaLang/julia/issues/29827
163+
[#29845]: https://github.com/JuliaLang/julia/issues/29845
164+
[#29858]: https://github.com/JuliaLang/julia/issues/29858
165+
[#29890]: https://github.com/JuliaLang/julia/issues/29890
166+
[#29893]: https://github.com/JuliaLang/julia/issues/29893
167+
[#29907]: https://github.com/JuliaLang/julia/issues/29907
168+
[#29913]: https://github.com/JuliaLang/julia/issues/29913
169+
[#29968]: https://github.com/JuliaLang/julia/issues/29968
170+
[#29969]: https://github.com/JuliaLang/julia/issues/29969
171+
[#29978]: https://github.com/JuliaLang/julia/issues/29978
172+
[#29980]: https://github.com/JuliaLang/julia/issues/29980
173+
[#29997]: https://github.com/JuliaLang/julia/issues/29997
174+
[#30022]: https://github.com/JuliaLang/julia/issues/30022
175+
[#30035]: https://github.com/JuliaLang/julia/issues/30035
176+
[#30083]: https://github.com/JuliaLang/julia/issues/30083
177+
[#30159]: https://github.com/JuliaLang/julia/issues/30159

base/abstractarray.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,10 @@ If `dst` and `src` are of the same type, `dst == src` should hold after
647647
the call. If `dst` and `src` are multidimensional arrays, they must have
648648
equal [`axes`](@ref).
649649
See also [`copyto!`](@ref).
650+
651+
!!! compat "Julia 1.1"
652+
This method requires at least Julia 1.1. In Julia 1.0 this method
653+
is available from the `Future` standard library as `Future.copy!`.
650654
"""
651655
copy!(dst::AbstractVector, src::AbstractVector) = append!(empty!(dst), src)
652656

base/channels.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,9 @@ Append an item `v` to the channel `c`. Blocks if the channel is full.
245245
246246
For unbuffered channels, blocks until a [`take!`](@ref) is performed by a different
247247
task.
248+
249+
!!! compat "Julia 1.1"
250+
`v` now gets converted to the channel's type with [`convert`](@ref) as `put!` is called.
248251
"""
249252
function put!(c::Channel{T}, v) where T
250253
check_channel_state(c)

base/char.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ Char
5656
Return the number of code units required to encode a character as UTF-8.
5757
This is the number of bytes which will be printed if the character is written
5858
to an output stream, or `ncodeunits(string(c))` but computed efficiently.
59+
60+
!!! compat "Julia 1.1"
61+
This method requires at least Julia 1.1. In Julia 1.0 consider
62+
using `ncodeunits(string(c))`.
5963
"""
6064
ncodeunits(c::Char) = write(devnull, c) # this is surprisingly efficient
6165

base/error.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ false.
103103
Explicitly passing `task` will return the current exception stack on an
104104
arbitrary task. This is useful for inspecting tasks which have failed due to
105105
uncaught exceptions.
106+
107+
!!! compat "Julia 1.1"
108+
This function requires at least Julia 1.1.
106109
"""
107110
function catch_stack(task=current_task(); include_bt=true)
108111
raw = ccall(:jl_get_excstack, Any, (Any,Cint,Cint), task, include_bt, typemax(Cint))

base/locks.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,9 @@ Create a level-triggered event source. Tasks that call [`wait`](@ref) on an
246246
`Event` are suspended and queued until `notify` is called on the `Event`.
247247
After `notify` is called, the `Event` remains in a signaled state and
248248
tasks will no longer block when waiting for it.
249+
250+
!!! compat "Julia 1.1"
251+
This functionality requires at least Julia 1.1.
249252
"""
250253
mutable struct Event
251254
lock::Mutex

base/mpfr.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,11 @@ global precision; `convert` will always return `x`.
151151
convenience since decimal literals are converted to `Float64` when parsed, so
152152
`BigFloat(2.1)` may not yield what you expect.
153153
154+
!!! compat "Julia 1.1"
155+
`precision` as a keyword argument requires at least Julia 1.1.
156+
In Julia 1.0 `precision` is the second positional argument (`BigFloat(x, precision)`).
157+
158+
# Examples
154159
```jldoctest
155160
julia> BigFloat(2.1) # 2.1 here is a Float64
156161
2.100000000000000088817841970012523233890533447265625

base/multidimensional.jl

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,28 @@ module IteratorsMD
211211
CartesianIndex(1, 2)
212212
```
213213
214+
## Broadcasting
215+
216+
`CartesianIndices` support broadcasting arithmetic (+ and -) with a `CartesianIndex`.
217+
218+
!!! compat "Julia 1.1"
219+
Broadcasting of CartesianIndices requires at least Julia 1.1.
220+
221+
```jldoctest
222+
julia> CIs = CartesianIndices((2:3, 5:6))
223+
2×2 CartesianIndices{2,Tuple{UnitRange{Int64},UnitRange{Int64}}}:
224+
CartesianIndex(2, 5) CartesianIndex(2, 6)
225+
CartesianIndex(3, 5) CartesianIndex(3, 6)
226+
227+
julia> CI = CartesianIndex(3, 4)
228+
CartesianIndex(3, 4)
229+
230+
julia> CIs .+ CI
231+
2×2 CartesianIndices{2,Tuple{UnitRange{Int64},UnitRange{Int64}}}:
232+
CartesianIndex(5, 9) CartesianIndex(5, 10)
233+
CartesianIndex(6, 9) CartesianIndex(6, 10)
234+
```
235+
214236
For cartesian to linear index conversion, see [`LinearIndices`](@ref).
215237
"""
216238
struct CartesianIndices{N,R<:NTuple{N,AbstractUnitRange{Int}}} <: AbstractArray{CartesianIndex{N},N}
@@ -228,6 +250,26 @@ module IteratorsMD
228250

229251
CartesianIndices(A::AbstractArray) = CartesianIndices(axes(A))
230252

253+
"""
254+
(:)(I::CartesianIndex, J::CartesianIndex)
255+
256+
Construct [`CartesianIndices`](@ref) from two `CartesianIndex`.
257+
258+
!!! compat "Julia 1.1"
259+
This method requires at least Julia 1.1.
260+
261+
# Examples
262+
```jldoctest
263+
julia> I = CartesianIndex(2,1);
264+
265+
julia> J = CartesianIndex(3,3);
266+
267+
julia> I:J
268+
2×3 CartesianIndices{2,Tuple{UnitRange{Int64},UnitRange{Int64}}}:
269+
CartesianIndex(2, 1) CartesianIndex(2, 2) CartesianIndex(2, 3)
270+
CartesianIndex(3, 1) CartesianIndex(3, 2) CartesianIndex(3, 3)
271+
```
272+
"""
231273
(:)(I::CartesianIndex{N}, J::CartesianIndex{N}) where N =
232274
CartesianIndices(map((i,j) -> i:j, Tuple(I), Tuple(J)))
233275

@@ -672,6 +714,9 @@ Finite difference operator on a vector or a multidimensional array `A`. In the
672714
latter case the dimension to operate on needs to be specified with the `dims`
673715
keyword argument.
674716
717+
!!! compat "Julia 1.1"
718+
`diff` for arrays with dimension higher than 2 requires at least Julia 1.1.
719+
675720
# Examples
676721
```jldoctest
677722
julia> a = [2 4; 6 16]

base/namedtuple.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,10 @@ contains that field. Fields present in only the rightmost named tuple of a pair
223223
A fallback is implemented for when only a single named tuple is supplied,
224224
with signature `merge(a::NamedTuple)`.
225225
226+
!!! compat "Julia 1.1"
227+
Merging 3 or more `NamedTuple` requires at least Julia 1.1.
228+
229+
# Examples
226230
```jldoctest
227231
julia> merge((a=1, b=2, c=3), (b=4, d=5))
228232
(a = 1, b = 4, c = 3, d = 5)

0 commit comments

Comments
 (0)