Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

py-skia-canvas

独立 Python Canvas 库,复用 skia-canvas@3.0.8 的原 Rust/Skia 核心,保留默认 GPU 策略。Python wheel 不需要 Node、npm、Neon/N-API 或 skia-python。

已迁移 Canvas/Context、Path2D 与扩展、DOM 几何/矩阵/CSS 变换、渐变、字体与文本排版/测量/装饰、图像/像素/pattern/texture、滤镜/混色、多页、同步/异步导出和 App/Window。公共名称与默认值沿用 Node;语言宿主采用已确认的 Python 对应方案。

当前版本 0.1.0a18,候选目标为 CPython 3.13 / Windows AMD64 / Linux glibc 2.28+ x86_64。Windows Vulkan 与 Linux Vulkan 分别验收;macOS Metal 保留源代码和 feature,尚无验收过的发行物。尚未发布到 PyPI。实际 wheel SHA、检查范围和发行状态见 本批交付报告。

from py_skia_canvas import Canvas

canvas = Canvas(300, 150)
ctx = canvas.getContext("2d")
ctx.fillStyle = "#2878d9"
ctx.fillRect(10.25, 11.75, 113.5, 63.25)
ctx.font = "24px sans-serif"
ctx.fillStyle = "black"
ctx.fillText("Canvas AV fj", 10.25, 110)
with open("example.png", "wb") as output:
    output.write(canvas.toBufferSync("png"))

同步 Buffer 对应 bytes,Promise 对应实际 awaitable,undefined 单例与 None 分别对应 undefined/null。Sharp 是 Node 宿主依赖;同名入口明确抛缺少 Sharp 的原错误,图像字节可由 toBuffer/toFile 获取。库不启动 Node 或返回占位 Sharp/Stream 对象。

Canvas、Context、字体与 GPU 资源在创建线程使用;跨线程绘图会报错。异步导出在创建线程先形成原核心快照,后台只处理可安全转移的数据。Windows 在 Python 工作线程退出前释放其本地资源和原 GPU context,不把 GPU context 送入 Python 线程池。

系统字体和驱动会影响结果;项目只记录字体来源/指纹,不捆绑系统字体。验证逐项比较 JSON 数字、RGBA 和解码像素,不使用容差;透明像素的 RGB 差异也计数。原默认 GPU 验收与 CPU 诊断分开。

安装与构建

安装已验收的本地 wheel:

python -m pip install /path/to/py_skia_canvas-0.1.0a18-cp313-cp313-win_amd64.whl

Linux 使用对应 manylinux_2_28_x86_64.whl。发布必须上传同一批验收过的字节;GitHub Actions 构建、GitHub Release、TestPyPI 和 PyPI 安装各自记录状态。

Rust 固定 1.90.0,Skia/rust-skia 固定 0.88.0。Windows 构建需要 CPython 3.13、MSVC x64 工具链:

./scripts/build_windows.ps1

Linux 可移植构建使用固定 manylinux 镜像,流程见 发行流程、构建脚本 和 容器定义。Fontconfig 2.17.1 静态链接到同一 Skia 内嵌 FreeType;普通开发构建可使用系统库,但不因此获得发行验收。

crates/canvas-core 是唯一绘图核心,Python 和开发用 Node adapter 共同消费。官方 Node 3.0.8 仅用于开发差分,日常不重编 Node;其来源快照为只读资料,不能作为 Python 运行时 fallback。

开发资料

新会话先读 AGENTS.md、NEW_SESSION、实施方案、API 规则 和 任务清单。历史批次的结果保留在各报告;最新状态以本批交付报告为准。

python -m unittest discover -s tests/bootstrap -v
python scripts/validate_bootstrap.py
python scripts/validate_core.py
python scripts/validate_licenses.py

这些源码检查不代替实际 wheel 的 GPU、字体、生命周期或发布检查。工具用法见 tests/README。仓库既有 MIT 许可 保持不变;固定依赖的版权和许可见 第三方说明。

Metadata

Release files for py-skia-canvas 0.1.0a18

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

Built distributions (wheels)

Table of built distributions (wheels) for py-skia-canvas 0.1.0a18
File Interpreter ABI Platform Actions
py_skia_canvas-0.1.0a18-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for py_skia_canvas-0.1.0a18-cp313-cp313-win_amd64.whl
py_skia_canvas-0.1.0a18-cp313-cp313-manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64 Details for py_skia_canvas-0.1.0a18-cp313-cp313-manylinux_2_28_x86_64.whl

Total release size: 27.1 MB

Release files / py_skia_canvas-0.1.0a18-cp313-cp313-win_amd64.whl

Download URL py_skia_canvas-0.1.0a18-cp313-cp313-win_amd64.whl
Size 12.4 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
9efce11f1340a9bfbb69387f0757abe1635b3ff45528ce07e69dc30771049b74
BLAKE2b-256 checksum
How to use checksums
70456e3f52fa64fb54c3c64d52211a9cd5cd5eebfe6209d491ae467cb41c4784
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 29, 2026.

Transparency log

Release files / py_skia_canvas-0.1.0a18-cp313-cp313-manylinux_2_28_x86_64.whl

Download URL py_skia_canvas-0.1.0a18-cp313-cp313-manylinux_2_28_x86_64.whl
Size 14.7 MB
Tags CPython 3.13 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
2e641429ceedaca260037abba217e13189a16a1168571fa430857e06b2734071
BLAKE2b-256 checksum
How to use checksums
d546f59d0a887bfd6d7699c4e1e06e0ec2bb91a6e342c4ffdbea370d9ab88211
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 29, 2026.

Transparency log

Security for py-skia-canvas 0.1.0a18

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for py_skia_canvas-0.1.0a18-cp313-cp313-win_amd64.whl

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 Oct 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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