void-linux / void-packages

The Void source packages collection
https://voidlinux.org
Other
2.5k stars 2.11k forks source link

Package request: python3-typst #47044

Closed Eloitor closed 7 months ago

Eloitor commented 10 months ago

Package name

python3-typst

Package homepage

https://github.com/messense/typst-py

Description

Python binding to typst.

Does the requested package meet the package requirements?

System, Compiled

Is the requested package released?

Yes

tornaria commented 9 months ago

What is this good for?

How is

import typst
typst.compile(in, output=out)

any different than

import subprocess
subprocess.run(["typst", "compile", in, out])

?

classabbyamp commented 9 months ago

i would assume typst-as-a-library has a more flexible of an api than shelling out, not to mention probably being faster

the package in question is pyo3 bindings not just a library that runs shell commands

tornaria commented 9 months ago

i would assume typst-as-a-library has a more flexible of an api than shelling out, not to mention probably being faster

the package in question is pyo3 bindings not just a library that runs shell commands

All it seems to have is a compile() function, and it only takes a filename as input. It doesn't even support query metadata afaict.

Template is easy if you want to try it:

# Template file for 'python3-typst'
pkgname=python3-typst
version=0.10.0
revision=1
build_style=python3-pep517
build_helper=rust
hostmakedepends="cargo maturin"
depends="python3"
short_desc="Python binding to typst"
maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
license="Apache-2.0"
homepage="https://github.com/messense/typst-py"
distfiles="${PYPI_SITE}/t/typst/typst-${version}.tar.gz"
checksum=37853d0938db054cfa9d00aa574d4eac2985af6e7396a59c521a76e9e6bdf020
make_check=no  # there are no tests

I'm honestly not sure its worth shipping, but I don't mind making a PR if you think it's worthwhile.

Note that the whole of typst (and dependencies) seem to be vendored in, so the pkg will be roughly the same size as typst itself.

sgn commented 9 months ago

i would assume typst-as-a-library has a more flexible of an api than shelling out

It's worst in every way. It only exposes a single compile functions, without those options that exposed by the shell commands. My opinion, ignore this package.

classabbyamp commented 9 months ago

I was more referring to the native rust library for typst, which is a lot more flexible than these bindings, it seems.

Eloitor commented 9 months ago

Note that the whole of typst (and dependencies) seem to be vendored in, so the pkg will be roughly the same size as typst itself.

This is what I noticed while trying (without success) to write the template myself. I asked for this package thinking that maybe there is a way to make python3-typst depend on typst...

sgn commented 9 months ago

I was more referring to the native rust library for typst, which is a lot more flexible than these bindings, it seems.

Flexible or not, if it's not exposed, it's useless. Worse, the current state of Rust ecosystem, everything is static-linked, which brings more burden in maintaining.

I asked for this package thinking that maybe there is a way to make python3-typst depend on typst...

Wait until Rust can have stable ABI, which means never. :-p