From c941328d40f9934c6aed17c3926febd46f3d42fb Mon Sep 17 00:00:00 2001 From: Mel Massadian Date: Sun, 2 Jun 2024 20:11:42 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20convert=20to=20LF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_dependencies.yml | 77 +++++----- comfy_oiio/__init__.py | 2 +- pyproject.toml | 110 +++++++------- scripts/build_oiio.nu | 186 +++++++++++------------ tests/test_base.py | 30 ++-- tox.ini | 90 +++++------ 6 files changed, 248 insertions(+), 247 deletions(-) diff --git a/.github/workflows/build_dependencies.yml b/.github/workflows/build_dependencies.yml index 644105a..59a2d44 100644 --- a/.github/workflows/build_dependencies.yml +++ b/.github/workflows/build_dependencies.yml @@ -1,38 +1,39 @@ -name: "Build dependencies" -on: - workflow_dispatch: - push: - branches: - - main - paths: - - "pyproject.toml" - - ".github/workflows/build_dependencies.yml" -jobs: - build: - permissions: - contents: write - strategy: - fail-fast: false - matrix: - include: - - os: windows-latest - platform: win32 - arch: x64 - # - os: macos-latest - # platform: darwin - # arch: arm64 - # - os: ubuntu-latest - # platform: linux - # arch: x64 - - name: build native depenecies for ${{ matrix.platform }} - runs-on: ${{ matrix.os }} - steps: - - name: Checkout code - uses: actions/checkout@v4 - - name: Build OpenImageIO from source - id: build_oiio - uses: melMass/actions@nukit - with: - script: | - source scripts/build_oiio.nu +name: "Build dependencies" +on: + workflow_dispatch: + push: + branches: + - main + paths: + - "pyproject.toml" + - ".github/workflows/build_dependencies.yml" + - "scripts/build_oiio.nu" +jobs: + build: + permissions: + contents: write + strategy: + fail-fast: false + matrix: + include: + - os: windows-latest + platform: win32 + arch: x64 + # - os: macos-latest + # platform: darwin + # arch: arm64 + # - os: ubuntu-latest + # platform: linux + # arch: x64 + + name: build native depenecies for ${{ matrix.platform }} + runs-on: ${{ matrix.os }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Build OpenImageIO from source + id: build_oiio + uses: melMass/actions@nukit + with: + script: | + source scripts/build_oiio.nu diff --git a/comfy_oiio/__init__.py b/comfy_oiio/__init__.py index 3f5c4a7..3dc1f76 100644 --- a/comfy_oiio/__init__.py +++ b/comfy_oiio/__init__.py @@ -1 +1 @@ -__version__ = "0.1.0" +__version__ = "0.1.0" diff --git a/pyproject.toml b/pyproject.toml index f004485..97ebfe1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,55 +1,55 @@ -[build-system] -requires = ["setuptools", "wheel"] -build-backend = "setuptools.build_meta" - -[project] -name = "comfy-oiio" -dynamic = ["version"] -description = "OpenImageIO plugin for ComfyUI" -requires-python = ">=3.10" -license = { text = "MIT" } -readme = "README.md" -# repository = "https://github.com/melMass/comfy_oiio" -dependencies = ["opencolorio"] -optional-dependencies = { test = ["pytest", "pytest-cov", "tox"] } -authors = [{ name = "Mel Massadian" }] -classifiers = [ - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Intended Audience :: Developers", -] - -[tool.setuptools.packages.find] -where = ["."] -# include = ["comfy_oiio.*"] - -[tool.setuptools.dynamic] -version = { attr = "comfy_oiio.__version__" } - -[tool.pyright] -reportMissingTypeArgument = true # Report generic classes used without type arguments -strictListInference = true # Use union types when inferring types of lists elements, instead of Any -reportMissingTypeStubs = false -typeCheckingMode = "basic" -pythonVersion = "3.10" - -[tool.ruff] -line-length = 100 -select = ["A", "B", "C", "D", "E", "F", "FBT", "I", "N", "S", "SIM", "UP", "W"] -extend-exclude = ["./docs/conf.py"] # exclude auto generated file - -[tool.ruff.per-file-ignores] -"__init__.py" = ["F401"] # imported but unused -"tests/*" = ["S101"] # use of assert detected -"scripts/*" = [ - "D103", # missing docstring in public function - "S603", # check for execution of untrusted input - "S607", # starting a process with a partial executable path -] - -[tool.ruff.pydocstyle] -convention = "numpy" +[build-system] +requires = ["setuptools", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "comfy-oiio" +dynamic = ["version"] +description = "OpenImageIO plugin for ComfyUI" +requires-python = ">=3.10" +license = { text = "MIT" } +readme = "README.md" +# repository = "https://github.com/melMass/comfy_oiio" +dependencies = ["opencolorio"] +optional-dependencies = { test = ["pytest", "pytest-cov", "tox"] } +authors = [{ name = "Mel Massadian" }] +classifiers = [ + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Intended Audience :: Developers", +] + +[tool.setuptools.packages.find] +where = ["."] +# include = ["comfy_oiio.*"] + +[tool.setuptools.dynamic] +version = { attr = "comfy_oiio.__version__" } + +[tool.pyright] +reportMissingTypeArgument = true # Report generic classes used without type arguments +strictListInference = true # Use union types when inferring types of lists elements, instead of Any +reportMissingTypeStubs = false +typeCheckingMode = "basic" +pythonVersion = "3.10" + +[tool.ruff] +line-length = 100 +select = ["A", "B", "C", "D", "E", "F", "FBT", "I", "N", "S", "SIM", "UP", "W"] +extend-exclude = ["./docs/conf.py"] # exclude auto generated file + +[tool.ruff.per-file-ignores] +"__init__.py" = ["F401"] # imported but unused +"tests/*" = ["S101"] # use of assert detected +"scripts/*" = [ + "D103", # missing docstring in public function + "S603", # check for execution of untrusted input + "S607", # starting a process with a partial executable path +] + +[tool.ruff.pydocstyle] +convention = "numpy" diff --git a/scripts/build_oiio.nu b/scripts/build_oiio.nu index 4528efc..6a756ae 100644 --- a/scripts/build_oiio.nu +++ b/scripts/build_oiio.nu @@ -1,93 +1,93 @@ -let oiio_root = (git grab https://github.com/AcademySoftwareFoundation/OpenImageIO) -let reset = false -# let root = ($env.PWD) -let root = $oiio_root - -$env.config.rm.always_trash = false - -if $reset { - rm -rf build -} -# let build_root = ($root | path join build_root) -let build_root = get-build-root openimageio -# let build_env = { -# ZLIB_ROOT : ($build_root | path join zlib build) -# TIFF_ROOT : ($build_root | path join libTiff) -# OpenEXR_ROOT : ($build_root | path join openexr dist) -# Imath_DIR: ($build_root | path join openexr dist lib cmake Imath) -# Imath_INCLUDE_DIR: ($build_root | path join openexr dist include Imath) -# Imath_LIBRARY: ($build_root | path join openexr dist lib Imath-3_2.lib) -# JPEG_ROOT : ($build_root | path join libjpeg-turbo build) -# } -mkdir $build_root - -# NOTE: install zlib -cd $build_root -clone_or_update "./zlib" https://github.com/madler/zlib -cd zlib - -if $reset { - rm -rf build -} - -cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=. -cmake --build build --config Release --target install -# rm build/Release/zlib.lib - -# -# if not ("./zlib" | path exists) { -# git clone https://github.com/madler/zlib -# } -# cd zlib -# git fetch -# git pull - -# NOTE: Install libTiff -cd $build_root -clone_or_update "./libtiff" https://gitlab.com/libtiff/libtiff.git -cd libtiff -if $reset { - try { - rm -rf build - git reset --hard HEAD - } catch { - print "Nothing to clean for libtiff" - } -} -cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=. -cmake --build build --config Release --target install - -# NOTE: install libjpeg-turbo -cd $build_root -clone_or_update "./libjpeg-turbo" https://github.com/libjpeg-turbo/libjpeg-turbo -cd libjpeg-turbo -if $reset { - rm -rf build -} -cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DENABLE_SHARED=OFF -DCMAKE_INSTALL_PREFIX=. -cmake --build build --config Release --target install - -# NOTE: install openexr -cd $build_root -clone_or_update "./openexr" https://github.com/AcademySoftwareFoundation/openexr -cd openexr -if $reset { - rm -rf build -} -cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=dist -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF -DOPENEXR_BUILD_TOOLS=OFF -DOPENEXR_INSTALL_TOOLS=OFF -DOPENEXR_INSTALL_EXAMPLES=OFF -DZLIB_ROOT=($build_root | path join zlib) -cmake --build build --target install --config Release -let imath_lib = (glob dist/lib/Imath*.lib | get -i 0) - -# NOTE: install pybind -cd $build_root -clone_or_update "./pybind11" https://github.com/pybind/pybind11 -cd pybind11 -cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DENABLE_SHARED=OFF -DPYBIND11_TEST=OFF -DCMAKE_INSTALL_PREFIX=. -cmake --build build --config Release --target install - - -# NOTE: install open image io -cd $root -cmake -S . -B build -DVERBOSE=ON -DCMAKE_BUILD_TYPE=Release -DOIIO_BUILD_TESTS=OFF -DUSE_PYTHON=1 -DUSE_QT=0 -DBUILD_SHARED_LIBS=0 -DLINKSTATIC=1 $"-DZLIB_ROOT=($build_root | path join zlib)" $"-Dpybind11_ROOT=($build_root | path join pybind11)" $"-DTIFF_ROOT=($build_root | path join libTiff)" $"-DOpenEXR_ROOT=($build_root | path join openexr dist)" $"-DImath_DIR=($build_root | path join openexr dist lib cmake Imath)" $"-DImath_INCLUDE_DIR=($build_root | path join openexr dist include Imath)" $"-DImath_LIBRARY=($imath_lib)" $"-DJPEG_ROOT=($build_root | path join libjpeg-turbo)" $"-Dlibjpeg-turbo_ROOT=($build_root | path join libjpeg-turbo)" -cmake --build build --target install --config Release - +let oiio_root = (git grab https://github.com/AcademySoftwareFoundation/OpenImageIO) +let reset = false +# let root = ($env.PWD) +let root = $oiio_root + +$env.config.rm.always_trash = false + +if $reset { + rm -rf build +} +# let build_root = ($root | path join build_root) +let build_root = get-build-root openimageio +# let build_env = { +# ZLIB_ROOT : ($build_root | path join zlib build) +# TIFF_ROOT : ($build_root | path join libTiff) +# OpenEXR_ROOT : ($build_root | path join openexr dist) +# Imath_DIR: ($build_root | path join openexr dist lib cmake Imath) +# Imath_INCLUDE_DIR: ($build_root | path join openexr dist include Imath) +# Imath_LIBRARY: ($build_root | path join openexr dist lib Imath-3_2.lib) +# JPEG_ROOT : ($build_root | path join libjpeg-turbo build) +# } +mkdir $build_root + +# NOTE: install zlib +cd $build_root +clone-or-update "./zlib" https://github.com/madler/zlib +cd zlib + +if $reset { + rm -rf build +} + +cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=. +cmake --build build --config Release --target install +# rm build/Release/zlib.lib + +# +# if not ("./zlib" | path exists) { +# git clone https://github.com/madler/zlib +# } +# cd zlib +# git fetch +# git pull + +# NOTE: Install libTiff +cd $build_root +clone-or-update "./libtiff" https://gitlab.com/libtiff/libtiff.git +cd libtiff +if $reset { + try { + rm -rf build + git reset --hard HEAD + } catch { + print "Nothing to clean for libtiff" + } +} +cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=. +cmake --build build --config Release --target install + +# NOTE: install libjpeg-turbo +cd $build_root +clone-or-update "./libjpeg-turbo" https://github.com/libjpeg-turbo/libjpeg-turbo +cd libjpeg-turbo +if $reset { + rm -rf build +} +cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DENABLE_SHARED=OFF -DCMAKE_INSTALL_PREFIX=. +cmake --build build --config Release --target install + +# NOTE: install openexr +cd $build_root +clone-or-update "./openexr" https://github.com/AcademySoftwareFoundation/openexr +cd openexr +if $reset { + rm -rf build +} +cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=dist -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF -DOPENEXR_BUILD_TOOLS=OFF -DOPENEXR_INSTALL_TOOLS=OFF -DOPENEXR_INSTALL_EXAMPLES=OFF -DZLIB_ROOT=($build_root | path join zlib) +cmake --build build --target install --config Release +let imath_lib = (glob dist/lib/Imath*.lib | get -i 0) + +# NOTE: install pybind +cd $build_root +clone-or-update "./pybind11" https://github.com/pybind/pybind11 +cd pybind11 +cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DENABLE_SHARED=OFF -DPYBIND11_TEST=OFF -DCMAKE_INSTALL_PREFIX=. +cmake --build build --config Release --target install + + +# NOTE: install open image io +cd $root +cmake -S . -B build -DVERBOSE=ON -DCMAKE_BUILD_TYPE=Release -DOIIO_BUILD_TESTS=OFF -DUSE_PYTHON=1 -DUSE_QT=0 -DBUILD_SHARED_LIBS=0 -DLINKSTATIC=1 $"-DZLIB_ROOT=($build_root | path join zlib)" $"-Dpybind11_ROOT=($build_root | path join pybind11)" $"-DTIFF_ROOT=($build_root | path join libTiff)" $"-DOpenEXR_ROOT=($build_root | path join openexr dist)" $"-DImath_DIR=($build_root | path join openexr dist lib cmake Imath)" $"-DImath_INCLUDE_DIR=($build_root | path join openexr dist include Imath)" $"-DImath_LIBRARY=($imath_lib)" $"-DJPEG_ROOT=($build_root | path join libjpeg-turbo)" $"-Dlibjpeg-turbo_ROOT=($build_root | path join libjpeg-turbo)" +cmake --build build --target install --config Release + diff --git a/tests/test_base.py b/tests/test_base.py index 7029beb..d32efff 100644 --- a/tests/test_base.py +++ b/tests/test_base.py @@ -1,15 +1,15 @@ -import pytest - - -def test_human_readable(): - """Various test case for the humand readable function.""" - assert True is True - - -def test_example_float_approx(): - assert pytest.approx(0.3) == 0.1 + 0.2 - - -def test_example_error(): - with pytest.raises(ValueError): - int("string") +import pytest + + +def test_human_readable(): + """Various test case for the humand readable function.""" + assert True is True + + +def test_example_float_approx(): + assert pytest.approx(0.3) == 0.1 + 0.2 + + +def test_example_error(): + with pytest.raises(ValueError): + int("string") diff --git a/tox.ini b/tox.ini index 2fe4d16..a9c55ed 100644 --- a/tox.ini +++ b/tox.ini @@ -1,45 +1,45 @@ -[tox] -envlist = py310 -# envlist = py310, py311, lint, type -# envdir = {toxworkdir}/.tox - -[gh] -python = - 3.10: py310 - 3.11: py311 - -[testenv] -# deps = -# -rrequirements.txt -# deps = -extras = test -allowlist_externals = - pytest - pytest-cov - -commands = - pytest --cov=libs --cov-report=term-missing --ignore-glob="*/extern" - python -c "import shutil; import os; shutil.rmtree('./pypa', ignore_errors=True)" - # python -c "import os; print(os.environ.get('VCPKG_ROOT'))" -passenv = - VCPKG_ROOT - -[testenv:lint] -description = Run linters -skip_install = true -deps = - black - isort - flake8 - ruff -commands = - black --check . - isort --check-only . - flake8 . - ruff . - -[testenv:type] -description = Run type checks -skip_install = true -deps = pyright -commands = pyright +[tox] +envlist = py310 +# envlist = py310, py311, lint, type +# envdir = {toxworkdir}/.tox + +[gh] +python = + 3.10: py310 + 3.11: py311 + +[testenv] +# deps = +# -rrequirements.txt +# deps = +extras = test +allowlist_externals = + pytest + pytest-cov + +commands = + pytest --cov=libs --cov-report=term-missing --ignore-glob="*/extern" + python -c "import shutil; import os; shutil.rmtree('./pypa', ignore_errors=True)" + # python -c "import os; print(os.environ.get('VCPKG_ROOT'))" +passenv = + VCPKG_ROOT + +[testenv:lint] +description = Run linters +skip_install = true +deps = + black + isort + flake8 + ruff +commands = + black --check . + isort --check-only . + flake8 . + ruff . + +[testenv:type] +description = Run type checks +skip_install = true +deps = pyright +commands = pyright