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
typst-0.11.1.tar.gz
(4.7 MB
view hashes)
Built Distributions
typst-0.11.1-cp37-abi3-win32.whl
(14.5 MB
view hashes)
Close
Hashes for typst-0.11.1-cp37-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3874f7910687406ee7e80de1aec58487c305b76893b50a3a869496105a5767a5 |
|
MD5 | a8a98122ee27436b3e0c9cd8beb63341 |
|
BLAKE2b-256 | 61a2df2b12b51fc13387377c371ac7518729c655d0c8eee02f8a6d85b0aa5efd |
Close
Hashes for typst-0.11.1-cp37-abi3-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2ccebab8f9fc49b2b212d6af0e349aa6cd8fc043c343bf5719aa1ef7dae354f |
|
MD5 | 082655ad65e48b91bebe672d17c99dc0 |
|
BLAKE2b-256 | 4442a2e36c7510c10db754ab915b4b3c05093c0ff0affdf67a5f96a777d130c6 |
Close
Hashes for typst-0.11.1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef8e44bec7a2e168a92aec2fa8008328b630d137753c0550ba654c7855d2893a |
|
MD5 | 3f3a058700d26ead869cdc7f0492ef97 |
|
BLAKE2b-256 | 5adc16b646856753702d880b5af1207254cbd00ace25c4ae21cc67348e321448 |
Close
Hashes for typst-0.11.1-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ffba53328e317b9b0a4e9d05573c98c7f7d4e555259e1ff5a9a2169a85232d71 |
|
MD5 | 9c0cb1fa1a8adb607988f3f6c7133806 |
|
BLAKE2b-256 | 6c329e6ef220c57d978200d9de1274c76f68cddcdac04a27e1b5d56108220bc5 |
Close
Hashes for typst-0.11.1-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 75313042a605c15649f23eb074c5df34bca66f5b921cd043651afd80ff3ad9f0 |
|
MD5 | 32e5488ba8e87cd038446810ede12cf8 |
|
BLAKE2b-256 | a9573db50dca9d238255c9fb312af9359f5a684d4d7ee4f802a7f8097f93102a |
Close
Hashes for typst-0.11.1-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 812b99f617aabb599508e132cdc881a751d89ad32504def774d3e3b765425872 |
|
MD5 | fd8017dc3993f6d8f7d7e0a5c8ccd002 |
|
BLAKE2b-256 | fb4f25db2c3a9f0a5f076ba6a482b33e2a67156a992c49d96dea8d58237ebd39 |
Close
Hashes for typst-0.11.1-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11c925fab98fdce6b3f8c498c399eed7224d7a315348aa46e2bb0d9a40af5baa |
|
MD5 | c24d8f9b02ed9f0190d0c04fe70d60b6 |
|
BLAKE2b-256 | 5bdac08f660004a3b1a29c71c6ceca4b5dd5bb1ee5e2d659200b5cb2a9bd564d |
Close
Hashes for typst-0.11.1-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d6bf84d7e1c8402241d10874a4dc4df4995dcff0a581c47b1def92cc4de322b |
|
MD5 | 1dc762731abca4bdac736004e4d9be34 |
|
BLAKE2b-256 | 8f1abff4316051320b860fe1be4366a68cdc92423c188074c9ebaeb5df68e320 |
Close
Hashes for typst-0.11.1-cp37-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8af0dabc95a761b07f19c4551da9176bc1b408a9abf9d5d0ab93da3d616abf6 |
|
MD5 | 6a278c052cf3139b3e2a30ef0378b669 |
|
BLAKE2b-256 | 7886de6f5e35b5d4babcbef9719c2afcd02ec3a4196d0da6bf521700bb49c003 |
Close
Hashes for typst-0.11.1-cp37-abi3-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec50fc97f8afe6da1f8787a72f77f04ddf14e007c88a1b130cb8122a405e4e63 |
|
MD5 | ebf429a595b6d4a19e68aa71cc1de1c5 |
|
BLAKE2b-256 | 17ebe1c5d59399365c71b12fe5ea6bb0d87f5ca21e2bf001e7a3758fae3b0c23 |