Colour 0.4.5 is available!

The colour-science Developers are pleased to announce the release of Colour 0.4.5!

This release implements support for Python 3.13 and Numpy 2.

The highlights are as follows:

  • pygraphviz was replaced with pydot so that installation is easier.

  • We switched from Poetry to uv and hatch for managing the development environment and build our wheels.

    • uv is so good that it literally only requires uv run --with colour-science my_script.py to run a script using Colour.

Note

The other colour-science packages will be updated in the coming weeks to also use uv.
{
  "COLOUR_SCIENCE__COLOUR__SHOW_WARNINGS_WITH_TRACEBACK": "True"
}
  • Support for pathlib in IO definitions

  • Support for vK20 chromatic adaptation transform

  • Support for polar conversions to all relevant models

  • Port-based nodes and graphs for processing graphs

class NodeAdd(PortNode):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.description = "Perform the addition of the two input port values."

        self.add_input_port("a")
        self.add_input_port("b")
        self.add_output_port("output")

    def process(self):
        a = self.get_input("a")
        b = self.get_input("b")

        if a is None or b is None:
            return

        self._output_ports["output"].value = a + b

        self.dirty = False


class NodeMultiply(PortNode):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.description = "Perform the multiplication of the two input port values."

        self.add_input_port("a")
        self.add_input_port("b")
        self.add_output_port("output")

    def process(self):
        a = self.get_input("a")
        b = self.get_input("b")

        if a is None or b is None:
            return

        self._output_ports["output"].value = a * b

        self.dirty = False


node_add = NodeAdd()
node_add.set_input("a", 1)
node_add.set_input("b", 1)
node_multiply = NodeMultiply()
node_multiply.set_input("b", 2)

graph = PortGraph()

graph.add_node(node_add)
graph.add_node(node_multiply)

graph.connect(node_add, "output", node_multiply, "a")

graph.process()

print(node_multiply.get_output("output"))

Please take a look at the releases page more information.

Comments

Comments powered by Disqus