3a2c66702c
Tests on CPU (scheduled) / check-skip (push) Has been cancelled
Tests on CPU (scheduled) / pre-tests (push) Has been cancelled
Tests on CPU (scheduled) / tests-cpu-ubuntu (float32) (push) Has been cancelled
Tests on CPU (scheduled) / tests-cpu-ubuntu (float64) (push) Has been cancelled
Tests on CPU (scheduled) / tests-cpu-windows (3.11, float32, 2.5.1) (push) Has been cancelled
Tests on CPU (scheduled) / tests-cpu-windows (3.11, float32, 2.9.1) (push) Has been cancelled
Tests on CPU (scheduled) / tests-cpu-windows (3.11, float64, 2.5.1) (push) Has been cancelled
Tests on CPU (scheduled) / tests-cpu-windows (3.11, float64, 2.9.1) (push) Has been cancelled
Tests on CPU (scheduled) / tests-cpu-windows (3.12, float32, 2.5.1) (push) Has been cancelled
Tests on CPU (scheduled) / tests-cpu-windows (3.12, float32, 2.9.1) (push) Has been cancelled
Tests on CPU (scheduled) / tests-cpu-windows (3.12, float64, 2.5.1) (push) Has been cancelled
Tests on CPU (scheduled) / tests-cpu-windows (3.12, float64, 2.9.1) (push) Has been cancelled
Tests on CPU (scheduled) / tests-cpu-windows (3.13, float32, 2.9.1) (push) Has been cancelled
Tests on CPU (scheduled) / tests-cpu-windows (3.13, float64, 2.9.1) (push) Has been cancelled
Tests on CPU (scheduled) / tests-cpu-mac (3.11, float32, 2.5.1) (push) Has been cancelled
Tests on CPU (scheduled) / tests-cpu-mac (3.11, float32, 2.9.1) (push) Has been cancelled
Tests on CPU (scheduled) / tests-cpu-mac (3.12, float32, 2.5.1) (push) Has been cancelled
Tests on CPU (scheduled) / tests-cpu-mac (3.12, float32, 2.9.1) (push) Has been cancelled
Tests on CPU (scheduled) / tests-cpu-mac (3.13, float32, 2.9.1) (push) Has been cancelled
Tests on CPU (scheduled) / coverage (push) Has been cancelled
Tests on CPU (scheduled) / typing (push) Has been cancelled
Tests on CPU (scheduled) / tutorials (push) Has been cancelled
Tests on CPU (scheduled) / docs (push) Has been cancelled
Lint / TOML Format (push) Has been cancelled
393 lines
11 KiB
TOML
393 lines
11 KiB
TOML
[build-system]
|
|
requires = ["hatchling"]
|
|
build-backend = "hatchling.build"
|
|
|
|
[project]
|
|
name = "kornia"
|
|
description = "Open Source Differentiable Computer Vision Library for PyTorch"
|
|
readme = "README.md"
|
|
requires-python = ">=3.11"
|
|
license = { text = "Apache-2.0" }
|
|
authors = [{ name = "Edgar Riba", email = "edgar@kornia.org" }]
|
|
keywords = ["computer vision", "deep learning", "pytorch"]
|
|
classifiers = [
|
|
"Development Status :: 4 - Beta",
|
|
"Environment :: Console",
|
|
"Environment :: GPU",
|
|
"Intended Audience :: Developers",
|
|
"Intended Audience :: Education",
|
|
"Intended Audience :: Information Technology",
|
|
"Intended Audience :: Science/Research",
|
|
"License :: OSI Approved :: Apache Software License",
|
|
"Natural Language :: English",
|
|
"Operating System :: OS Independent",
|
|
"Programming Language :: Python :: 3 :: Only",
|
|
"Programming Language :: Python :: 3.11",
|
|
"Programming Language :: Python :: 3.12",
|
|
"Programming Language :: Python :: 3.13",
|
|
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
"Topic :: Scientific/Engineering :: Image Processing",
|
|
"Topic :: Software Development :: Libraries",
|
|
]
|
|
dependencies = ["kornia_rs>=0.1.9", "numpy>=1.21", "packaging", "torch>=2.0.0"]
|
|
dynamic = ["version"]
|
|
|
|
[project.urls]
|
|
"Bug Tracker" = "https://github.com/kornia/kornia/issues"
|
|
Documentation = "https://kornia.readthedocs.io/en/latest"
|
|
Download = "https://github.com/kornia/kornia"
|
|
Homepage = "https://kornia.github.io/"
|
|
Issues = "https://github.com/kornia/kornia/issues"
|
|
"Source Code" = "https://github.com/kornia/kornia"
|
|
|
|
[project.optional-dependencies]
|
|
dev = [
|
|
"coverage",
|
|
"diffusers",
|
|
"ivy>=1.0.0.0",
|
|
"numpy<3",
|
|
"onnx",
|
|
"onnxruntime",
|
|
"onnxscript",
|
|
"pillow",
|
|
"pre-commit",
|
|
"pytest",
|
|
"pytest-cov",
|
|
"pytest-timeout",
|
|
"requests",
|
|
"ruff",
|
|
"setuptools", # For torch.compile
|
|
"transformers<5.6",
|
|
]
|
|
docs = [
|
|
"furo",
|
|
"ivy>=1.0.0.0",
|
|
"kornia_moons",
|
|
"matplotlib",
|
|
"onnx",
|
|
"onnxruntime",
|
|
"opencv-python",
|
|
"PyYAML>=5.1",
|
|
"sphinx",
|
|
"sphinx-autodoc-defaultargs",
|
|
"sphinx-autodoc-typehints",
|
|
"sphinx-copybutton>=0.3",
|
|
"sphinx-design",
|
|
"sphinx-notfound-page",
|
|
"sphinxcontrib-bibtex",
|
|
"sphinxcontrib-gtagjs",
|
|
"sphinxcontrib-youtube",
|
|
]
|
|
|
|
[tool.hatch.version]
|
|
path = "kornia/__init__.py"
|
|
|
|
[tool.hatch.build.targets.wheel]
|
|
packages = ["kornia"]
|
|
exclude = ["**/*.md"] # Exclude markdown files from wheel
|
|
|
|
[tool.hatch.build.targets.sdist]
|
|
include = ["kornia/", "LICENSE", "README.md"]
|
|
|
|
[tool.codespell]
|
|
ignore-words-list = "ans,hist,laf,cofusion"
|
|
skip = "*.bib,*.ipynb"
|
|
|
|
[tool.ruff]
|
|
target-version = "py311"
|
|
line-length = 120
|
|
|
|
[tool.ruff.format]
|
|
skip-magic-trailing-comma = false
|
|
|
|
[tool.ruff.lint]
|
|
select = [
|
|
"AIR", # Airflow
|
|
"ASYNC", # flake8-async
|
|
"B", # flake8-bugbear
|
|
"BLE", # flake8-blind-except
|
|
"C4", # flake8-comprehensions
|
|
"C90", # McCabe cyclomatic complexity
|
|
# "CPY", # Copyright-related rules
|
|
"DTZ", # flake8-datetimez
|
|
"E", # pycodestyle
|
|
"F", # Pyflakes
|
|
"FLY", # flynt
|
|
"I", # isort
|
|
"ICN", # flake8-import-conventions
|
|
"INT", # flake8-gettext
|
|
"NPY", # NumPy-specific rules
|
|
"PL", # Pylint
|
|
"PYI", # flake8-pyi
|
|
"RSE", # flake8-raise
|
|
"RUF", # Ruff-specific rules
|
|
"S", # flake8-bandit
|
|
"SLOT", # flake8-slots
|
|
"T10", # flake8-debugger
|
|
"TID", # flake8-tidy-imports
|
|
"UP", # pyupgrade
|
|
"W", # pycodestyle
|
|
"YTT", # flake8-2020
|
|
# "A", # flake8-builtins
|
|
# "ANN", # flake8-annotations
|
|
# "ARG", # flake8-unused-arguments
|
|
# "COM", # flake8-commas
|
|
"D", # pydocstyle
|
|
"D400", # missing-trailing-period
|
|
# "DJ", # flake8-django
|
|
# "EM", # flake8-errmsg
|
|
# "ERA", # eradicate
|
|
# "EXE", # flake8-executable
|
|
# "FA", # flake8-future-annotations
|
|
# "FBT", # flake8-boolean-trap
|
|
# "FIX", # flake8-fixme
|
|
# "G", # flake8-logging-format
|
|
# "INP", # flake8-no-pep420
|
|
# "ISC", # flake8-implicit-str-concat
|
|
# "N", # pep8-naming
|
|
# "PD", # pandas-vet
|
|
# "PERF", # Perflint
|
|
# "PGH", # pygrep-hooks
|
|
# "PIE", # flake8-pie
|
|
# "PT", # flake8-pytest-style
|
|
# "PTH", # flake8-use-pathlib
|
|
# "Q", # flake8-quotes
|
|
# "RET", # flake8-return
|
|
# "SIM", # flake8-simplify
|
|
# "SLF", # flake8-self
|
|
# "T20", # flake8-print
|
|
# "TCH", # flake8-type-checking
|
|
# "TD", # flake8-todos
|
|
# "TRY", # tryceratops
|
|
]
|
|
ignore = [
|
|
"B905", # `zip()` without explicit `strict=` - too many to fix, not a bug
|
|
"RUF007", # Prefer `itertools.pairwise()` over `zip()` - style preference
|
|
"PLR0915", # Allow condition check in list comprehension
|
|
"PLC0415", # `import` should be at the top-level of a file
|
|
"PLW2901", # Allow overwritten values on loops
|
|
"PLW1641", # Object does not implement `__hash__` method
|
|
"UP007", # Prefer Optional[], Union[] over | due to torch jit scripting
|
|
"UP006", # Prefer List[], over list due to torch jit scripting
|
|
"UP035", # Ignore deprecated typing because of jit scripting
|
|
"UP045", # Use `X | None` for type annotations
|
|
"RUF005", # Consider `(*points_in_cam_canonical.shape[:-1], 1)` instead of concatenation. Note: breaks JIT.
|
|
"D100", # Allow Undocumented public module
|
|
"D101", # TODO: Undocumented public class
|
|
"D102", # TODO: Undocumented public method
|
|
"D104", # TODO: Undocumented public package
|
|
"D105", # Allow Undocumented magic method
|
|
"D107", # TODO: Undocumented public init
|
|
]
|
|
|
|
[tool.ruff.lint.pydocstyle]
|
|
convention = "google"
|
|
|
|
[tool.ruff.lint.isort]
|
|
forced-separate = ["testing", "tests"]
|
|
known-first-party = ["kornia"]
|
|
split-on-trailing-comma = true
|
|
|
|
[tool.ruff.lint.mccabe]
|
|
max-complexity = 20
|
|
|
|
[tool.ruff.lint.pylint]
|
|
allow-magic-value-types = ["bytes", "float", "int", "str"]
|
|
max-args = 30 # Recommended: 5
|
|
max-branches = 21 # Recommended: 12
|
|
max-returns = 13 # Recommended: 6
|
|
max-statements = 64 # Recommended: 50
|
|
|
|
[tool.ruff.lint.per-file-ignores]
|
|
"*/__init__.py" = ["F401", "F403"] # Allow unused imports and star imports
|
|
"benchmarks/*" = [
|
|
"BLE",
|
|
"RUF005",
|
|
"RUF012",
|
|
"S101",
|
|
"S311",
|
|
"S603",
|
|
"D",
|
|
] # allow assert, random, subprocess calls, ignore BLE, mutable class attr
|
|
"docs/*" = [
|
|
"PLR0912",
|
|
"PLR0915",
|
|
"S101",
|
|
"D",
|
|
] # allow assert, ignore max branches and statements
|
|
"docs/generate_examples.py" = ["C901"] # Allow too complex function
|
|
"kornia/__init__.py" = ["I001"] # Allow unsorted imports
|
|
"kornia/feature/dedode/*" = [
|
|
"C408",
|
|
"F401",
|
|
"F841",
|
|
"FLY002",
|
|
"PLR1714",
|
|
] # allow DINOv2 things
|
|
"testing/*" = [
|
|
"S101", # allow assert
|
|
"D", # Don't enforce documentation rules
|
|
]
|
|
"tests/*" = [
|
|
"BLE",
|
|
"RUF005",
|
|
"RUF012",
|
|
"S101",
|
|
"S311",
|
|
"B017", # Check for Exception since KORNIA_CHECK raises it
|
|
"D", # Don't enforce documentation rules
|
|
] # allow assert, random, ignore BLE, mutable class attr
|
|
|
|
[tool.pytest.ini_options]
|
|
addopts = "--color=yes -v"
|
|
testpaths = ["tests"]
|
|
markers = [
|
|
"grad: mark a test as gradcheck test",
|
|
"jit: mark a test as torchscript test",
|
|
"nn: mark a test as module test",
|
|
"slow: mark test as slow to run",
|
|
"tf32: mark a test as sensitive to TF32 (TensorFloat-32) CUDA matmul precision; xfail by default, run with --tf32 to activate",
|
|
]
|
|
filterwarnings = [
|
|
"ignore::DeprecationWarning:onnxscript.converter",
|
|
]
|
|
# Test configuration via environment variables:
|
|
# KORNIA_TEST_DEVICE: cpu, cuda, mps (default: cpu)
|
|
# KORNIA_TEST_DTYPE: float32, float64, float16, bfloat16 (default: float32)
|
|
# KORNIA_TEST_OPTIMIZER: inductor, jit, etc. (default: inductor)
|
|
# KORNIA_TEST_RUNSLOW: true/false (default: false)
|
|
|
|
[tool.coverage.run]
|
|
branch = true
|
|
source = ["kornia/"]
|
|
omit = [
|
|
"*/__main__.py",
|
|
"*/setup.py",
|
|
"kornia/models/sam/*",
|
|
"kornia/models/sam3/*",
|
|
"kornia/models/siglip2/*",
|
|
"kornia/models/paligemma/*",
|
|
"kornia/models/kimi_vl/*",
|
|
"kornia/models/qwen25/*",
|
|
"kornia/models/smolvlm2/*",
|
|
"kornia/models/efficient_vit/*",
|
|
"kornia/models/rt_detr/*",
|
|
"kornia/models/depth_estimation/*",
|
|
"kornia/models/_hf_models/*",
|
|
"kornia/models/processors/*",
|
|
"kornia/models/vit.py",
|
|
"kornia/models/vit_mobile.py",
|
|
"kornia/models/tiny_vit.py",
|
|
# Feature model building blocks (vendored architectures)
|
|
"kornia/feature/adalam/*",
|
|
"kornia/feature/dedode/transformer/*",
|
|
"kornia/feature/dedode/dedode_models.py",
|
|
"kornia/feature/dedode/vgg.py",
|
|
"kornia/feature/loftr/loftr_module/*",
|
|
"kornia/feature/loftr/backbone/*",
|
|
"kornia/feature/loftr/utils/*",
|
|
"kornia/feature/sold2/backbones.py",
|
|
"kornia/feature/sold2/sold2_detector.py",
|
|
"kornia/feature/lightglue.py",
|
|
"kornia/feature/lightglue_onnx/*",
|
|
"kornia/feature/aliked/deform_conv2d.py",
|
|
"kornia/feature/disk/_unets/*",
|
|
"kornia/feature/defmo.py",
|
|
# DexiNed vendored architecture (building blocks only; high-level API in kornia/contrib/edge_detection.py is kept)
|
|
"kornia/filters/dexined.py",
|
|
"kornia/models/dexined.py",
|
|
# HuggingFace diffusers wrapper — requires diffusers as optional dep, not unit-testable as a filter
|
|
"kornia/filters/dissolving.py",
|
|
]
|
|
|
|
[tool.coverage.report]
|
|
show_missing = true
|
|
skip_covered = true
|
|
fail_under = 84
|
|
exclude_lines = [
|
|
# Based into the covdefaults plugin config
|
|
# a more strict default pragma
|
|
'\# pragma: no cover\b',
|
|
# allow defensive code
|
|
'^\s*raise AssertionError\b',
|
|
'^\s*raise NotImplementedError\b',
|
|
'^\s*return NotImplemented\b',
|
|
'^\s*raise$',
|
|
# typing-related code
|
|
'^\s*if (False|TYPE_CHECKING):',
|
|
': \.\.\.(\s*#.*)?$',
|
|
'^ +\.\.\.$',
|
|
# ----------------------------
|
|
"def __repr__",
|
|
"if __name__ == .__main__.:",
|
|
"if 0:",
|
|
"if self.debug:",
|
|
]
|
|
partial_branches = [
|
|
# a more strict default pragma
|
|
'\# pragma: no cover\b',
|
|
]
|
|
|
|
[tool.pydocstyle]
|
|
match = '.*\.py'
|
|
|
|
[tool.codeflash]
|
|
module-root = "kornia"
|
|
tests-root = "tests"
|
|
test-framework = "pytest"
|
|
ignore-paths = []
|
|
formatter-cmds = ["disabled"]
|
|
|
|
# =============================================================================
|
|
# uv configuration
|
|
# =============================================================================
|
|
# PyTorch: Use standard PyPI version (simpler, more compatible)
|
|
# For CUDA: pixi run -e cuda install (uses reinstall workaround)
|
|
# Note: uv doesn't support per-environment sources
|
|
|
|
# torch is installed from standard PyPI (no custom index needed)
|
|
|
|
[[tool.uv.index]]
|
|
name = "pytorch-cu121"
|
|
url = "https://download.pytorch.org/whl/cu121"
|
|
explicit = true
|
|
|
|
[[tool.uv.index]]
|
|
name = "pytorch-cu124"
|
|
url = "https://download.pytorch.org/whl/cu124"
|
|
explicit = true
|
|
|
|
[tool.ty.src]
|
|
include = ["kornia"]
|
|
exclude = ["tests", "docs", "conftest.py"]
|
|
|
|
[[tool.ty.overrides]]
|
|
include = ["kornia"]
|
|
|
|
[tool.ty.overrides.rules]
|
|
unresolved-import = "ignore"
|
|
unresolved-attribute = "ignore"
|
|
call-non-callable = "ignore"
|
|
invalid-argument-type = "ignore"
|
|
invalid-method-override = "ignore"
|
|
invalid-type-form = "ignore"
|
|
no-matching-overload = "ignore"
|
|
unsupported-operator = "ignore"
|
|
possibly-missing-attribute = "ignore"
|
|
not-subscriptable = "ignore"
|
|
# Silenced because ty has issues with:
|
|
# - Iterator[Enum] from metaclass __iter__ returning Iterator[object]
|
|
# - Scalar wrapper return types in geometry/plane.py
|
|
invalid-return-type = "ignore"
|
|
# Silenced because ty doesn't understand star unpacking with union types
|
|
# e.g., `[-i for i in unpadding]` where unpadding is int | tuple
|
|
# or `*images.shape, images.device` unpacking
|
|
not-iterable = "ignore"
|
|
# Silenced because ty struggles with:
|
|
# - Star unpacking assignments like `b, c, h, w, device = *tensor.shape, tensor.device`
|
|
# - dict containing partial() alongside type[nn.Module]
|
|
# - Attribute assignments with getattr fallback to None
|
|
invalid-assignment = "ignore"
|
|
# Silenced because KORNIA_UNWRAP intentionally uses cast for type narrowing
|
|
redundant-cast = "ignore"
|