Skip to content

Commit

Permalink
Merge branch 'release/v0.1.15'
Browse files Browse the repository at this point in the history
  • Loading branch information
KelSolaar committed Jan 21, 2023
2 parents 71fae72 + a7692ad commit fc128f2
Show file tree
Hide file tree
Showing 10 changed files with 140 additions and 152 deletions.
17 changes: 11 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v2.32.0
rev: v3.2.2
hooks:
- id: pyupgrade
args: [--py38-plus]
args: [--py39-plus]
- repo: https://github.com/ikamensh/flynt/
rev: '0.76'
rev: '0.77'
hooks:
- id: flynt
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 22.10.0
hooks:
- id: black
language_version: python3.8
language_version: python3.9
- repo: https://github.com/keewis/blackdoc
rev: v0.3.8
hooks:
- id: blackdoc
language_version: python3.9
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
rev: 6.0.0
hooks:
- id: flake8
- repo: https://github.com/pycqa/pydocstyle
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Contributors
Colour - Dash
-------------

- **Thomas Mansencal**, *Lead Pipeline Developer @ WetaFX*
- **Thomas Mansencal**, *Technology Supervisor @ Wētā FX*

Project coordination, writing.

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.8
FROM python:3.11

WORKDIR /tmp
COPY ./requirements.txt /tmp
Expand Down
2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

__major_version__ = "0"
__minor_version__ = "1"
__change_version__ = "14"
__change_version__ = "15"
__version__ = ".".join(
(__major_version__, __minor_version__, __change_version__)
)
Expand Down
17 changes: 10 additions & 7 deletions apps/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
======
"""

import colour
from colour.adaptation import CHROMATIC_ADAPTATION_TRANSFORMS
from colour.colorimetry import CCS_ILLUMINANTS
from colour.models import RGB_COLOURSPACES
from colour.utilities import as_float_array

from colour.hints import ArrayLike, Dict, Integer, Iterable, List
from colour.hints import ArrayLike, Dict, Iterable, List

__author__ = "Colour Developers"
__copyright__ = "Copyright 2018 Colour Developers"
Expand All @@ -24,7 +27,7 @@

RGB_COLOURSPACE_OPTIONS: List[Dict] = [
{"label": key, "value": key}
for key in sorted(colour.RGB_COLOURSPACES.keys())
for key in sorted(RGB_COLOURSPACES.keys())
if key not in ("aces", "adobe1998", "prophoto")
]
"""
Expand All @@ -33,7 +36,7 @@

CHROMATIC_ADAPTATION_TRANSFORM_OPTIONS: List[Dict] = [
{"label": key, "value": key}
for key in sorted(colour.CHROMATIC_ADAPTATION_TRANSFORMS.keys())
for key in sorted(CHROMATIC_ADAPTATION_TRANSFORMS.keys())
]
"""
*Chromatic adaptation transform* options for a :class:`Dropdown` class
Expand All @@ -43,7 +46,7 @@
ILLUMINANTS_OPTIONS: List[Dict] = [
{"label": key, "value": key}
for key in sorted(
colour.CCS_ILLUMINANTS["CIE 1931 2 Degree Standard Observer"].keys()
CCS_ILLUMINANTS["CIE 1931 2 Degree Standard Observer"].keys()
)
]
"""
Expand All @@ -69,7 +72,7 @@
"""


def nuke_format_matrix(M: ArrayLike, decimals: Integer = 10) -> str:
def nuke_format_matrix(M: ArrayLike, decimals: int = 10) -> str:
"""
Format given matrix for usage in *The Foundry Nuke*, i.e. *TCL* code for
a *ColorMatrix* node.
Expand All @@ -87,7 +90,7 @@ def nuke_format_matrix(M: ArrayLike, decimals: Integer = 10) -> str:
*The Foundry Nuke* formatted matrix.
"""

M = colour.utilities.as_float_array(M)
M = as_float_array(M)

def pretty(x: Iterable) -> str:
"""Prettify given number."""
Expand Down
21 changes: 10 additions & 11 deletions apps/rgb_colourspace_chromatically_adapted_primaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
from dash.dependencies import Input, Output
from dash.html import A, Code, Div, H3, H5, Li, Pre, Ul

import colour
from colour.hints import Integer
from colour.colorimetry import CCS_ILLUMINANTS
from colour.models import RGB_COLOURSPACES, chromatically_adapted_primaries
from colour.utilities import numpy_print_options

from app import APP, SERVER_URL
from apps.common import (
Expand Down Expand Up @@ -55,7 +56,7 @@
App description.
"""

APP_UID: Integer = hash(APP_NAME)
APP_UID: int = hash(APP_NAME)
"""
App unique id.
"""
Expand Down Expand Up @@ -179,7 +180,7 @@ def set_primaries_output(
illuminant: str,
chromatic_adaptation_transform: str,
formatter: str,
decimals: Integer,
decimals: int,
) -> str:
"""
Compute and write the chromatically adapted *primaries *of the given
Expand Down Expand Up @@ -207,16 +208,14 @@ def set_primaries_output(
Chromatically adapted *primaries*.
"""

P = colour.chromatically_adapted_primaries(
colour.RGB_COLOURSPACES[colourspace].primaries,
colour.RGB_COLOURSPACES[colourspace].whitepoint,
colour.CCS_ILLUMINANTS["CIE 1931 2 Degree Standard Observer"][
illuminant
],
P = chromatically_adapted_primaries(
RGB_COLOURSPACES[colourspace].primaries,
RGB_COLOURSPACES[colourspace].whitepoint,
CCS_ILLUMINANTS["CIE 1931 2 Degree Standard Observer"][illuminant],
chromatic_adaptation_transform,
)

with colour.utilities.numpy_print_options(
with numpy_print_options(
formatter={"float": f"{{: 0.{decimals}f}}".format},
threshold=sys.maxsize,
):
Expand Down
16 changes: 8 additions & 8 deletions apps/rgb_colourspace_transformation_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from dash.dependencies import Input, Output
from dash.html import A, Code, Div, H3, H5, Li, Pre, Ul

import colour
from colour.hints import Integer
from colour.models import RGB_COLOURSPACES, matrix_RGB_to_RGB
from colour.utilities import numpy_print_options

from app import APP, SERVER_URL
from apps.common import (
Expand Down Expand Up @@ -57,7 +57,7 @@
App description.
"""

APP_UID: Integer = hash(APP_NAME)
APP_UID: int = hash(APP_NAME)
"""
App unique id.
"""
Expand Down Expand Up @@ -190,7 +190,7 @@ def set_RGB_to_RGB_matrix_output(
output_colourspace: str,
chromatic_adaptation_transform: str,
formatter: str,
decimals: Integer,
decimals: int,
) -> str:
"""
Compute and write the colour transformation matrix from given input *RGB*
Expand All @@ -217,13 +217,13 @@ def set_RGB_to_RGB_matrix_output(
Colour transformation matrix.
"""

M = colour.matrix_RGB_to_RGB(
colour.RGB_COLOURSPACES[input_colourspace],
colour.RGB_COLOURSPACES[output_colourspace],
M = matrix_RGB_to_RGB(
RGB_COLOURSPACES[input_colourspace],
RGB_COLOURSPACES[output_colourspace],
chromatic_adaptation_transform,
)

with colour.utilities.numpy_print_options(
with numpy_print_options(
formatter={"float": f"{{: 0.{decimals}f}}".format},
threshold=sys.maxsize,
):
Expand Down
35 changes: 23 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "colour-dash"
version = "0.1.14"
version = "0.1.15"
description = "Various colour science Dash apps built on top of Colour"
license = "BSD-3-Clause"
authors = [ "Colour Developers <[email protected]>" ]
Expand Down Expand Up @@ -39,46 +39,51 @@ classifiers = [
]

[tool.poetry.dependencies]
python = ">= 3.8, < 3.11"
colour-science = ">= 0.4.0"
python = ">= 3.9, < 3.12"
colour-science = ">= 0.4.2"
imageio = ">= 2, < 3"
numpy = ">= 1.19, < 2"
scipy = ">= 1.5, < 2"
numpy = ">= 1.20, < 2"
scipy = ">= 1.7, < 2"
dash = "*"
dash-renderer = "*"
gunicorn = "*"
plotly = "*"

black = { version = "*", optional = true } # Development dependency.
blackdoc = { version = "*", optional = true } # Development dependency.
coverage = { version = "!= 6.3", optional = true } # Development dependency.
coveralls = { version = "*", optional = true } # Development dependency.
flake8 = { version = "*", optional = true } # Development dependency.
flynt = { version = "*", optional = true } # Development dependency.
invoke = { version = "*", optional = true } # Development dependency.
mypy = { version = "*", optional = true } # Development dependency.
pre-commit = { version = "*", optional = true } # Development dependency.
pydocstyle = { version = "*", optional = true } # Development dependency.
pyright = { version = "*", optional = true } # Development dependency.
pytest = { version = "*", optional = true } # Development dependency.
pytest-cov = { version = "*", optional = true } # Development dependency.
pytest-xdist = { version = "*", optional = true } # Development dependency.
pyupgrade = { version = "*", optional = true } # Development dependency.

[tool.poetry.dev-dependencies]
black = "*"
blackdoc = "*"
coverage = "*"
coveralls = "*"
flake8 = "*"
flynt = "*"
invoke = "*"
mypy = "*"
pre-commit = "*"
pydocstyle = "*"
pyright = "*"
pytest = "*"
pytest-cov = "*"
pytest-xdist = "*"
pyupgrade = "*"

[tool.poetry.extras]
development = [
"black",
"blackdoc",
"coverage",
"coveralls",
"flake8",
Expand All @@ -87,8 +92,10 @@ development = [
"mypy",
"pre-commit",
"pydocstyle",
"pyright",
"pytest",
"pytest-cov",
"pytest-xdist",
"pyupgrade",
]

Expand All @@ -97,7 +104,6 @@ line-length = 79
exclude = '''
/(
\.git
| \.mypy_cache
| build
| dist
)/
Expand All @@ -106,14 +112,19 @@ exclude = '''
[tool.flynt]
line_length=999

[tool.mypy]
plugins = "numpy.typing.mypy_plugin"
ignore_missing_imports = true

[tool.pydocstyle]
convention = "numpy"
add-ignore = "D104,D200,D202,D205,D301,D400"

[tool.pyright]
reportMissingImports = false
reportMissingModuleSource = false
reportUnboundVariable = false
reportUnnecessaryCast = true
reportUnnecessaryTypeIgnoreComment = true
reportUnsupportedDunderAll = false
reportUnusedExpression = false

[build-system]
requires = [ "poetry_core>=1.0.0" ]
build-backend = "poetry.core.masonry.api"
Loading

0 comments on commit fc128f2

Please sign in to comment.