Skip to content

Implement support for Python Array API Standard in Colour #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
MichaelMauderer opened this issue May 29, 2025 · 0 comments
Open

Implement support for Python Array API Standard in Colour #14

MichaelMauderer opened this issue May 29, 2025 · 0 comments

Comments

@MichaelMauderer
Copy link

Project

Colour

Summary

The Python Array API Standard enables algorithms to be implemented independently of specific numeric computation libraries, allowing for performance optimisations and GPU support. This project will implement support for the Python Array API Standard in Colour, making the library faster and more versatile by enabling the use of different backends like NumPy (numpy.ndarray), CuPy (cupy.ndarray), Pytorch (torch.Tensor) and others.

submitter

Michael Mauderer

project lead

@KelSolaar

Community benefit

What will be the impact to the community if this project gets funded?
Colour is the leading open-source Python library for colour science, providing a comprehensive suite of algorithms, datasets, and tools for colour transformation, visualisation, and analysis. With 2.3k GitHub stars, a Discord community of 88 members, and $2,620 in yearly donations on Open Collective, it has become an essential resource for researchers, artists, and industry professionals working with colour.

This proposal addresses a performance limitation that currently restricts Colour's adoption in computationally intensive workflows, e.g., for processing video streams or data for use in machine learning and deep learning.
By implementing support for the Python Array API Standard, we will enable Colour to work with multiple numerical computation backends beyond NumPy, including those with GPU acceleration like CuPy or PyTorch. Especially, support for PyTorch has been requested multiple times by members of the Colour community.

Benefits for the Project: The colour code will be able to operate on data from a wider range of libraries, instead of only NumPy arrays, e.g., CuPy (cupy.ndarray), PyTorch (torch.Tensor). This allows Colour to be used in performance critical workflows where right now copying data to/from NumPy is too penalizing.

Benefits for the Research Community: Scientists working with large datasets or complex colour transformations will benefit from significantly faster processing times, enabling more ambitious research projects.

Benefits for the Film and Media Industry: Professional colourists and VFX artists who process high-resolution imagery will gain the ability to leverage GPU acceleration, dramatically improving workflow efficiency.

This feature has been requested by the community, as evidenced by a long-standing GitHub issue (#1244). We also had a GSoC project on implementing support for CuPy, but we were unable to merge these, as they were too backend-specific and not easily generalisable at the time. Some other groundwork for being backend agnostic has already been laid (e.g. an attempt to convert the codebase to allow the use of JAX). With this funding, we can complete the implementation and deliver a robust, well-tested solution that will benefit the entire colour science ecosystem.

By making Colour compatible with the Python Array API Standard, we're not just improving one library, we're contributing to the broader movement toward backend-agnostic scientific computing in Python, ensuring that Colour remains relevant and performant as the ecosystem evolves.

Amount requested

10000

Execution plan

Summary

The requested funding will be used to cover:

  • Developer time for design, coding, testing, benchmarking, and integration of the new code
  • Creation of supporting documentation and examples
  • Performance testing with different backends (NumPy, CuPy, PyTorch, etc.)
  • Coordination with the community for feedback and iterative improvement

Deliverables and Timeline

The main deliverable of this proposal is a production-grade implementation of the Python Array API Standard in Colour. This involves:

  1. Initial Design and Architecture (1-2 weeks)

    • Review and build upon existing groundwork and discussions
    • Design the architecture for integrating the Array API Standard
    • Create a prototype implementation/refactoring for some core methods
  2. Implementation of Core Components (4-6 weeks)

    • Refactor existing NumPy-dependent code to use the Array API Standard
    • Implement tests checking compatibility with different backends (NumPy, CuPy, PyTorch, etc.)
    • Create a consistent developer experience for different backends
  3. Testing and Benchmarking (2-3 weeks)

    • Develop test suite for supported backends
    • Benchmark performance across different backends
    • Identify and optimise performance bottlenecks
  4. Documentation and Examples (2 weeks)

    • Create user guides for using different backends
    • Develop example notebooks demonstrating performance improvements
    • Update API documentation to reflect new capabilities
  5. Community Engagement (Throughout)

    • Regular updates to the community via GitHub and Discord
    • Collect and incorporate feedback from early adopters
    • Coordinate with maintainers for smooth integration

Who Will Implement

The implementation will be led by Michael Mauderer, a long-standing project member with extensive experience in colour science and Python development. Michael will work closely with the core Colour development team and the community to ensure the implementation meets the needs of all stakeholders.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant