Skip to content

Commit

Permalink
Transition to noisy depwarn for abs2 (#180)
Browse files Browse the repository at this point in the history
This is part of the plan for changing the value returned by `abs2`.
This stage is designed to catch user-level scripts which may not
run with `--depwarn=yes`.
  • Loading branch information
timholy authored May 22, 2022
1 parent 2327432 commit 8ec1d35
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "ColorVectorSpace"
uuid = "c3611d14-8923-5661-9e6a-0046d554d3a4"
version = "0.9.8"
version = "0.9.9"

[deps]
ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@ We anticipate the following transition schedule:
- Sept 21, 2021: release ColorVectorSpace 0.9.7 with both `abs2` and `Future.abs2`.
`abs2` will have a "quiet" deprecation warning (visible with `--depwarn=yes`
or when running `Pkg.test`)
- Jan 1, 2022: make the deprecation warning "noisy" (cannot be turned off).
- May 19, 2022: make the deprecation warning "noisy" (cannot be turned off).
This is designed to catch user-level scripts that may need to update thresholds
or other constants.
- *Apr 1, 2022: transition `abs2` to the new definition
- *July 1, 2022: transition `abs2` to the new definition
and make `Future.abs2` give a "noisy" depwarn to revert to regular `abs2`.
- *July 1, 2022: remove `Future.abs2`.
- *Dec 1, 2022: remove `Future.abs2`.

The two marked with `*` denote breaking releases.
8 changes: 7 additions & 1 deletion src/ColorVectorSpace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ export RGBRGB, complement, nan, dotc, dot, ⋅, hadamard, ⊙, tensor, ⊗, norm

MathTypes{T,C<:Union{AbstractGray{T},AbstractRGB{T}}} = Union{C,TransparentColor{C,T}}

if Base.VERSION >= v"1.5"
@inline _depwarn(msg, funcsym; force=false) = Base.depwarn(msg, funcsym; force=force)
else
@inline _depwarn(msg, funcsym; force=false) = Base.depwarn(msg, funcsym)
end

## Version compatibility with ColorTypes
### TODO: Remove the definitons other than `one` when dropping ColorTypes v0.10 support

Expand Down Expand Up @@ -487,7 +493,7 @@ Base.length(r::StepRange{<:AbstractGray}) = length(StepRange(gray

Base.abs2(g::AbstractGray) = abs2(gray(g))
function Base.abs2(c::AbstractRGB)
Base.depwarn("""
_depwarn("""
The return value of `abs2` will change to ensure that `abs2(g::Gray) ≈ abs2(RGB(g::Gray))`.
For `RGB` colors, this results in dividing the previous output by 3.
Expand Down

2 comments on commit 8ec1d35

@timholy
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/60795

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.9.9 -m "<description of version>" 8ec1d3549cab5064be2f09b8bb8de6f502c9c2ba
git push origin v0.9.9

Please sign in to comment.