diff --git a/.github/workflows/continuous-integration-documentation.yml b/.github/workflows/continuous-integration-documentation.yml index 677f18a..ab3f010 100644 --- a/.github/workflows/continuous-integration-documentation.yml +++ b/.github/workflows/continuous-integration-documentation.yml @@ -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 @@ -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 diff --git a/.github/workflows/continuous-integration-quality-unit-tests.yml b/.github/workflows/continuous-integration-quality-unit-tests.yml index 33336dd..a29fea5 100644 --- a/.github/workflows/continuous-integration-quality-unit-tests.yml +++ b/.github/workflows/continuous-integration-quality-unit-tests.yml @@ -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 @@ -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 @@ -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 diff --git a/.github/workflows/continuous-integration-static-type-checking.yml b/.github/workflows/continuous-integration-static-type-checking.yml index e74dd22..4bf6ee1 100644 --- a/.github/workflows/continuous-integration-static-type-checking.yml +++ b/.github/workflows/continuous-integration-static-type-checking.yml @@ -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 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 054a788..c213b30 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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: @@ -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: diff --git a/README.rst b/README.rst index 8e38612..b3e48f0 100644 --- a/README.rst +++ b/README.rst @@ -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 diff --git a/colour_demosaicing/__init__.py b/colour_demosaicing/__init__.py index fb1d9b3..1fdb7f8 100644 --- a/colour_demosaicing/__init__.py +++ b/colour_demosaicing/__init__.py @@ -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 = ( @@ -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 diff --git a/colour_demosaicing/bayer/demosaicing/tests/test_bilinear.py b/colour_demosaicing/bayer/demosaicing/tests/test_bilinear.py index 386c7be..9a0991b 100644 --- a/colour_demosaicing/bayer/demosaicing/tests/test_bilinear.py +++ b/colour_demosaicing/bayer/demosaicing/tests/test_bilinear.py @@ -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, ) diff --git a/colour_demosaicing/bayer/demosaicing/tests/test_malvar2004.py b/colour_demosaicing/bayer/demosaicing/tests/test_malvar2004.py index 7eb5d59..5168027 100644 --- a/colour_demosaicing/bayer/demosaicing/tests/test_malvar2004.py +++ b/colour_demosaicing/bayer/demosaicing/tests/test_malvar2004.py @@ -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, ) diff --git a/colour_demosaicing/bayer/demosaicing/tests/test_menon2007.py b/colour_demosaicing/bayer/demosaicing/tests/test_menon2007.py index b04bbd1..8a42d01 100644 --- a/colour_demosaicing/bayer/demosaicing/tests/test_menon2007.py +++ b/colour_demosaicing/bayer/demosaicing/tests/test_menon2007.py @@ -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, ) diff --git a/colour_demosaicing/bayer/tests/test_mosaicing.py b/colour_demosaicing/bayer/tests/test_mosaicing.py index 562dc79..000f617 100644 --- a/colour_demosaicing/bayer/tests/test_mosaicing.py +++ b/colour_demosaicing/bayer/tests/test_mosaicing.py @@ -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], diff --git a/docs/conf.py b/docs/conf.py index cc0ea11..0ecb796 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -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 = [ diff --git a/pyproject.toml b/pyproject.toml index ecbdd1d..379d44a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 = "*" @@ -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 @@ -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" diff --git a/tasks.py b/tasks.py index 1c327ce..1b86ded 100644 --- a/tasks.py +++ b/tasks.py @@ -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): @@ -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") @@ -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 " @@ -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( diff --git a/utilities/export_todo.py b/utilities/export_todo.py index 1efbe15..22c13b9 100755 --- a/utilities/export_todo.py +++ b/utilities/export_todo.py @@ -40,9 +40,7 @@ https://opensource.org/licenses/BSD-3-Clause | `https://github.com/colour-science/colour-demosaicing \ `__ -"""[ - 1: -] +"""[1:] def extract_todo_items(root_directory: str) -> dict: