Skip to content

Commit

Permalink
Merge branch 'release/v0.2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
KelSolaar committed Aug 30, 2023
2 parents e08633b + 3a41452 commit d979071
Show file tree
Hide file tree
Showing 66 changed files with 2,001 additions and 2,173 deletions.
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[run]
source = colour_datasets
sigterm = True
[report]
exclude_lines =
pragma: no cover
Expand Down
3 changes: 0 additions & 3 deletions .flake8

This file was deleted.

4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ is available to guide the process: https://www.colour-science.org/contributing/.
**Code Style and Quality**

- [ ] Unit tests have been implemented and passed.
- [ ] Mypy static checking has been run and passed.
- [ ] 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` -->
<!-- Mypy can be started with `dmypy run -- --show-error-codes --warn-unused-ignores --warn-redundant-casts --install-types --non-interactive -p colour-datasets` -->
<!-- Pyright can be started with `pyright --skipunannotated` -->

**Documentation**

Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/continuous-integration-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,16 @@ jobs:
sudo apt-get update
sudo apt-get --yes install latexmk texlive-full
- name: Install Poetry
env:
POETRY_VERSION: 1.4.0
run: |
curl -sSL https://install.python-poetry.org | POETRY_HOME=$HOME/.poetry python3 -
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
shell: bash
- name: Install Package Dependencies
run: |
poetry run python -m pip install --upgrade pip
poetry install --extras "read-the-docs"
poetry install
poetry run python -c "import imageio;imageio.plugins.freeimage.download()"
shell: bash
- name: Build Documentation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
env:
POETRY_VERSION: 1.4.0
run: |
curl -sSL https://install.python-poetry.org | POETRY_HOME=$HOME/.poetry python3 -
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
Expand All @@ -48,7 +50,7 @@ jobs:
shell: bash
- name: Test with Pytest
run: |
poetry run python -W ignore -m pytest --disable-warnings --doctest-modules --ignore=$CI_PACKAGE/examples --cov=$CI_PACKAGE $CI_PACKAGE
poetry 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: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ jobs:
pip install -r requirements.txt
- name: Static Type Checking
run: |
mypy --install-types --non-interactive --show-error-codes --warn-unused-ignores --warn-redundant-casts $CI_PACKAGE
pyright --skipunannotated
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
*.pyc
*.pyo
.DS_Store
.coverage
.dmypy.json
.coverage*
.fleet
.idea
.ipynb_checkpoints
.mypy_cache
.sandbox
.vs
.vscode
Expand Down
24 changes: 6 additions & 18 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v3.2.2
hooks:
- id: pyupgrade
args: [--py39-plus]
- repo: https://github.com/ikamensh/flynt/
rev: '0.77'
rev: '1.0.1'
hooks:
- id: flynt
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.285'
hooks:
- id: ruff
- repo: https://github.com/psf/black
rev: 22.10.0
rev: 23.7.0
hooks:
- id: black
language_version: python3.9
Expand All @@ -18,14 +17,3 @@ repos:
hooks:
- id: blackdoc
language_version: python3.9
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
- repo: https://github.com/pycqa/pydocstyle
rev: 6.1.1
hooks:
- id: pydocstyle
args:
- --convention=numpy
- --add-ignore=D104,D200,D202,D205,D301,D400
7 changes: 2 additions & 5 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,5 @@ formats:
- pdf

python:
install:
- method: pip
path: .
extra_requirements:
- read-the-docs
install:
- requirements: docs/requirements.txt
2 changes: 1 addition & 1 deletion CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ About

| **Colour - Datasets** by Colour Developers
| Copyright 2019 Colour Developers – `[email protected] <[email protected]>`__
| This software is released under terms of New BSD License: https://opensource.org/licenses/BSD-3-Clause
| This software is released under terms of BSD-3-Clause: https://opensource.org/licenses/BSD-3-Clause
| `https://github.com/colour-science/colour-datasets <https://github.com/colour-science/colour-datasets>`__
30 changes: 7 additions & 23 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,27 +1,11 @@
Copyright 2019 Colour Developers
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Colour Developers nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL COLOUR DEVELOPERS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

Copyright for portions of project openpyxl are held by Openpyxl Developers,
2010 as part of project openpyxl distributed under the MIT Licence.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
30 changes: 15 additions & 15 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Colour - Datasets
|actions| |coveralls| |codacy| |version|

.. |actions| image:: https://img.shields.io/github/workflow/status/colour-science/colour-datasets/Continuous%20Integration%20-%20Quality%20&%20Unit%20Tests?label=actions&logo=github&style=flat-square
.. |actions| image:: https://img.shields.io/github/actions/workflow/status/colour-science/colour-datasets/.github/workflows/continuous-integration-quality-unit-tests.yml?branch=develop&style=flat-square
:target: https://github.com/colour-science/colour-datasets/actions
:alt: Develop Build Status
.. |coveralls| image:: http://img.shields.io/coveralls/colour-science/colour-datasets/develop.svg?style=flat-square
Expand All @@ -24,11 +24,11 @@ Colour science datasets for use with
`Colour <https://github.com/colour-science/colour>`__ or any Python package
manipulating colours. The datasets are hosted in `Zenodo <https://zenodo.org>`__
under the
`Colour Science - Datasets <https://zenodo.org/communities/colour-science-datasets/>`__
`Colour Science - Datasets <https://zenodo.org/communities/colour-science-datasets>`__
community.

It is open source and freely available under the
`New BSD License <https://opensource.org/licenses/BSD-3-Clause>`__ terms.
`BSD-3-Clause <https://opensource.org/licenses/BSD-3-Clause>`__ terms.

.. contents:: **Table of Contents**
:backlinks: none
Expand All @@ -50,7 +50,7 @@ when trying to access or use colour science datasets:

**Colour - Datasets** offers all the above: it allows users to ingest and load
colour science datasets with a single function call. The datasets information
is hosted on `Zenodo <https://zenodo.org/communities/colour-science-datasets/>`__
is hosted on `Zenodo <https://zenodo.org/communities/colour-science-datasets>`__
where the record for a dataset typically contain:

- An *urls.txt* file describing the urls to source the dataset files from.
Expand Down Expand Up @@ -156,14 +156,14 @@ Primary Dependencies

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

- `python >= 3.8, < 4 <https://www.python.org/download/releases/>`__
- `cachetools <https://pypi.org/project/cachetools/>`__
- `colour-science >= 4 <https://pypi.org/project/colour-science/>`__
- `imageio >= 2, < 3 <https://imageio.github.io/>`__
- `numpy >= 1.19, < 2 <https://pypi.org/project/numpy/>`__
- `scipy >= 1.5, < 2 <https://pypi.org/project/scipy/>`__
- `tqdm <https://pypi.org/project/tqdm/>`__
- `xlrd <https://pypi.org/project/xlrd/>`__
- `python >= 3.9, < 4 <https://www.python.org/download/releases>`__
- `cachetools <https://pypi.org/project/cachetools>`__
- `colour-science >= 4.3 <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>`__
- `tqdm <https://pypi.org/project/tqdm>`__
- `xlrd <https://pypi.org/project/xlrd>`__

Pypi
~~~~
Expand All @@ -182,7 +182,7 @@ Contributing
^^^^^^^^^^^^

If you would like to contribute to `Colour - Datasets <https://github.com/colour-science/colour-datasets>`__,
please refer to the following `Contributing <https://www.colour-science.org/contributing/>`__
please refer to the following `Contributing <https://www.colour-science.org/contributing>`__
guide for `Colour <https://github.com/colour-science/colour>`__.

Bibliography
Expand All @@ -202,7 +202,7 @@ Code of Conduct
---------------

The *Code of Conduct*, adapted from the `Contributor Covenant 1.4 <https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>`__,
is available on the `Code of Conduct <https://www.colour-science.org/code-of-conduct/>`__ page.
is available on the `Code of Conduct <https://www.colour-science.org/code-of-conduct>`__ page.

Contact & Social
----------------
Expand All @@ -220,5 +220,5 @@ About

| **Colour - Datasets** by Colour Developers
| Copyright 2019 Colour Developers – `[email protected] <[email protected]>`__
| This software is released under terms of New BSD License: https://opensource.org/licenses/BSD-3-Clause
| This software is released under terms of BSD-3-Clause: https://opensource.org/licenses/BSD-3-Clause
| `https://github.com/colour-science/colour-datasets <https://github.com/colour-science/colour-datasets>`__
4 changes: 2 additions & 2 deletions TODO.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ About
-----

| **Colour - Datasets** by Colour Developers
| Copyright 2019 Colour Developers `[email protected] <[email protected]>`__
| This software is released under terms of New BSD License: https://opensource.org/licenses/BSD-3-Clause
| Copyright 2019 Colour Developers - `[email protected] <[email protected]>`__
| This software is released under terms of BSD-3-Clause: https://opensource.org/licenses/BSD-3-Clause
| `https://github.com/colour-science/colour-datasets <https://github.com/colour-science/colour-datasets>`__
19 changes: 9 additions & 10 deletions colour_datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
`Colour <https://github.com/colour-science/colour>`__ or any Python package
manipulating colours. The datasets are hosted in
`Zenodo <https://zenodo.org>`__ under the `Colour Science - Datasets \
<https://zenodo.org/communities/colour-science-datasets/>`__ community.
<https://zenodo.org/communities/colour-science-datasets>`__ community.
Subpackages
-----------
Expand All @@ -15,9 +15,10 @@
- utilities: Various utilities.
"""

import contextlib
import numpy as np
import os
import subprocess # nosec
import subprocess

import colour

Expand All @@ -28,7 +29,7 @@

__author__ = "Colour Developers"
__copyright__ = "Copyright 2019 Colour Developers"
__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause"
__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause"
__maintainer__ = "Colour Developers"
__email__ = "[email protected]"
__status__ = "Production"
Expand All @@ -52,15 +53,15 @@

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

try:
_version = (
subprocess.check_output( # nosec
["git", "describe"],
subprocess.check_output(
["git", "describe"], # noqa: S603, S607
cwd=os.path.dirname(__file__),
stderr=subprocess.STDOUT,
)
Expand All @@ -70,14 +71,12 @@
except Exception:
_version = __version__

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

del _version

# TODO: Remove legacy printing support when deemed appropriate.
try:
with contextlib.suppress(TypeError):
np.set_printoptions(legacy="1.13")
except TypeError:
pass
19 changes: 8 additions & 11 deletions colour_datasets/loaders/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import sys

from colour.hints import Any, Boolean, Integer, Union
from colour.hints import Any
from colour.utilities import CanonicalMapping, warning

from colour_datasets.records import datasets
Expand Down Expand Up @@ -105,26 +105,23 @@
Dataset loaders ids and callables.
"""

from .kuopio import DATASET_LOADERS_KUOPIO_UNIVERSITY # noqa
from .kuopio import DATASET_LOADERS_KUOPIO_UNIVERSITY # noqa: E402

DATASET_LOADERS.update(DATASET_LOADERS_KUOPIO_UNIVERSITY)

from . import kuopio # noqa
from . import kuopio # noqa: E402

_module = sys.modules["colour_datasets.loaders"]

for _export in kuopio.__all__:
if _export.startswith("DatasetLoader_") or _export.startswith("build_"):

if _export.startswith(("DatasetLoader_", "build_")):
setattr(_module, _export, getattr(kuopio, _export))

__all__ += [
_export,
]
__all__ += [_export] # noqa: PLE0604

del _module, _export

_HAS_TITLE_KEYS: Boolean = False
_HAS_TITLE_KEYS: bool = False
"""
Whether the :attr:`colour_datasets.loaders.DATASET_LOADERS` attribute has
been updated with dataset titles. This variable is used in the one time
Expand All @@ -133,7 +130,7 @@
"""


def load(dataset: Union[Integer, str]) -> Any:
def load(dataset: int | str) -> Any:
"""
Load given dataset: The dataset is pulled locally, i.e. synced if required
and then its data is loaded.
Expand Down Expand Up @@ -161,7 +158,7 @@ def load(dataset: Union[Integer, str]) -> Any:
28
"""

global _HAS_TITLE_KEYS
global _HAS_TITLE_KEYS # noqa: PLW0603

if not _HAS_TITLE_KEYS:
for key in list(DATASET_LOADERS.keys())[:]:
Expand Down
Loading

0 comments on commit d979071

Please sign in to comment.