Python binding to typst
Project description
typst-py
Python binding to typst, a new markup-based typesetting system that is powerful and easy to learn.
Installation
pip install typst
Usage
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))
License
This work is released under the Apache-2.0 license. A copy of the license is provided in the LICENSE file.
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
File details
Details for the file typst-0.12.0.tar.gz
.
File metadata
- Download URL: typst-0.12.0.tar.gz
- Upload date:
- Size: 4.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e3575e0a0a6e323b6e9fb367e838a4caa947112e38ee32911cdaaa9c85176ac5 |
|
MD5 | 3073befa5475cb75f5bef82a467ea484 |
|
BLAKE2b-256 | 0e9ab944d5fd71c645b5db1fce348a8fc5be25afbe4cf6ef8688e498a7af32aa |
File details
Details for the file typst-0.12.0-cp37-abi3-win_amd64.whl
.
File metadata
- Download URL: typst-0.12.0-cp37-abi3-win_amd64.whl
- Upload date:
- Size: 16.3 MB
- Tags: CPython 3.7+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8d12ba034ce3d2579bc4284a99e6bab5dd83440cd643a25546997b6b58041f8 |
|
MD5 | 4d1d107d5b907a3b4a7f10340609bd4d |
|
BLAKE2b-256 | f5a9104670c5eae846c63cd2e3a753a29c69a516829348a657c4d548052dc725 |
File details
Details for the file typst-0.12.0-cp37-abi3-win32.whl
.
File metadata
- Download URL: typst-0.12.0-cp37-abi3-win32.whl
- Upload date:
- Size: 15.8 MB
- Tags: CPython 3.7+, Windows x86
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69a8ef18fbcb6bb10376d111597e464a1d80b63586a5a5324f6b4a3e1bb6f6a5 |
|
MD5 | 71dbae8bd29d59fea80f65df6fbc3505 |
|
BLAKE2b-256 | 6cc893ebfe96b303331bebbe5151363882860844f8804c613447669a25e322a1 |
File details
Details for the file typst-0.12.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: typst-0.12.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 18.3 MB
- Tags: CPython 3.7+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28e53c2a123c3ea825a95ab7101202ae548a61cb773c80b0db5793570893f26a |
|
MD5 | 3e2109df7746cf5a545b41b7d7aa02b5 |
|
BLAKE2b-256 | 5362821ce197398b57a134edb5d7af4490e160f7e59b27ae50ba3057a8027df7 |
File details
Details for the file typst-0.12.0-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
.
File metadata
- Download URL: typst-0.12.0-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
- Upload date:
- Size: 20.6 MB
- Tags: CPython 3.7+, manylinux: glibc 2.17+ s390x
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0442734f24b5abeb66db4690016a65a933617141ed26f43af95281b0b0e27a7 |
|
MD5 | fcff564c93136a87fda02ae9eb9063b9 |
|
BLAKE2b-256 | 652e834de3ea71b52d2701a231fad89dbec3bc42fe6cc8235df2c06d65fbaef0 |
File details
Details for the file typst-0.12.0-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
.
File metadata
- Download URL: typst-0.12.0-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
- Upload date:
- Size: 17.9 MB
- Tags: CPython 3.7+, manylinux: glibc 2.17+ ppc64le
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 571b01f8fb4c161288143628528596ce6573e7dce867241f1451e4c250862576 |
|
MD5 | 020000d619146db6207c3a719644bcb8 |
|
BLAKE2b-256 | b969957601aa8e444ac7ac92ec91df70b806d12c9eb7c7ec14fe948aa28a9c4f |
File details
Details for the file typst-0.12.0-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
.
File metadata
- Download URL: typst-0.12.0-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 18.8 MB
- Tags: CPython 3.7+, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb2c2899fd85ab5e2a708811e94a2411bc3143152b328482f0b23d96006e18c1 |
|
MD5 | f5f8978c4afaa9dfbd19ea6f42b065a5 |
|
BLAKE2b-256 | 5cc944ca83f2cec1293d91fb6de7935c50352cbb12d330340e03ea56670c11f6 |
File details
Details for the file typst-0.12.0-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
.
File metadata
- Download URL: typst-0.12.0-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
- Upload date:
- Size: 18.4 MB
- Tags: CPython 3.7+, manylinux: glibc 2.17+ ARMv7l
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 714c716300d073eb51f87e5c6ef743e4319d08fb693d5ad53f17d1cdbdaa986c |
|
MD5 | 7e8bce0e8c6839740a15dd110e59c971 |
|
BLAKE2b-256 | 5382ed3d51bf47308bd8c553241cc793bf7dba24217c34c3359eae00b5e0709c |
File details
Details for the file typst-0.12.0-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
.
File metadata
- Download URL: typst-0.12.0-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 18.0 MB
- Tags: CPython 3.7+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8537f151d339304576173a4ce48d7f8e1806729a32c09393b3800b89653b88f4 |
|
MD5 | 7083de3dc47921fa81c660c089fcbad1 |
|
BLAKE2b-256 | 5bf777b9c288d470693562d98906c8e0c6934645b27ee5c638e8ec094197b70b |
File details
Details for the file typst-0.12.0-cp37-abi3-macosx_11_0_arm64.whl
.
File metadata
- Download URL: typst-0.12.0-cp37-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 16.7 MB
- Tags: CPython 3.7+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9b28aaae36637661421216cec81b7f7c55eafc80343266dd7fa67201f7c4c7e |
|
MD5 | 8b5b89d1f4020aaf1e9b59f96131c6fe |
|
BLAKE2b-256 | 056ee8e680bf0dfed2d9935b8666f2279aaf9cbba032cd04fccd8b0d31872eb1 |
File details
Details for the file typst-0.12.0-cp37-abi3-macosx_10_12_x86_64.whl
.
File metadata
- Download URL: typst-0.12.0-cp37-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 16.8 MB
- Tags: CPython 3.7+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a464184f6d8c327fbb28c51ab9dd1d5ee1b49ffa3b252977df7f8b2346bd3d3f |
|
MD5 | 14922e5084e32879c1d2d62fd3a1ca1c |
|
BLAKE2b-256 | 50ad17479f16580bfb5e154df15b48b77aa7af7c5696c4339e0b9f8e77041af0 |