skillfed

svg.path

SVG path objects and parser

svg-path v7.1 2.7M downloads/30d#2,935 on PyPI242
Permissive license MIT Active released

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-path

uv

uv add svg-path

poetry

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 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: PyPyTopic :: Multimedia :: Graphics

Tags

svg path parserbezier curve calculationsvg path manipulationparse svg pathspath length calculationsvg geometrypath segment objects
svg-graphicsgeometry-math

More Graphics packages