--- id: svg-path version: "7.1" license: MIT license_treatment: permissive maintenance: active --- # svg.path — SVG path objects and parser License: permissive · Maintenance: active · Downloads: 2.7M/mo ## 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 above — 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 pip install svg-path uv add svg-path poetry add svg-path ## Installing 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_current - Install friction: low - Maintenance: active - Downloads: 2.7M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags svg path parser, bezier curve calculation, svg path manipulation, parse svg paths, path length calculation, svg geometry, path segment objects, svg-graphics, geometry-math [View on SkillFed](https://skillfed.io/packages/svg-path) · [View on PyPI](https://pypi.org/project/svg-path/)