[project] name = "vectorhd" version = "0.2.10" description = "Tier-1 HD-mode server-side image vectorization: segmentation-driven, topology-aware, sub-pixel accurate SVG tracing." readme = "README.md" requires-python = ">=3.11" license = { text = "MIT" } authors = [{ name = "VectorHD" }] # Core dependencies. Everything here must install and run CPU-only. # torch is listed as a core dep (device detection + optional refine hook), CPU wheels by default. dependencies = [ "numpy>=1.26,<3", "scipy>=1.11", "scikit-image>=0.22", "opencv-python-headless>=4.9", "pillow>=10.2", "fastapi>=0.110", "uvicorn[standard]>=0.29", "pydantic>=2.6", "pydantic-settings>=2.2", "python-multipart>=0.0.9", "torch>=2.2", ] [project.optional-dependencies] # `[sam]` — SAM 2 automatic mask segmentation backend. # SAM 2 is distributed ONLY from GitHub (facebookresearch/sam2). It is intentionally NOT a # resolvable dependency here: its setup imports torch at build time and registers under the # name `SAM-2`, so listing it as a git ref breaks even a plain `uv sync` (which resolves all # extras for the lockfile). It is also security-sensitive — the PyPI `sam2` package is an # unofficial third-party upload; do not use it. Install manually from the official repo: # git clone https://github.com/facebookresearch/sam2.git # cd sam2 && SAM2_BUILD_CUDA=0 pip install -e . # or: uv pip install --no-build-isolation -e . # Weights: `python scripts/download_weights.py`. This extra is a marker only; the backend # imports sam2 lazily and degrades gracefully when absent. sam = [] # `[refine]` — DiffVG differentiable rasterizer for gradient-based refinement. # The native `diffvg` C-extension + the `pydiffvg` wrapper are built from source (CMake + git # submodules; see README "DiffVG refinement") and are NOT pip-resolvable, so they stay out of # this list. But `pydiffvg`'s own pure-Python runtime deps ARE resolvable and are pinned here so # `uv pip install -e .[refine]` provides everything except the two vendored/built packages. # The runtime imports pydiffvg lazily and degrades gracefully when absent. refine = ["svgpathtools>=1.6", "svgwrite>=1.4", "cssutils>=2.9", "matplotlib>=3.7"] [dependency-groups] dev = [ "pytest>=8.1", "ruff>=0.4", "cairosvg>=2.7", "httpx>=0.27", "pyyaml>=6", "maturin>=1.14.1", # Corpus v1 evaluation. `svgpathtools` parses arbitrary third-party SVG into arclength- # samplable paths, which is how ground-truth outlines are recovered from a source SVG; it also # appears under the deprecated `[refine]` (DiffVG) extra, but the corpus must not depend on a # deprecated optional extra to run. `fonttools` renders open-font glyphs to outline paths for # the generated wordmark category. Both are evaluation-side only — never imported by `src/`. "svgpathtools>=1.6", "fonttools>=4.5", ] [build-system] requires = ["hatchling"] build-backend = "hatchling.build" [tool.hatch.build.targets.wheel] packages = ["src/vectorhd"] # The deploy build stamp, force-included because it is GITIGNORED (see .gitignore and # docs/deploy/huggingface.md). Hatchling's file selection is VCS-ignore-aware, so without this the # stamp is silently dropped from the wheel: measured, a wheel built with the file present shipped # `build_info.py` and NOT `build_info.json`. That failure is invisible — /healthz would report # `"build": null` on a correctly stamped deploy, which is exactly the "is this build what I think # it is?" ambiguity the stamp exists to remove. `artifacts` includes VCS-ignored paths explicitly, # so inclusion no longer depends on whether a .git happens to be present at build time (it is not, # inside the container, which is how this could have shipped working by accident and broken later). artifacts = ["src/vectorhd/build_info.json"] [tool.uv] default-groups = ["dev"] [tool.ruff] line-length = 100 target-version = "py311" src = ["src", "tests", "scripts"] [tool.ruff.lint] select = ["E", "F", "I", "UP", "B", "W", "C4", "SIM"] ignore = [ "B008", # FastAPI Depends()/File() in defaults is idiomatic "E741", # ambiguous var names (l, r for left/right labels are meaningful here) ] [tool.ruff.lint.per-file-ignores] "tests/*" = ["E501"] "scripts/*" = ["E501"] [tool.pytest.ini_options] testpaths = ["tests"] addopts = "-q" filterwarnings = [ "ignore::DeprecationWarning", ]