Skip to content

Commit

Permalink
Merge branch 'release/v0.2.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
KelSolaar committed Oct 12, 2024
2 parents 4ca52f1 + 3608b43 commit 8bb1291
Show file tree
Hide file tree
Showing 62 changed files with 878 additions and 1,162 deletions.
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ is available to guide the process: https://www.colour-science.org/contributing/.
- [ ] Pyright static checking has been run and passed.
- [ ] Pre-commit hooks have been run and passed.

<!-- The unit tests can be invoked with `poetry run invoke tests` -->
<!-- Pyright can be started with `pyright --skipunannotated` -->
<!-- The unit tests can be invoked with `uv run invoke tests` -->
<!-- Pyright can be started with `pyright --threads --skipunannotated` -->

**Documentation**

Expand Down
22 changes: 9 additions & 13 deletions .github/workflows/continuous-integration-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ jobs:
name: ${{ matrix.os }} - Python ${{ matrix.python-version }}
strategy:
matrix:
os: [ubuntu-22.04]
python-version: [3.12]
os: [ubuntu-latest]
python-version: [3.13]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: Environment Variables
run: |
echo "CI_PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV
Expand All @@ -22,27 +22,23 @@ jobs:
echo "COLOUR_SCIENCE__DOCUMENTATION_BUILD=True" >> $GITHUB_ENV
shell: bash
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get --yes install latexmk texlive-full
- name: Install Poetry
env:
POETRY_VERSION: 1.4.0
- name: Install uv
run: |
curl -sSL https://install.python-poetry.org | POETRY_HOME=$HOME/.poetry python3 -
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
pip install uv
shell: bash
- name: Install Package Dependencies
run: |
poetry run python -m pip install --upgrade pip
poetry install
poetry run python -c "import imageio;imageio.plugins.freeimage.download()"
uv sync --all-extras --no-dev
uv run python -c "import imageio;imageio.plugins.freeimage.download()"
shell: bash
- name: Build Documentation
run: |
poetry run invoke docs
uv run invoke docs
shell: bash
33 changes: 15 additions & 18 deletions .github/workflows/continuous-integration-quality-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,52 +7,49 @@ jobs:
name: ${{ matrix.os }} - Python ${{ matrix.python-version }}
strategy:
matrix:
os: [ubuntu-22.04]
python-version: [3.12]
os: [ubuntu-latest]
python-version: [3.13]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: Environment Variables
run: |
echo "CI_PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV
echo "CI_PACKAGE=colour_datasets" >> $GITHUB_ENV
echo "CI_SHA=${{ github.sha }}" >> $GITHUB_ENV
echo "COVERALLS_REPO_TOKEN=${{ secrets.COVERALLS_REPO_TOKEN }}" >> $GITHUB_ENV
shell: bash
- name: Set up Python 3.9 for Pre-Commit
uses: actions/setup-python@v4
- name: Set up Python 3.10 for Pre-Commit
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: "3.10"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
env:
POETRY_VERSION: 1.4.0
- name: Install uv
run: |
curl -sSL https://install.python-poetry.org | POETRY_HOME=$HOME/.poetry python3 -
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
pip install uv
shell: bash
- name: Install Package Dependencies
run: |
poetry run python -m pip install --upgrade pip
poetry install
uv sync --all-extras --no-dev
uv run python -c "import imageio;imageio.plugins.freeimage.download()"
shell: bash
- name: Pre-Commit (All Files)
run: |
poetry run pre-commit run --all-files
uv run pre-commit run --all-files
shell: bash
- name: Test Optimised Python Execution
run: |
poetry run python -OO -c "import $CI_PACKAGE"
uv run python -OO -c "import $CI_PACKAGE"
shell: bash
- name: Test with Pytest
run: |
poetry run python -W ignore -m pytest --doctest-modules --ignore=$CI_PACKAGE/examples --cov=$CI_PACKAGE $CI_PACKAGE
uv run python -W ignore -m pytest --doctest-modules --ignore=$CI_PACKAGE/examples --cov=$CI_PACKAGE $CI_PACKAGE
shell: bash
- name: Upload Coverage to coveralls.io
run: |
if [ -z "$COVERALLS_REPO_TOKEN" ]; then echo \"COVERALLS_REPO_TOKEN\" secret is undefined!; else poetry run coveralls; fi
if [ -z "$COVERALLS_REPO_TOKEN" ]; then echo \"COVERALLS_REPO_TOKEN\" secret is undefined!; else uv run coveralls; fi
shell: bash
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ jobs:
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: Environment Variables
run: |
echo "CI_PACKAGE=colour_datasets" >> $GITHUB_ENV
shell: bash
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Package Dependencies
run: |
pip install -r requirements.txt
cat requirements.txt | grep -Eo '(^[^#]+)' | xargs -n 1 pip install || true
- name: Static Type Checking
run: |
pyright --skipunannotated
pyright --threads --skipunannotated
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
.fleet
.idea
.ipynb_checkpoints
.python-version
.sandbox
.vs
.vscode
Expand All @@ -18,4 +19,4 @@ docs/_build
docs/generated
references
zenodo
poetry.lock
uv.lock
13 changes: 4 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,23 @@ repos:
- id: flynt
args: [--verbose]
- repo: https://github.com/PyCQA/isort
rev: "5.12.0"
rev: "5.13.2"
hooks:
- id: isort
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.1.6"
rev: "v0.1.14"
hooks:
- id: ruff-format
- id: ruff
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.11.0
hooks:
- id: black
language_version: python3.9
- repo: https://github.com/adamchainz/blacken-docs
rev: 1.16.0
hooks:
- id: blacken-docs
language_version: python3.9
language_version: python3.10
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.1.0"
hooks:
- id: prettier
exclude: config-aces-reference.ocio.yaml
- repo: https://github.com/pre-commit/pygrep-hooks
rev: "v1.10.0"
hooks:
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
Development & Technical Support
-------------------------------

- **Thomas Mansencal**, *Technology Supervisor @ Wētā FX*
- **Thomas Mansencal**, *Principal Pipeline Programmer @ Epic Games*

Project coordination, overall development.

Expand Down
14 changes: 7 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Colour - Datasets
:target: https://coveralls.io/r/colour-science/colour-datasets
:alt: Coverage Status
.. |codacy| image:: https://img.shields.io/codacy/grade/83345fbde65545d2a4499f32e72866ed/develop.svg?style=flat-square
:target: https://www.codacy.com/app/colour-science/colour-datasets
:target: https://app.codacy.com/gh/colour-science/colour-datasets
:alt: Code Grade
.. |version| image:: https://img.shields.io/pypi/v/colour-datasets.svg?style=flat-square
:target: https://pypi.org/project/colour-datasets
Expand Down Expand Up @@ -44,7 +44,7 @@ when trying to access or use colour science datasets:

- No straightforward ingestion path for dataset content.
- No simple loading mechanism for dataset content.
- Unavailability of the dataset, e.g. download url is down, dataset content is
- Unavailability of the dataset, e.g., download url is down, dataset content is
passed directly from hand to hand.
- No information regarding the definitive origination of the dataset.

Expand Down Expand Up @@ -160,14 +160,14 @@ Primary Dependencies

**Colour - Datasets** requires various dependencies in order to run:

- `python >= 3.9, < 4 <https://www.python.org/download/releases>`__
- `python >= 3.10, < 3.14 <https://www.python.org/download/releases>`__
- `cachetools <https://pypi.org/project/cachetools>`__
- `colour-science >= 4.3 <https://pypi.org/project/colour-science>`__
- `colour-science >= 4.4 <https://pypi.org/project/colour-science>`__
- `imageio >= 2, < 3 <https://imageio.github.io>`__
- `numpy >= 1.22, < 2 <https://pypi.org/project/numpy>`__
- `scipy >= 1.8, < 2 <https://pypi.org/project/scipy>`__
- `numpy >= 1.24, < 3 <https://pypi.org/project/numpy>`__
- `scipy >= 1.10, < 2 <https://pypi.org/project/scipy>`__
- `tqdm <https://pypi.org/project/tqdm>`__
- `xlrd <https://pypi.org/project/xlrd>`__
- `xlrd >=1.2, <2 <https://pypi.org/project/xlrd>`__

Pypi
~~~~
Expand Down
14 changes: 7 additions & 7 deletions TODO.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,34 @@ TODO

- colour_datasets/__init__.py

- Line 78 : # TODO: Remove legacy printing support when deemed appropriate.
- Line 74 : # TODO: Remove legacy printing support when deemed appropriate.


- colour_datasets/records/zenodo.py

- Line 450 : # TODO: Remove the following space escaping: The new Zenodo API is not quoting filenames properly thus we are temporarily escaping spaces for now. https://github.com/colour-science/colour-datasets/issues/ 36issuecomment-1773464695
- Line 433 : # TODO: Remove the following space escaping: The new Zenodo API is not quoting filenames properly thus we are temporarily escaping spaces for now. https://github.com/colour-science/colour-datasets/issues/ 36issuecomment-1773464695


- colour_datasets/utilities/common.py

- Line 42 : # TODO: Use *colour* definition.
- Line 43 : # TODO: Use *colour* definition.


- colour_datasets/loaders/kuopio.py

- Line 310 : # TODO: Implement support for *Natural Colors*: https://sandbox.zenodo.org/record/315640 http://www.uef.fi/web/spectral/natural-colors
- Line 304 : # TODO: Implement support for *Natural Colors*: https://sandbox.zenodo.org/record/315640 http://www.uef.fi/web/spectral/natural-colors


- colour_datasets/loaders/xrite2016.py

- Line 109 : # TODO: Implement support for "CGATS" file format in "Colour": https://github.com/colour-science/colour/issues/354
- Line 108 : # TODO: Implement support for "CGATS" file format in "Colour": https://github.com/colour-science/colour/issues/354


- colour_datasets/loaders/dyer2017.py

- Line 141 : # TODO: Re-instate "manufacturer", "model", "illuminant" and "type" attributes according to outcome of https://github.com/ampas/rawtoaces/issues/114. Those attributes are currently stored in "self._kwargs".
- Line 928 : # TODO: Re-instate "manufacturer", "model", "illuminant" and "type" attributes according to outcome of https://github.com/ampas/rawtoaces/issues/114.
- Line 1430 : # TODO: Re-instate "manufacturer", "model", "illuminant" and "type" attributes according to outcome of https://github.com/ampas/rawtoaces/issues/114.
- Line 923 : # TODO: Re-instate "manufacturer", "model", "illuminant" and "type" attributes according to outcome of https://github.com/ampas/rawtoaces/issues/114.
- Line 1420 : # TODO: Re-instate "manufacturer", "model", "illuminant" and "type" attributes according to outcome of https://github.com/ampas/rawtoaces/issues/114.

About
-----
Expand Down
10 changes: 3 additions & 7 deletions colour_datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,8 @@

__major_version__ = "0"
__minor_version__ = "2"
__change_version__ = "5"
__version__ = ".".join(
(__major_version__, __minor_version__, __change_version__)
)
__change_version__ = "6"
__version__ = ".".join((__major_version__, __minor_version__, __change_version__))

try:
_version = (
Expand All @@ -69,9 +67,7 @@
except Exception:
_version = __version__

colour.utilities.ANCILLARY_COLOUR_SCIENCE_PACKAGES[ # pyright: ignore
"colour-datasets"
] = _version
colour.utilities.ANCILLARY_COLOUR_SCIENCE_PACKAGES["colour-datasets"] = _version # pyright: ignore

del _version

Expand Down
2 changes: 1 addition & 1 deletion colour_datasets/examples/examples_load.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Showcases *Colour - Datasets* loading."""
"""Showcase *Colour - Datasets* loading."""

from colour.utilities import message_box

Expand Down
12 changes: 4 additions & 8 deletions colour_datasets/loaders/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,13 @@

def load(dataset: int | str) -> Any:
"""
Load given dataset: The dataset is pulled locally, i.e. synced if required
Load given dataset: The dataset is pulled locally, i.e., synced if required
and then its data is loaded.
Parameters
----------
dataset
Dataset id, i.e. the *Zenodo* record number or title.
Dataset id, i.e., the *Zenodo* record number or title.
Returns
-------
Expand All @@ -156,9 +156,7 @@ def load(dataset: int | str) -> Any:
>>> len(load("3245883").keys()) # doctest: +SKIP
28
>>> len(
... load(
... "Camera Spectral Sensitivity Database - " "Jiang et al. (2013)"
... ).keys()
... load("Camera Spectral Sensitivity Database - " "Jiang et al. (2013)").keys()
... )
... # doctest: +SKIP
28
Expand All @@ -174,9 +172,7 @@ def load(dataset: int | str) -> Any:

title = dataset_loader.title
if title in DATASET_LOADERS:
warning(
f'"{title}" key is already defined in the dataset loaders!'
)
warning(f'"{title}" key is already defined in the dataset loaders!')
DATASET_LOADERS[title] = DATASET_LOADERS[key]
_HAS_TITLE_KEYS = True

Expand Down
10 changes: 5 additions & 5 deletions colour_datasets/loaders/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Abstract Dataset Loader
=======================
Defines the abstract class implementing support for dataset loading:
Define the abstract class implementing support for dataset loading:
- :class:`colour_datasets.loaders.AbstractDatasetLoader`
"""
Expand Down Expand Up @@ -59,7 +59,7 @@ class AbstractDatasetLoader(ABC):
"""

ID: str = "Undefined"
"""Dataset record id, i.e. the *Zenodo* record number."""
"""Dataset record id, i.e., the *Zenodo* record number."""

def __init__(self, record: Record) -> None:
self._record: Record = record
Expand All @@ -79,7 +79,7 @@ def record(self) -> Record:
return self._record

@property
def id(self) -> str: # noqa: A003
def id(self) -> str:
"""
Getter property for the dataset id.
Expand Down Expand Up @@ -119,12 +119,12 @@ def load(self) -> Any:
-----
- Sub-classes are required to call
:meth:`colour_datasets.loaders.AbstractDatasetLoader.sync` method
when they implement it, e.g. ``super().sync()``.
when they implement it, e.g., ``super().sync()``.
"""

def sync(self):
"""
Sync the dataset content, i.e. checks whether it is synced and pulls
Sync the dataset content, i.e., checks whether it is synced and pulls
it if required.
"""

Expand Down
Loading

0 comments on commit 8bb1291

Please sign in to comment.