Skip to content

Commit

Permalink
Remove deprecated items (#425)
Browse files Browse the repository at this point in the history
- Remove deprecated parameter `model` in ∆E CAM16.
- Remove deprecated `npow` function in algebra.
  • Loading branch information
facelessuser authored Aug 5, 2024
1 parent fdfd7bf commit b28f2c5
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 35 deletions.
2 changes: 1 addition & 1 deletion coloraide/__meta__.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,5 +193,5 @@ def parse_version(ver: str) -> Version:
return Version(major, minor, micro, release, pre, post, dev)


__version_info__ = Version(3, 4, 0, "final")
__version_info__ = Version(4, 0, 0, "final")
__version__ = __version_info__._get_canonical()
8 changes: 0 additions & 8 deletions coloraide/algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import operator
import functools
import itertools as it
from .deprecate import deprecated
from .types import (
ArrayLike, MatrixLike, VectorLike, TensorLike, Array, Matrix, Tensor, Vector, VectorBool, MatrixBool, TensorBool,
MatrixInt, MathType, Shape, ShapeLike, DimHints, SupportsFloatOrInt
Expand Down Expand Up @@ -181,13 +180,6 @@ def spow(base: float, exp: float) -> float:
return math.copysign(abs(base) ** exp, base)


@deprecated("'npow' has been renamed to 'spow' (signed power), please migrate to avoid future issues.")
def npow(base: float, exp: float) -> float: # pragma: no cover
"""Signed power."""

return spow(base, exp)


def rect_to_polar(a: float, b: float) -> tuple[float, float]:
"""Take rectangular coordinates and make them polar."""

Expand Down
24 changes: 5 additions & 19 deletions coloraide/distance/delta_e_cam16.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,13 @@
from __future__ import annotations
import math
from ..distance import DeltaE
from ..deprecate import warn_deprecated
from typing import Any, TYPE_CHECKING
from ..spaces.cam16_ucs import COEFFICENTS, CAM16UCS

if TYPE_CHECKING: # pragma: no cover
from ..color import Color


WARN_MSG = (
"The 'model' parameter is now deprecated, please specify the CAM16 UCS/LCD/SCD space name via 'space' instead"
)


class DECAM16(DeltaE):
"""Delta E CAM16 class."""

Expand All @@ -29,24 +23,16 @@ def distance(
color: Color,
sample: Color,
space: str = "cam16-ucs",
model: str | None = None,
**kwargs: Any
) -> float:
"""Delta E CAM16 color distance formula."""

# Legacy approach to specifying CAM16 approach
if model is not None: # pragma: no cover
warn_deprecated(WARN_MSG)
space = f'cam16-{model}'
kl = COEFFICENTS[model][0]

# Normal approach to specifying CAM16 target space
else:
cs = color.CS_MAP[space]
if not isinstance(color.CS_MAP[space], CAM16UCS):
raise ValueError("Distance color space must be derived from CAM16UCS.")
model = cs.MODEL # type: ignore[attr-defined]
kl = COEFFICENTS[model][0]
cs = color.CS_MAP[space]
if not isinstance(color.CS_MAP[space], CAM16UCS):
raise ValueError("Distance color space must be derived from CAM16UCS.")
model = cs.MODEL # type: ignore[attr-defined]
kl = COEFFICENTS[model][0]

j1, a1, b1 = color.convert(space).coords(nans=False)
j2, a2, b2 = sample.convert(space).coords(nans=False)
Expand Down
4 changes: 3 additions & 1 deletion docs/src/markdown/about/changelog.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Changelog

## 3.4
## 4.0

- **NEW**: Officially support Python 3.13.
- **NEW**: Remove deprecated `model` parameter from `cam16` ∆E method. Space should be used instead.
- **NEW**: Remove deprecated `npow` function. `spow` should be used instead.
- **BREAK**: Finalize the `raytrace` gamut mapping algorithm implementation and remove experimental label.

- Remove deprecated `lab` parameter from experimental `raytrace` gamut mapping method. Users should use
Expand Down
2 changes: 1 addition & 1 deletion docs/src/markdown/demos/3d_models.html
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ <h1>ColorAide Color Space Models</h1>
let colorSpaces = null
let colorGamuts = null
let lastModel = null
let package = 'coloraide-3.4-py3-none-any.whl'
let package = 'coloraide-4.0-py3-none-any.whl'
const defaultSpace = 'lab'
const defaultGamut = 'srgb'
const exceptions = new Set(['hwb', 'ryb', 'ryb-biased'])
Expand Down
2 changes: 1 addition & 1 deletion docs/src/markdown/demos/colorpicker.html
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ <h1>ColorAide Color Picker</h1>
let pyodide = null
let webspace = ''
let initial = 'oklab(0.69 0.13 -0.1 / 0.85)'
let package = 'coloraide-3.4-py3-none-any.whl'
let package = 'coloraide-4.0-py3-none-any.whl'

const base = `${window.location.origin}/${window.location.pathname.split('/')[1]}/playground/`
package = base + package
Expand Down
2 changes: 1 addition & 1 deletion docs/src/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ extra_css:
- assets/coloraide-extras/extra.css
extra_javascript:
- https://unpkg.com/mermaid@10.6.1/dist/mermaid.min.js
- playground-config-0c64f02c.js
- playground-config-4eaa56ea.js
- https://cdn.jsdelivr.net/pyodide/v0.25.1/full/pyodide.js
- assets/coloraide-extras/extra-notebook.js

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var colorNotebook = {
"playgroundWheels": ['pygments-2.17.2-py3-none-any.whl', 'coloraide-3.4-py3-none-any.whl'],
"notebookWheels": ['pyyaml', 'Markdown-3.6-py3-none-any.whl', 'pymdown_extensions-10.8-py3-none-any.whl', 'pygments-2.17.2-py3-none-any.whl', 'coloraide-3.4-py3-none-any.whl'],
"playgroundWheels": ['pygments-2.17.2-py3-none-any.whl', 'coloraide-4.0-py3-none-any.whl'],
"notebookWheels": ['pyyaml', 'Markdown-3.6-py3-none-any.whl', 'pymdown_extensions-10.8-py3-none-any.whl', 'pygments-2.17.2-py3-none-any.whl', 'coloraide-4.0-py3-none-any.whl'],
"defaultPlayground": "import coloraide\ncoloraide.__version__\nColor('red')"
}
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ extra_css:
- assets/coloraide-extras/extra-696a2734c9.css
extra_javascript:
- https://unpkg.com/mermaid@10.6.1/dist/mermaid.min.js
- playground-config-0c64f02c.js
- playground-config-4eaa56ea.js
- https://cdn.jsdelivr.net/pyodide/v0.25.1/full/pyodide.js
- assets/coloraide-extras/extra-notebook-DLoJlANo.js

Expand Down

0 comments on commit b28f2c5

Please sign in to comment.