feat: ✨ initial
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
name: "Build dependencies"
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "pyproject.toml"
|
||||
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
|
||||
@@ -0,0 +1,3 @@
|
||||
__pycache__
|
||||
*.egg-info
|
||||
.coverage
|
||||
@@ -0,0 +1 @@
|
||||
__version__ = "0.1.0"
|
||||
@@ -0,0 +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"
|
||||
@@ -0,0 +1,92 @@
|
||||
let oiio_root = (git grab https://github.com/AcademySoftwareFoundation/OpenImageIO)
|
||||
# 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
|
||||
|
||||
@@ -0,0 +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")
|
||||
@@ -0,0 +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
|
||||
Reference in New Issue
Block a user