Skip to main content

svg.py

Python library to generate SVG files.

Features:

  • Compatible with all SVG standards: 1.1, 1.2, 2.0, Tiny.
  • 100% type safe.
  • Pure Python.
  • No third-party runtime dependencies.
  • No deprecated attributes, only what actually works.
  • The same names and structure as in the standard. If you know how to write SVG files, you know how to use this library.

Based on svg-xsd-schema and MDN reference.

Installation

python3 -m pip install --user svg.py

Usage

Try svg.py online: svg.orsinium.dev.

import svg
canvas = svg.SVG(
    width=60,
    height=60,
    elements=[
        svg.Circle(
            cx=30, cy=30, r=20,
            stroke="red",
            fill="white",
            stroke_width=5,
        ),
    ],
)
print(canvas)

See examples for more.

Projects using svg.py

The github topic svg-py contains some of the projects that use svg.py in one way or another. If you want your project to appear on the list, simply add svg-py into the list of project topics. Here is how.

Release files for svg.py 1.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for svg.py 1.10.0
File Size Uploaded
svg_py-1.10.0.tar.gz 43.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for svg.py 1.10.0
File Interpreter ABI Platform
svg_py-1.10.0-py3-none-any.whl Python 3 none any Details

Total release size: 59.0 kB

Release files / svg_py-1.10.0.tar.gz

Download URL svg_py-1.10.0.tar.gz
Size 43.8 kB
Tags Source
SHA-256 checksum
How to use checksums
2e1391411a205220a0e72ca303f3c2d11dbd564cb1dbc445406c5e11421bcc4b
BLAKE2b-256 checksum
How to use checksums
bc1ef36612d46266942c351de904bd9928610c485baee61220892277ac37be65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.3

Release files / svg_py-1.10.0-py3-none-any.whl

Download URL svg_py-1.10.0-py3-none-any.whl
Size 15.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
54c7470347d5d79b30d059584a4f449da08b462903e8ce262981338bab755560
BLAKE2b-256 checksum
How to use checksums
189f77a405e7b2a334ce774835263c3374d4ed307a3473f3925d9990a8c029e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.3

Release history Release notifications | RSS feed

This release

1.10.0 This release

2 release files

1.9.2

2 release files

1.9.1

2 release files

1.9.0

2 release files

1.8.0

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.3

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page