Rust SVG path editing, optimization, matrix geometry, measurement, sanitization, viewport editing, validation, tracing, and centerline reconstruction with Python bindings.
Project description
svgo
svgo is now implemented in Rust. The Python package is a thin PyO3-backed
binding layer, and all SVG/path/tracing/centerline work is delegated to the
native svgo._svgo extension. A Rust svgo binary target is also provided for
CLI use.
The project intentionally does not preserve the old pure-Python internals.
What It Does
- Parses, serializes, transforms, reverses, re-origins, optimizes, and converts SVG path data.
- Optimizes SVG documents with built-in SVGO-style cleanup passes.
- Converts basic SVG shapes to paths, flattens transforms, inlines styles, sanitizes unsafe content, edits viewBox/viewport data, and reports metadata.
- Measures path/SVG bounds, lengths, and point-at-length coordinates.
- Traces simple PNG icons into SVG paths in Rust.
- Provides VTracer-style tracing controls through the native Rust tracer.
- Reconstructs approximate centerline strokes from filled outlines with a Rust rasterize/skeletonize/trace pipeline.
Layout
rust/src/lib.rs: Rust implementation plus PyO3 exports.rust/src/bin/svgo.rs: Rust CLI binary target.src/svgo/*.py: thin Python shims and dataclass option wrappers.tests/: Python tests that exercise the Rust-backed package surface.
Build
Use uv for Python commands.
uv run --no-project --with maturin maturin build --manifest-path Cargo.toml --out dist
On Windows, the GNU build used during local verification required:
- Rust toolchain:
stable-x86_64-pc-windows-gnu - MinGW/binutils on
PATH(dlltool, linker runtime DLLs)
The Rust binary can be built directly:
cargo build --bin svgo
Test
uv run --no-sync python -m unittest discover -s tests
Python API
The familiar top-level imports remain as thin wrappers:
from svgo import PathData, optimize_svg, path_metrics, trace_png
path = PathData.parse("M0 0H10V10Z")
path.apply_operation("translate:2,3")
print(path.to_string(decimals=2, minify=True))
Those wrappers perform marshaling only. The computation happens in Rust.
CLI
The Rust binary target supports the existing short command family:
target\debug\svgo.exe path --path "M10 10h5v5z" --op optimize:safe --minify
target\debug\svgo.exe opt --input icon.svg --output icon.min.svg
target\debug\svgo.exe trace --input icon.png --output traced.svg
target\debug\svgo.exe center --path "M0 0L30 0L30 6L0 6Z" --emit d
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file svgo-0.2.0.tar.gz.
File metadata
- Download URL: svgo-0.2.0.tar.gz
- Upload date:
- Size: 62.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4510a1b97dfb0550acb8e471e427f87b6314f477d0ede506c406fbe5648425d6
|
|
| MD5 |
fe148ea4d4995351191d079850ab320c
|
|
| BLAKE2b-256 |
8fb3c0e90743c6af4f6be86740c3a9c529202b3f4f1ee3a11e7058f9af1a0c52
|
Provenance
The following attestation bundles were made for svgo-0.2.0.tar.gz:
Publisher:
publish.yml on xmodar/svgo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
svgo-0.2.0.tar.gz -
Subject digest:
4510a1b97dfb0550acb8e471e427f87b6314f477d0ede506c406fbe5648425d6 - Sigstore transparency entry: 1986976785
- Sigstore integration time:
-
Permalink:
xmodar/svgo@f0ebc4a89b0051d1f80f0d38edb235f1a2b07019 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/xmodar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f0ebc4a89b0051d1f80f0d38edb235f1a2b07019 -
Trigger Event:
push
-
Statement type:
File details
Details for the file svgo-0.2.0-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: svgo-0.2.0-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 703.0 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71bdb60f257c49a183d2b68509564d94a6bd30a1e754ea8772c9e790547f0756
|
|
| MD5 |
d4980c41b9739c173c2c46debf4579d5
|
|
| BLAKE2b-256 |
f454dfc22828a34c532f36d96cdbff054dec90d63357107bf835d5d12ca5d856
|
Provenance
The following attestation bundles were made for svgo-0.2.0-cp312-cp312-win_amd64.whl:
Publisher:
publish.yml on xmodar/svgo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
svgo-0.2.0-cp312-cp312-win_amd64.whl -
Subject digest:
71bdb60f257c49a183d2b68509564d94a6bd30a1e754ea8772c9e790547f0756 - Sigstore transparency entry: 1986977093
- Sigstore integration time:
-
Permalink:
xmodar/svgo@f0ebc4a89b0051d1f80f0d38edb235f1a2b07019 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/xmodar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f0ebc4a89b0051d1f80f0d38edb235f1a2b07019 -
Trigger Event:
push
-
Statement type:
File details
Details for the file svgo-0.2.0-cp312-cp312-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: svgo-0.2.0-cp312-cp312-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 862.1 kB
- Tags: CPython 3.12, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52fa71228c8ec38f3276a326dae813eb53560f725a468af3bf3abe7892d41f74
|
|
| MD5 |
379c50fff2e52c4b751b1d4d50a59516
|
|
| BLAKE2b-256 |
c14d73eb64e37d89d408e2a15d1fd906013db71f88e564f218b7b93810e60572
|
Provenance
The following attestation bundles were made for svgo-0.2.0-cp312-cp312-manylinux_2_28_x86_64.whl:
Publisher:
publish.yml on xmodar/svgo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
svgo-0.2.0-cp312-cp312-manylinux_2_28_x86_64.whl -
Subject digest:
52fa71228c8ec38f3276a326dae813eb53560f725a468af3bf3abe7892d41f74 - Sigstore transparency entry: 1986977252
- Sigstore integration time:
-
Permalink:
xmodar/svgo@f0ebc4a89b0051d1f80f0d38edb235f1a2b07019 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/xmodar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f0ebc4a89b0051d1f80f0d38edb235f1a2b07019 -
Trigger Event:
push
-
Statement type:
File details
Details for the file svgo-0.2.0-cp312-cp312-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: svgo-0.2.0-cp312-cp312-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 826.7 kB
- Tags: CPython 3.12, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43cedbcbc4660b0b8b47cbbdb093edcd14a8efbeb0e09e2384987f58075de778
|
|
| MD5 |
82909c64078f339762a256b840311fb3
|
|
| BLAKE2b-256 |
036e95527d061b949c94f7f6eb50bab534f036c38def6915f390738eeff3045b
|
Provenance
The following attestation bundles were made for svgo-0.2.0-cp312-cp312-manylinux_2_28_aarch64.whl:
Publisher:
publish.yml on xmodar/svgo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
svgo-0.2.0-cp312-cp312-manylinux_2_28_aarch64.whl -
Subject digest:
43cedbcbc4660b0b8b47cbbdb093edcd14a8efbeb0e09e2384987f58075de778 - Sigstore transparency entry: 1986976847
- Sigstore integration time:
-
Permalink:
xmodar/svgo@f0ebc4a89b0051d1f80f0d38edb235f1a2b07019 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/xmodar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f0ebc4a89b0051d1f80f0d38edb235f1a2b07019 -
Trigger Event:
push
-
Statement type:
File details
Details for the file svgo-0.2.0-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: svgo-0.2.0-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 762.9 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77279aeab2b84af0135f56d719028631b193bb237b872031e7f9f869f6e23317
|
|
| MD5 |
8ab46970b970150074083bd1d9d36db5
|
|
| BLAKE2b-256 |
c91dbc7b704ce0ae5aaea67fda876931caa39a4249ee3509191f85098970f095
|
Provenance
The following attestation bundles were made for svgo-0.2.0-cp312-cp312-macosx_11_0_arm64.whl:
Publisher:
publish.yml on xmodar/svgo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
svgo-0.2.0-cp312-cp312-macosx_11_0_arm64.whl -
Subject digest:
77279aeab2b84af0135f56d719028631b193bb237b872031e7f9f869f6e23317 - Sigstore transparency entry: 1986977519
- Sigstore integration time:
-
Permalink:
xmodar/svgo@f0ebc4a89b0051d1f80f0d38edb235f1a2b07019 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/xmodar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f0ebc4a89b0051d1f80f0d38edb235f1a2b07019 -
Trigger Event:
push
-
Statement type:
File details
Details for the file svgo-0.2.0-cp312-cp312-macosx_10_12_x86_64.whl.
File metadata
- Download URL: svgo-0.2.0-cp312-cp312-macosx_10_12_x86_64.whl
- Upload date:
- Size: 802.1 kB
- Tags: CPython 3.12, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc14ac821a111b598a2268c8a8e6a7510b7975ec376f2e38c73ff8dd30d7d9c4
|
|
| MD5 |
960565f679a6485a0f2f6dc7a7fa6d5d
|
|
| BLAKE2b-256 |
234aebb14d1efa7e0b2aa21ac214da87f74b94cf2f55a7efba1f07853c262da2
|
Provenance
The following attestation bundles were made for svgo-0.2.0-cp312-cp312-macosx_10_12_x86_64.whl:
Publisher:
publish.yml on xmodar/svgo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
svgo-0.2.0-cp312-cp312-macosx_10_12_x86_64.whl -
Subject digest:
dc14ac821a111b598a2268c8a8e6a7510b7975ec376f2e38c73ff8dd30d7d9c4 - Sigstore transparency entry: 1986977172
- Sigstore integration time:
-
Permalink:
xmodar/svgo@f0ebc4a89b0051d1f80f0d38edb235f1a2b07019 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/xmodar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f0ebc4a89b0051d1f80f0d38edb235f1a2b07019 -
Trigger Event:
push
-
Statement type:
File details
Details for the file svgo-0.2.0-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: svgo-0.2.0-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 706.7 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3254a38d6ce26bde977eba4f466d2a0332b9261aa18ac8e34e0b0e0a57e6f2f8
|
|
| MD5 |
0c96f41c0f2fd8fe68de42b73547d5cd
|
|
| BLAKE2b-256 |
ce303d8e0163848a2e37fc7b8d6d6ff665b03f7cd47eee7e6974d0775b0fe987
|
Provenance
The following attestation bundles were made for svgo-0.2.0-cp311-cp311-win_amd64.whl:
Publisher:
publish.yml on xmodar/svgo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
svgo-0.2.0-cp311-cp311-win_amd64.whl -
Subject digest:
3254a38d6ce26bde977eba4f466d2a0332b9261aa18ac8e34e0b0e0a57e6f2f8 - Sigstore transparency entry: 1986977582
- Sigstore integration time:
-
Permalink:
xmodar/svgo@f0ebc4a89b0051d1f80f0d38edb235f1a2b07019 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/xmodar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f0ebc4a89b0051d1f80f0d38edb235f1a2b07019 -
Trigger Event:
push
-
Statement type:
File details
Details for the file svgo-0.2.0-cp311-cp311-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: svgo-0.2.0-cp311-cp311-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 867.8 kB
- Tags: CPython 3.11, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19df937c1231ed31770fb8ef6e073f6ad77eb4b3a425432b0fd7c2f03680b1c5
|
|
| MD5 |
2160341498375aebe5cba561ec6aaf26
|
|
| BLAKE2b-256 |
7956c0a48b98b4d669ce766f5d64d5c62659897a6b36aa62061c786f19dee8d3
|
Provenance
The following attestation bundles were made for svgo-0.2.0-cp311-cp311-manylinux_2_28_x86_64.whl:
Publisher:
publish.yml on xmodar/svgo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
svgo-0.2.0-cp311-cp311-manylinux_2_28_x86_64.whl -
Subject digest:
19df937c1231ed31770fb8ef6e073f6ad77eb4b3a425432b0fd7c2f03680b1c5 - Sigstore transparency entry: 1986977448
- Sigstore integration time:
-
Permalink:
xmodar/svgo@f0ebc4a89b0051d1f80f0d38edb235f1a2b07019 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/xmodar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f0ebc4a89b0051d1f80f0d38edb235f1a2b07019 -
Trigger Event:
push
-
Statement type:
File details
Details for the file svgo-0.2.0-cp311-cp311-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: svgo-0.2.0-cp311-cp311-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 830.9 kB
- Tags: CPython 3.11, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74f0abc9f37cacdfe491550a8a9623b9a86ba4ac1f18fbdef1376b779eac64bc
|
|
| MD5 |
c44cbacde692f1e5a0b4ef6bbdd54d70
|
|
| BLAKE2b-256 |
a8939e0b97c97a42c4c108ffbaef8df8677685bfbb0202400dc1de0f5d024ae8
|
Provenance
The following attestation bundles were made for svgo-0.2.0-cp311-cp311-manylinux_2_28_aarch64.whl:
Publisher:
publish.yml on xmodar/svgo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
svgo-0.2.0-cp311-cp311-manylinux_2_28_aarch64.whl -
Subject digest:
74f0abc9f37cacdfe491550a8a9623b9a86ba4ac1f18fbdef1376b779eac64bc - Sigstore transparency entry: 1986977014
- Sigstore integration time:
-
Permalink:
xmodar/svgo@f0ebc4a89b0051d1f80f0d38edb235f1a2b07019 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/xmodar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f0ebc4a89b0051d1f80f0d38edb235f1a2b07019 -
Trigger Event:
push
-
Statement type:
File details
Details for the file svgo-0.2.0-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: svgo-0.2.0-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 769.2 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6559a3dbaa713ec12d9bd59fb78e7536037269b2b6a16785e111bd449b254d22
|
|
| MD5 |
fe606e1a4b41847c2ca50c7674a80b49
|
|
| BLAKE2b-256 |
534f925e3ae8bbc8628c3701c26901122dd9edd9b6b97a70d5a89e8d8c16f9d9
|
Provenance
The following attestation bundles were made for svgo-0.2.0-cp311-cp311-macosx_11_0_arm64.whl:
Publisher:
publish.yml on xmodar/svgo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
svgo-0.2.0-cp311-cp311-macosx_11_0_arm64.whl -
Subject digest:
6559a3dbaa713ec12d9bd59fb78e7536037269b2b6a16785e111bd449b254d22 - Sigstore transparency entry: 1986976929
- Sigstore integration time:
-
Permalink:
xmodar/svgo@f0ebc4a89b0051d1f80f0d38edb235f1a2b07019 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/xmodar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f0ebc4a89b0051d1f80f0d38edb235f1a2b07019 -
Trigger Event:
push
-
Statement type:
File details
Details for the file svgo-0.2.0-cp311-cp311-macosx_10_12_x86_64.whl.
File metadata
- Download URL: svgo-0.2.0-cp311-cp311-macosx_10_12_x86_64.whl
- Upload date:
- Size: 800.6 kB
- Tags: CPython 3.11, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc3d728d8d8c3a286d5b0ca2ab528e9132e65a65cca72de48c8926c67b98de98
|
|
| MD5 |
98cca74c63f113b4a879666283747dad
|
|
| BLAKE2b-256 |
e420b3889a4c3f68f6a6028afd56eee4e58b61f7675bdb84ccbdcf12fd98f61d
|
Provenance
The following attestation bundles were made for svgo-0.2.0-cp311-cp311-macosx_10_12_x86_64.whl:
Publisher:
publish.yml on xmodar/svgo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
svgo-0.2.0-cp311-cp311-macosx_10_12_x86_64.whl -
Subject digest:
bc3d728d8d8c3a286d5b0ca2ab528e9132e65a65cca72de48c8926c67b98de98 - Sigstore transparency entry: 1986977353
- Sigstore integration time:
-
Permalink:
xmodar/svgo@f0ebc4a89b0051d1f80f0d38edb235f1a2b07019 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/xmodar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f0ebc4a89b0051d1f80f0d38edb235f1a2b07019 -
Trigger Event:
push
-
Statement type: