svg.path
SVG path objects and parser
What it is and what it does
svg.path is a lightweight library for working with SVG path data. It provides four path segment classes—Line, Arc, CubicBezier, and QuadraticBezier—plus a Path container that acts as a mutable sequence. You can parse SVG path definition strings into Path objects, build paths programmatically from segment objects, and manipulate them by adding, replacing, or deleting segments. Coordinates are represented as complex numbers where the real part is X and the imaginary part is Y.
The library offers methods to find points along a path, calculate segment and total path length, check for smooth Bézier transitions, compute bounding boxes, and generate SVG path strings from Path objects. Length calculation for curved segments uses recursive approximation, which you can tune via an error parameter for speed-accuracy tradeoffs. The package has no external runtime dependencies and supports Python 3.8 and later.
Use it for:
- Parse and manipulate SVG path data in graphics processing or vector editing tools.
- Calculate the length of SVG paths or find coordinates at specific positions along curves.
- Convert between SVG path string format and programmatic path segment objects.
- Generate bounding boxes for SVG paths to determine spatial bounds.
- Build or modify SVG paths dynamically in web or graphics applications.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Parses SVG path definitions and provides objects to manipulate path segments (lines, arcs, cubic and quadratic Bézier curves) with methods to calculate length, find points along paths, and generate SVG path strings.
Yes. svg.path is a stable, actively maintained library with zero dependencies, permissive licensing, and no known vulnerabilities. It fills a specific need for SVG path manipulation in Python with a clean API. Install it if you work with SVG data or need to perform geometric calculations on path segments.
Install
svg-path on PyPI
pip
pip install svg-pathuv
uv add svg-pathpoetry
poetry add svg-pathInstalling svg.path
Before you install
Low install friction with no runtime dependencies. Actively maintained with a recent release and steady repository activity. Supports current Python versions (3.9, 3.10, 3.11, 3.12, 3.13) and PyPy.
License in practice
MIT license permits commercial and private use with minimal restrictions; you may use, modify, and distribute the code provided you retain the license notice.
Quickstart
from svg.path import parse_path, Path, Line, CubicBezier
# Parse an SVG path string
path = parse_path('M 100 100 L 300 100 L 200 300 z')
# Or build from objects
path = Path(Line(100+100j, 300+100j), CubicBezier(300+100j, 100+100j, 200+200j, 200+300j))
# Get a point along the path
point = path.point(0.5)
# Calculate path length
length = path.length(error=1e-5)
Calculating length for CubicBezier and Arc segments uses geometric approximation and may be slow without tuning the error parameter; default error is 1e-12.
Verify before relying
- Whether the package handles all SVG path command variations correctly in production use.
- Performance characteristics when working with very large or complex paths.
- Completeness of internal consistency checks when manipulating paths programmatically.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 38 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,702,687/month — #2,935 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: svg_path-7.1-py2.py3-none-any.whl
Keywords: svg, path, maths
Tags
More Graphics packages
Pillow adds image processing capabilities to…
permissive · top 100 on PyPI
fonttoolsfonttools manipulates font files in multiple…
permissive · top 1,000 on PyPI
matplotlib-inlineEnables matplotlib figures to display inline…
permissive · top 1,000 on PyPI
pymupdfPyMuPDF extracts, renders, converts, and…
agpl · top 1,000 on PyPI
pypdfium2pypdfium2 is a Python binding to PDFium that…
permissive · top 1,000 on PyPI
altairAltair is a declarative Python library for…
permissive · top 1,000 on PyPI
pyclothoidsPyclothoids provides a Python interface to…
unclear · top 15,000 on PyPI
svgelementssvgelements parses SVG files and provides…
permissive · top 5,000 on PyPI
svgpathtoolsReads, writes, and analyzes SVG Path objects…
permissive · top 5,000 on PyPI
cu2quConverts cubic Bézier curves to quadratic…
permissive · top 15,000 on PyPI
drawsvgProgrammatically generate SVG images and…
permissive · top 5,000 on PyPI
pathablePathable provides path-like objects for…
permissive · top 1,000 on PyPI
svglibSvglib reads SVG files and converts them to…
copyleft · top 5,000 on PyPI
dash-svgProvides SVG component primitives (Svg, G,…
permissive · top 15,000 on PyPI
ocpsvgConverts between SVG path strings and…
unclear · top 15,000 on PyPI
furlfurl parses and manipulates URLs by providing a…
permissive · top 5,000 on PyPI