univector
univector brings UniVector’s Nim graphics engine to Python through its C ABI.
It can parse or construct SVG-style paths, inspect and flatten their geometry,
render solid fills into RGBA8 images, and produce SVG or PNG bytes.
The SVG support is deliberately path-focused: Path.parse_d() reads path data,
and Path.to_svg() writes a minimal document containing one solid-filled path.
It does not parse arbitrary SVG documents or preserve SVG scene structure,
styles, transforms, strokes, gradients, text, or external resources.
Install
python -m pip install univector
Wheels are built for CPython 3.10–3.14 on Linux, macOS, and Windows. A source
installation needs Nim and Nimble on PATH, a supported C compiler, and the
platform's zlib development package because it compiles the vendored Nim
engine and its PNG support:
python -m pip install --no-binary univector univector
For a repository checkout:
nimble pyLib
cd py
python -m pip install -e ".[test]"
python -m pytest -q
Draw once, emit SVG and PNG
import univector
path = univector.Path()
path.rounded_rect(8, 8, 48, 48, 6, 6, 6, 6)
path.circle(32, 32, 12)
color = univector.Color.parse("oklch(62% 0.17 255)")
image = univector.Image(64, 64)
prepared = path.prepare()
image.fill_prepared(prepared, color,
winding=univector.WINDING_EVEN_ODD)
# For one-off rendering, use image.fill(path, color, winding=...) instead.
png_bytes = image.encode_png()
svg_text = path.to_svg(color, 64, 64)
Image.pixels() returns a Python bytes copy in row-major RGBA order.
encode_png() returns complete PNG bytes; to_svg() returns a standalone SVG
string whose view box matches the raster dimensions.
Parse and inspect paths
path = univector.Path.parse_d("M 10 10 C 20 0 40 0 50 10 Z")
print(path.current) # (10.0, 10.0), because Z closes the subpath
print(path.commands) # [(kind, parameters), ...]
print(path.flatten(0.25)) # [((x0, y0), (x1, y1)), ...]
print(path.bounds(0.25)) # (x, y, width, height)
prepared = path.prepare(0.25)
print(prepared.bounds)
print(prepared.segments) # immutable tuple snapshot
outline = prepared.stroke(2, cap=univector.CAP_ROUND,
join=univector.JOIN_BEVEL)
dashed = prepared.stroke(2, dashes=[6, 3], dash_offset=1)
mesh = prepared.tessellate_fill(univector.WINDING_NON_ZERO)
stroke_mesh = prepared.tessellate_stroke(2, cap=univector.CAP_ROUND)
print(mesh.triangle_count, mesh.vertices, mesh.indices)
The tolerance is the subdivision threshold used against each curve span. A
smaller value produces more segments and generally smoother edges at a higher cost.
Passing 0.0 selects FLATTEN_TOLERANCE.
Plot markers
diamond = univector.marker_path(univector.MARKER_DIAMOND, (24, 16), 8)
squares = univector.markers_path(
univector.MARKER_SQUARE, [(8, 8), (16, 12), (24, 10)], 5)
circles = univector.markers_path_sized(
univector.MARKER_CIRCLE, [(8, 8), (16, 12), (24, 10)], [3, 5, 7])
Marker size is the full width and height. Available shapes are circle, square,
triangle, diamond, plus, and cross. Batch constructors return one fill-ready
Path; the sized variant requires one strictly positive size per point.
Geometry helpers
mid = univector.quad_point((0, 0), (1, 1), (2, 0), 0.5)
point = univector.cubic_point((0, 0), (0, 1), (1, 1), (1, 0), 0.25)
assert univector.is_relative(univector.PATH_REL_LINE)
assert univector.parameter_count(univector.PATH_CUBIC) == 6
quad_point and cubic_point require t in [0, 1]. Path command constants
run from PATH_CLOSE through PATH_REL_ARC; each command returned by
Path.commands uses one of those constants and contains only its meaningful
parameters.
API summary
Path:move_to,line_to,bezier_curve_to,quadratic_curve_to,elliptical_arc_to,arc,arc_to,rect,rounded_rect,ellipse,circle,polygon,close_path,add_path,copy,parse_d,to_d,to_svg,flatten,prepare,bounds,current,start, andcommands.PreparedPath:segments,bounds,tolerance,stroke,tessellate_fill,tessellate_stroke, andlen.VectorMesh:vertices,indices, andtriangle_count.Image:width,height,channels,pixels,fill,fill_prepared, andencode_png.Color:parse,rgba, andto_svg.- Geometry:
quad_point,cubic_point, andcompute_bounds. - Plot geometry:
marker_path,markers_path,markers_path_sized, and theMARKER_*constants.PreparedPath.strokeandtessellate_strokeacceptdashesanddash_offset. - Command metadata:
is_relative,parameter_count, andPATH_*constants. - Rendering constants:
WINDING_NON_ZERO,WINDING_EVEN_ODD,BLEND_NORMAL,BLEND_OVERWRITE,GEOMETRIC_EPSILON,CAP_BUTT,CAP_ROUND,CAP_SQUARE,JOIN_MITER,JOIN_ROUND,JOIN_BEVEL,DEFAULT_MITER_LIMIT,FLATTEN_TOLERANCE,MAX_FLATTEN_DEPTH,MAX_FLATTEN_SEGMENTS,MAX_DASH_PATTERN_ELEMENTS,MAX_MARKER_COUNT, andSUPERSAMPLE. - Runtime:
version,abi_version, andstrerror.
Errors and lifetime
Python objects own their native handles and release them during garbage
collection. Returned Python strings and bytes own their data, so they remain
valid after the originating object is deleted. Invalid geometry, malformed SVG
path data, and unsupported arguments raise ValueError; allocation failures
raise MemoryError; a concurrent mutation detected during a two-pass read
raises RuntimeError. Do not use the same object concurrently from multiple
threads without external synchronization.
UniVector is Apache-2.0 licensed.
Metadata
Release files for univector 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| univector-1.1.0.tar.gz | 289.5 kB | Details |
Built distributions (wheels)
Total release size: 12.7 MB
Release files / univector-1.1.0.tar.gz
| Download URL | univector-1.1.0.tar.gz |
|---|---|
| Size | 289.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ac375f38c632f1813177314fa9f18a547b2c38aed1e576e7fa155626a5cf5828
|
|
BLAKE2b-256 checksum How to use checksums |
6e3dea44758e789c6cb72b43b794daefc204b9ae4b7d89b1b09ada38a18a52ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / univector-1.1.0-cp314-cp314-win_amd64.whl
| Download URL | univector-1.1.0-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 480.8 kB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
ebf42c35e56780d59cc42946c20afd93d3579f6886f455fc6b48a45b7931fa66
|
|
BLAKE2b-256 checksum How to use checksums |
a491258fb0334e1113653451b51617d786642d83d2f3f5f8395a47b03de21adc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / univector-1.1.0-cp314-cp314-manylinux_2_35_x86_64.whl
| Download URL | univector-1.1.0-cp314-cp314-manylinux_2_35_x86_64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.14 Linux glibc 2.35+ x86-64 |
|
SHA-256 checksum How to use checksums |
a0c905460d938bc1ac382d629056ff3f05839d07de15b7fa15ccd1fc934d1534
|
|
BLAKE2b-256 checksum How to use checksums |
9b98b88c0e3a246affa7ce8a19ab1c7b39ed6f3855809dc9e041cd661bc288d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / univector-1.1.0-cp314-cp314-macosx_26_0_arm64.macosx_10_15_x86_64.whl
| Download URL | univector-1.1.0-cp314-cp314-macosx_26_0_arm64.macosx_10_15_x86_64.whl |
|---|---|
| Size | 632.0 kB |
| Tags | CPython 3.14 macOS 10.15+ x86-64 macOS 26.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
4f35beb6d3b255fa44bf5eb4b7901dfb7ea114c8be0a53c8e77696c14deeb8f4
|
|
BLAKE2b-256 checksum How to use checksums |
da964f953dcbf03fda8cb2fb5d8f1488b324582d02d0a26fd6a2cd9e8c31f56c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / univector-1.1.0-cp313-cp313-win_amd64.whl
| Download URL | univector-1.1.0-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 466.5 kB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
33eda14e717a715a29836b46a68dc3553b84ff3807f76d92385de94cc3fac86b
|
|
BLAKE2b-256 checksum How to use checksums |
f6018c1f5d525ce48c3931648b21fee1bc4df7f460c719e42a9e5978b2ccd69b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / univector-1.1.0-cp313-cp313-manylinux_2_35_x86_64.whl
| Download URL | univector-1.1.0-cp313-cp313-manylinux_2_35_x86_64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.13 Linux glibc 2.35+ x86-64 |
|
SHA-256 checksum How to use checksums |
52a34629cea5a4d49262e2ce5d1ad79bb69419a6486dd350f10420bfb1ec462d
|
|
BLAKE2b-256 checksum How to use checksums |
0ef05a0c4ed8b12d99fbd0639d89d0c49b2b2dfb225376b26aa6d0e1cdfe58de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / univector-1.1.0-cp313-cp313-macosx_26_0_arm64.macosx_10_13_x86_64.whl
| Download URL | univector-1.1.0-cp313-cp313-macosx_26_0_arm64.macosx_10_13_x86_64.whl |
|---|---|
| Size | 630.3 kB |
| Tags | CPython 3.13 macOS 10.13+ x86-64 macOS 26.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
76cf307b83ac5360b20a0c8c942f21fae53802f943636ae2e5255e08ebefe18b
|
|
BLAKE2b-256 checksum How to use checksums |
f0901b32825f21d1da75e5c3eae01ed3bcd0e93bf89c215ace0bb32758ae1637
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / univector-1.1.0-cp312-cp312-win_amd64.whl
| Download URL | univector-1.1.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 466.8 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
2c50a25cb8e3951ba97b70d709460fb65888146f45dacef0b6e9a0abd0e9eade
|
|
BLAKE2b-256 checksum How to use checksums |
908a0f89c768e411b423056d5ea595177104da5bdd16d06d1099071115d2ee8f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / univector-1.1.0-cp312-cp312-manylinux_2_35_x86_64.whl
| Download URL | univector-1.1.0-cp312-cp312-manylinux_2_35_x86_64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.12 Linux glibc 2.35+ x86-64 |
|
SHA-256 checksum How to use checksums |
b18069b6c8c247161a5e152984b4c28669526505729ffd806903acee3f248dc7
|
|
BLAKE2b-256 checksum How to use checksums |
3e8146e3dc132f69800296861d3fd7b42715c41f868afe731596c24c6581cc3d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / univector-1.1.0-cp312-cp312-macosx_26_0_arm64.macosx_10_13_x86_64.whl
| Download URL | univector-1.1.0-cp312-cp312-macosx_26_0_arm64.macosx_10_13_x86_64.whl |
|---|---|
| Size | 626.7 kB |
| Tags | CPython 3.12 macOS 10.13+ x86-64 macOS 26.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
3ea373d9c463f59d880fcd6301420560568426cc627ae6acc588566f9ddc98b3
|
|
BLAKE2b-256 checksum How to use checksums |
3cb86c9c327c8c72fac9ba9d49be15e66305b1238cd517c1ca0c674fd9d45ad9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / univector-1.1.0-cp311-cp311-win_amd64.whl
| Download URL | univector-1.1.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 467.4 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
33469872aed1c21ade23d06fc9b83a25df32396674ecd91af3a2406bd9737559
|
|
BLAKE2b-256 checksum How to use checksums |
ec731490e95241217570477e80ae5d64c00d7a130cf951716f1c2d1290a084db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / univector-1.1.0-cp311-cp311-manylinux_2_35_x86_64.whl
| Download URL | univector-1.1.0-cp311-cp311-manylinux_2_35_x86_64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.11 Linux glibc 2.35+ x86-64 |
|
SHA-256 checksum How to use checksums |
622c8aedd5ecbb4ee5124409368f2ab21f6d22005898f8cc7d49c56770a3ee79
|
|
BLAKE2b-256 checksum How to use checksums |
20d5cc91e0c8be6991f02aa7f1741c05ab812b4759075ae1d28ec30a636ef9ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / univector-1.1.0-cp311-cp311-macosx_26_0_arm64.macosx_10_9_x86_64.whl
| Download URL | univector-1.1.0-cp311-cp311-macosx_26_0_arm64.macosx_10_9_x86_64.whl |
|---|---|
| Size | 637.2 kB |
| Tags | CPython 3.11 macOS 10.9+ x86-64 macOS 26.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
0adda48435ec4238c7f33cdf9563da28e3e4a1519f99132a306e115bc8aca300
|
|
BLAKE2b-256 checksum How to use checksums |
163c0151a7b6975bbed472e336d80a16277fc552884f75c1ee72b6274da02a55
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / univector-1.1.0-cp310-cp310-win_amd64.whl
| Download URL | univector-1.1.0-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 467.6 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
2d34c63a3736f1e8e5b8073b69051b4a4caab14188defd36483958e925827d22
|
|
BLAKE2b-256 checksum How to use checksums |
cfe359d39dd72495ccdece3444cd3d04f881527da1bdef4eb644d667a9fcac12
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / univector-1.1.0-cp310-cp310-manylinux_2_35_x86_64.whl
| Download URL | univector-1.1.0-cp310-cp310-manylinux_2_35_x86_64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.10 Linux glibc 2.35+ x86-64 |
|
SHA-256 checksum How to use checksums |
8b75a91122c3a7473954e81f755a97952ac552d475fcc214b42c7212d39aa95c
|
|
BLAKE2b-256 checksum How to use checksums |
c4f8dfdf706b9257995e120973f42fca6f20e10562adf158ee34b191f1d38b4d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / univector-1.1.0-cp310-cp310-macosx_26_0_arm64.macosx_10_9_x86_64.whl
| Download URL | univector-1.1.0-cp310-cp310-macosx_26_0_arm64.macosx_10_9_x86_64.whl |
|---|---|
| Size | 637.3 kB |
| Tags | CPython 3.10 macOS 10.9+ x86-64 macOS 26.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
aadd54b5b3ba0dc7a0eb333fa4fa39c4d57599bf47502ccd0a74a566172c6575
|
|
BLAKE2b-256 checksum How to use checksums |
24d22e09b3727a70820a90a81fbdcc92c096bbc54cb44580d7c56e942f7a0339
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency log