跳转到主要内容

Python绑定到typst

项目描述

typst-py

CI PyPI

Python绑定到typst,这是一个功能强大且易于学习的基于标记的排版系统。

安装

pip install typst

使用

import typst


# Compile `hello.typ` to PDF and save as `hello.pdf`
typst.compile("hello.typ", output="hello.pdf")

# Compile `hello.typ` to PNG and save as `hello.png`
typst.compile("hello.typ", output="hello.png", format="png", ppi=144.0)

# Or return PDF content as bytes
pdf_bytes = typst.compile("hello.typ")

# Also for svg
svg_bytes = typst.compile("hello.typ", format="svg")

# For multi-page export (the template is the same as the typst cli)
images = typst.compile("hello.typ", output="hello{n}.png", format="png")

# Or use Compiler class to avoid reinitialization
compiler = typst.Compiler("hello.typ")
compiler.compile(format="png", ppi=144.0)

# Query something
import json

values = json.loads(typst.query("hello.typ", "<note>", field="value", one=True))

许可

此作品根据Apache-2.0许可发布。许可文件的副本在LICENSE文件中提供。

项目详情


下载文件

下载适合您平台的应用程序文件。如果您不确定选择哪个,请了解有关安装软件包的更多信息。

源代码分发

typst-0.11.1.tar.gz (4.7 MB 查看哈希值)

上传时间 源代码

构建分发

typst-0.11.1-cp37-abi3-win_amd64.whl (15.0 MB 查看哈希值)

上传于 CPython 3.7+ Windows x86-64

typst-0.11.1-cp37-abi3-win32.whl (14.5 MB 查看哈希)

上传于 CPython 3.7+ Windows x86

typst-0.11.1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.3 MB 查看哈希)

上传于 CPython 3.7+ manylinux: glibc 2.17+ x86-64

typst-0.11.1-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (19.9 MB 查看哈希)

上传于 CPython 3.7+ manylinux: glibc 2.17+ s390x

typst-0.11.1-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (17.5 MB 查看哈希)

上传于 CPython 3.7+ manylinux: glibc 2.17+ ppc64le

typst-0.11.1-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (19.0 MB 查看哈希)

上传于 CPython 3.7+ manylinux: glibc 2.17+ i686

typst-0.11.1-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (18.2 MB 查看哈希)

上传于 CPython 3.7+ manylinux: glibc 2.17+ ARMv7l

typst-0.11.1-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (17.8 MB 查看哈希)

上传于 CPython 3.7+ manylinux: glibc 2.17+ ARM64

typst-0.11.1-cp37-abi3-macosx_11_0_arm64.whl (15.5 MB 查看哈希)

上传于 CPython 3.7+ macOS 11.0+ ARM64

typst-0.11.1-cp37-abi3-macosx_10_12_x86_64.whl (15.9 MB 查看哈希)

上传于 CPython 3.7+ macOS 10.12+ x86-64

支持者

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面