Skip to content

Commit

Permalink
Merge branch 'feature/v0.2.6' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
KelSolaar committed Feb 4, 2024
2 parents 3fac8cf + b62a035 commit 499bb4e
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 76 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/continuous-integration-documentation.yml
Expand Up @@ -12,7 +12,7 @@ jobs:
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 @@ -30,8 +30,6 @@ 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
Expand Down
Expand Up @@ -12,7 +12,7 @@ jobs:
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
with:
submodules: true
- name: Environment Variables
Expand All @@ -31,8 +31,6 @@ 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 @@ -56,7 +54,7 @@ jobs:
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
if: matrix.os == 'macOS-latest' && matrix.python-version == '3.11'
if: matrix.os == 'macOS-latest' && matrix.python-version == '3.12'
run: |
if [ -z "$COVERALLS_REPO_TOKEN" ]; then echo \"COVERALLS_REPO_TOKEN\" secret is undefined!; else poetry run coveralls; fi
shell: bash
Expand Up @@ -12,7 +12,7 @@ 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_demosaicing" >> $GITHUB_ENV
Expand Down
11 changes: 3 additions & 8 deletions .pre-commit-config.yaml
Expand Up @@ -25,18 +25,14 @@ 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:
Expand All @@ -46,7 +42,6 @@ repos:
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 README.rst
Expand Up @@ -12,7 +12,7 @@ Colour - Demosaicing
:target: https://coveralls.io/r/colour-science/colour-demosaicing
:alt: Coverage Status
.. |codacy| image:: https://img.shields.io/codacy/grade/2862b4f2217742ae83c972d7e3af44d7/develop.svg?style=flat-square
:target: https://www.codacy.com/app/colour-science/colour-demosaicing
:target: https://app.codacy.com/gh/colour-science/colour-demosaicing
:alt: Code Grade
.. |version| image:: https://img.shields.io/pypi/v/colour-demosaicing.svg?style=flat-square
:target: https://pypi.org/project/colour-demosaicing
Expand Down
8 changes: 2 additions & 6 deletions colour_demosaicing/__init__.py
Expand Up @@ -56,9 +56,7 @@
__major_version__ = "0"
__minor_version__ = "2"
__change_version__ = "5"
__version__ = ".".join(
(__major_version__, __minor_version__, __change_version__)
)
__version__ = ".".join((__major_version__, __minor_version__, __change_version__))

try:
_version: str = (
Expand All @@ -73,9 +71,7 @@
except Exception:
_version: str = __version__

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

del _version

Expand Down
8 changes: 2 additions & 6 deletions colour_demosaicing/bayer/demosaicing/tests/test_bilinear.py
Expand Up @@ -46,17 +46,13 @@ def test_demosaicing_CFA_Bayer_bilinear(self):
"""

for pattern in ("RGGB", "BGGR", "GRBG", "GBRG"):
CFA = os.path.join(
ROOT_RESOURCES_BAYER, f"Lighthouse_CFA_{pattern}.exr"
)
CFA = os.path.join(ROOT_RESOURCES_BAYER, f"Lighthouse_CFA_{pattern}.exr")
RGB = os.path.join(
ROOT_RESOURCES_BAYER, f"Lighthouse_Bilinear_{pattern}.exr"
)

np.testing.assert_allclose(
demosaicing_CFA_Bayer_bilinear(
read_image(str(CFA))[..., 0], pattern
),
demosaicing_CFA_Bayer_bilinear(read_image(str(CFA))[..., 0], pattern),
read_image(str(RGB)),
atol=TOLERANCE_ABSOLUTE_TESTS,
)
Expand Down
8 changes: 2 additions & 6 deletions colour_demosaicing/bayer/demosaicing/tests/test_malvar2004.py
Expand Up @@ -46,17 +46,13 @@ def test_demosaicing_CFA_Bayer_Malvar2004(self):
"""

for pattern in ("RGGB", "BGGR", "GRBG", "GBRG"):
CFA = os.path.join(
ROOT_RESOURCES_BAYER, f"Lighthouse_CFA_{pattern}.exr"
)
CFA = os.path.join(ROOT_RESOURCES_BAYER, f"Lighthouse_CFA_{pattern}.exr")
RGB = os.path.join(
ROOT_RESOURCES_BAYER, f"Lighthouse_Malvar2004_{pattern}.exr"
)

np.testing.assert_allclose(
demosaicing_CFA_Bayer_Malvar2004(
read_image(str(CFA))[..., 0], pattern
),
demosaicing_CFA_Bayer_Malvar2004(read_image(str(CFA))[..., 0], pattern),
read_image(str(RGB)),
atol=TOLERANCE_ABSOLUTE_TESTS,
)
Expand Down
8 changes: 2 additions & 6 deletions colour_demosaicing/bayer/demosaicing/tests/test_menon2007.py
Expand Up @@ -46,17 +46,13 @@ def test_demosaicing_CFA_Bayer_Menon2007(self):
"""

for pattern in ("RGGB", "BGGR", "GRBG", "GBRG"):
CFA = os.path.join(
ROOT_RESOURCES_BAYER, f"Lighthouse_CFA_{pattern}.exr"
)
CFA = os.path.join(ROOT_RESOURCES_BAYER, f"Lighthouse_CFA_{pattern}.exr")
RGB = os.path.join(
ROOT_RESOURCES_BAYER, f"Lighthouse_Menon2007_{pattern}.exr"
)

np.testing.assert_allclose(
demosaicing_CFA_Bayer_Menon2007(
read_image(str(CFA))[..., 0], pattern
),
demosaicing_CFA_Bayer_Menon2007(read_image(str(CFA))[..., 0], pattern),
read_image(str(RGB)),
atol=TOLERANCE_ABSOLUTE_TESTS,
)
Expand Down
8 changes: 2 additions & 6 deletions colour_demosaicing/bayer/tests/test_mosaicing.py
Expand Up @@ -45,14 +45,10 @@ def test_mosaicing_CFA_Bayer(self):
definition.
"""

image = read_image(
str(os.path.join(ROOT_RESOURCES_BAYER, "Lighthouse.exr"))
)
image = read_image(str(os.path.join(ROOT_RESOURCES_BAYER, "Lighthouse.exr")))

for pattern in ("RGGB", "BGGR", "GRBG", "GBRG"):
CFA = os.path.join(
ROOT_RESOURCES_BAYER, f"Lighthouse_CFA_{pattern}.exr"
)
CFA = os.path.join(ROOT_RESOURCES_BAYER, f"Lighthouse_CFA_{pattern}.exr")
np.testing.assert_allclose(
mosaicing_CFA_Bayer(image, pattern),
read_image(str(CFA))[..., 0],
Expand Down
4 changes: 1 addition & 3 deletions docs/conf.py
Expand Up @@ -11,9 +11,7 @@

import colour_demosaicing as package # noqa: E402

basename = re.sub(
"_(\\w)", lambda x: x.group(1).upper(), package.__name__.title()
)
basename = re.sub("_(\\w)", lambda x: x.group(1).upper(), package.__name__.title())

# -- General configuration ------------------------------------------------
extensions = [
Expand Down
16 changes: 6 additions & 10 deletions pyproject.toml
Expand Up @@ -59,7 +59,7 @@ typing-extensions = ">= 4, < 5"
matplotlib = ">= 3.5, != 3.5.0, != 3.5.1"

[tool.poetry.group.dev.dependencies]
coverage = "!= 6.3"
coverage = ">= 6, < 7"
coveralls = "*"
invoke = "*"
jupyter = "*"
Expand All @@ -78,15 +78,8 @@ restructuredtext-lint = "*"
sphinx = "*"
sphinxcontrib-bibtex = "*"

[tool.black]
line-length = 79
exclude = '''
/(
\.git
| build
| dist
)/
'''
[tool.codespell]
skip = 'BIBLIOGRAPHY.bib,CONTRIBUTORS.rst,*.ipynb'

[tool.flynt]
line_length=999
Expand Down Expand Up @@ -205,6 +198,9 @@ convention = "numpy"
"utilities/*" = ["EXE001", "INP"]
"utilities/unicode_to_ascii.py" = ["RUF001"]

[tool.ruff.format]
docstring-code-format = true

[build-system]
requires = [ "poetry_core>=1.0.0" ]
build-backend = "poetry.core.masonry.api"
17 changes: 4 additions & 13 deletions tasks.py
Expand Up @@ -135,9 +135,7 @@ def formatting(
message_box('Cleaning up "BibTeX" file...')
bibtex_path = BIBLIOGRAPHY_NAME
with open(bibtex_path) as bibtex_file:
entries = (
biblib.bib.Parser().parse(bibtex_file.read()).get_entries()
)
entries = biblib.bib.Parser().parse(bibtex_file.read()).get_entries()

for entry in sorted(entries.values(), key=lambda x: x.key):
with contextlib.suppress(KeyError):
Expand Down Expand Up @@ -267,9 +265,7 @@ def docs(ctx: Context, html: bool = True, pdf: bool = True):
Whether to build the *PDF* documentation.
"""

with ctx.prefix("export COLOUR_SCIENCE__DOCUMENTATION_BUILD=True"), ctx.cd(
"docs"
):
with ctx.prefix("export COLOUR_SCIENCE__DOCUMENTATION_BUILD=True"), ctx.cd("docs"):
if html:
message_box('Building "HTML" documentation...')
ctx.run("make html")
Expand Down Expand Up @@ -368,10 +364,7 @@ def virtualise(ctx: Context, tests: bool = True):
with ctx.cd(unique_name):
ctx.run("poetry install")
ctx.run("source $(poetry env info -p)/bin/activate")
ctx.run(
'python -c "import imageio;'
'imageio.plugins.freeimage.download()"'
)
ctx.run('python -c "import imageio;imageio.plugins.freeimage.download()"')
if tests:
ctx.run(
"poetry run pytest "
Expand Down Expand Up @@ -422,9 +415,7 @@ def tag(ctx: Context):
remote_tags = result.stdout.strip().split("\n") # pyright: ignore
tags = set()
for remote_tag in remote_tags:
tags.add(
remote_tag.split("refs/tags/")[1].replace("refs/tags/", "^{}")
)
tags.add(remote_tag.split("refs/tags/")[1].replace("refs/tags/", "^{}"))
version_tags = sorted(tags)
if f"v{version}" in version_tags:
raise RuntimeError(
Expand Down
4 changes: 1 addition & 3 deletions utilities/export_todo.py
Expand Up @@ -40,9 +40,7 @@
https://opensource.org/licenses/BSD-3-Clause
| `https://github.com/colour-science/colour-demosaicing \
<https://github.com/colour-science/colour-demosaicing>`__
"""[
1:
]
"""[1:]


def extract_todo_items(root_directory: str) -> dict:
Expand Down

0 comments on commit 499bb4e

Please sign in to comment.