{"id":7722,"library":"skia-pathops","title":"skia-pathops: Skia Path Operations for Python","description":"skia-pathops is a Python library that provides access to boolean operations on 2D vector paths using Google's Skia graphics library. It's currently at version 0.9.2, seeing relatively frequent updates that often align with upstream Skia library changes or Python version support.","status":"active","version":"0.9.2","language":"en","source_language":"en","source_url":"https://github.com/fonttools/skia-pathops","tags":["graphics","paths","skia","geometry","fonttools","vector"],"install":[{"cmd":"pip install skia-pathops","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"symbol":"Path","correct":"from skia_pathops import Path"},{"symbol":"PathOp","correct":"from skia_pathops import PathOp"},{"symbol":"OpBuilder","correct":"from skia_pathops import OpBuilder"}],"quickstart":{"code":"from skia_pathops import Path, PathOp, OpBuilder\n\n# Create two simple paths\npath1 = Path()\npath1.moveTo(0, 0)\npath1.lineTo(100, 0)\npath1.lineTo(100, 100)\npath1.lineTo(0, 100)\npath1.close()\n\npath2 = Path()\npath2.moveTo(50, 50)\npath2.lineTo(150, 50)\npath2.lineTo(150, 150)\npath2.lineTo(50, 150)\npath2.close()\n\n# Perform a union operation\nbuilder = OpBuilder()\nbuilder.op(path1, path2, PathOp.UNION)\nunion_path = builder.resolve().pop() # resolve returns a list of paths\n\nprint(f\"Original path 1 contour count: {len(path1.getContours())}\")\nprint(f\"Original path 2 contour count: {len(path2.getContours())}\")\nprint(f\"Union path contour count: {len(union_path.getContours())}\")\n\n# You can inspect the points of the resulting path (simplified output)\nfirst_contour_points = union_path.getContours()[0].points\nprint(f\"First contour points (first 3): {first_contour_points[:3]}\")","lang":"python","description":"This quickstart demonstrates how to create two simple rectangular paths and perform a union operation using `OpBuilder`. The result is a new `Path` object representing the combined shape."},"warnings":[{"fix":"Upgrade Python to 3.10 or newer, or `pip install 'skia-pathops<0.9.0'`.","message":"Python 3.8 and 3.9 support was dropped in `v0.9.0`. Users on these Python versions must either upgrade their Python environment or pin to an older `skia-pathops` version.","severity":"breaking","affected_versions":">=0.9.0"},{"fix":"Upgrade Python to 3.8 or newer, or `pip install 'skia-pathops<0.8.0'`.","message":"Python 3.7 support was dropped in `v0.8.0`. Users on Python 3.7 must upgrade their Python environment or use an older `skia-pathops` version.","severity":"breaking","affected_versions":">=0.8.0"},{"fix":"Before `pip install`, set `export BUILD_SKIA_FROM_SOURCE=0` (Linux/macOS) or `$env:BUILD_SKIA_FROM_SOURCE=0` (PowerShell) to disable embedded Skia build.","message":"When building from source, `skia-pathops` typically bundles and compiles `libskia`. To use a system-installed or externally compiled `libskia` instead, you must set the `BUILD_SKIA_FROM_SOURCE=0` environment variable.","severity":"gotcha","affected_versions":"all"},{"fix":"Update custom `PathPen` implementations to handle variable arguments for `curveTo` (4 or 6 points) and `qCurveTo` (2 or 4 points) as per the updated BasePen protocol.","message":"The `PathPen` interface's `curveTo` and `qCurveTo` methods changed to support a variable number of points, aligning with the fontTools BasePen protocol. This can break custom `Pen` implementations.","severity":"breaking","affected_versions":">=0.7.4"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Upgrade Python to 3.10 or newer. Check `skia-pathops` PyPI page for supported Python versions and platforms. If you need older Python, `pip install 'skia-pathops<0.9.0'` (for 3.8/3.9) or `'skia-pathops<0.8.0'` (for 3.7).","cause":"Your Python version is too old for the latest `skia-pathops` releases, or no wheel is available for your platform/Python combination.","error":"ERROR: Could not find a version that satisfies the requirement skia-pathops (from versions: none)"},{"fix":"Ensure you've run `pip install skia-pathops` in your active environment. Verify the import is `from skia_pathops import ...`.","cause":"The package `skia-pathops` was either not installed, or installed in a different Python environment, or there's a typo in the import statement.","error":"ModuleNotFoundError: No module named 'skia_pathops'"},{"fix":"Install the 'Desktop development with C++' workload via the Visual Studio Installer (Community Edition is free), or specifically the 'Microsoft C++ Build Tools'. Alternatively, ensure your Python version has an available wheel, or use the `BUILD_SKIA_FROM_SOURCE=0` approach if you have a pre-built Skia library.","cause":"You are on Windows and `pip` is attempting to build `skia-pathops` from source because no pre-built wheel is available for your specific Python version/architecture. Building C extensions requires C++ compilers.","error":"error: Microsoft Visual C++ 14.0 or greater is required. Get it with \"Microsoft C++ Build Tools\": https://visualstudio.microsoft.com/visual-cpp-build-tools/"}]}