Skip to main content

Typst metaprogramming in python

Project description

Typenaut

Typst documents from python classes

[!WARNING] This project is no longer maintained:

  • Typst's native sys.inputs solved my needs, feeding pydantic models for dynamic content.
  • Not worth it to mirror what typst already does internally - it's turtles all the way down!
  • Pure library usage will likely improve in the future with community or official effort.

I'm archiving the repository as it got some clever tricks and a rough idea in how a meta programming library and utils would look like. Feel free to base off a continuation or rewrite under the MIT license (requires including original copyright notice and attribution).

Since I own the PyPI package, get in touch for a name transfer for any purpose shall you be worthy!

Note: Please change the logo on a fork, as I will use it elsewhere planned.

🔥 Description

An experiment on typst metaprogramming within python for heavy templating.

from typenaut import Document, Rectangle, Text

class Minimal(Document):
    def build(self):
        with Rectangle(self) as rect:
            Text(rect, value="Hi, I'm inside the rectangle")

# Automated usage!
document = Minimal()
document.build()
document.pdf(output="output.pdf")

🚀 Usage

Your best chance is on exploring the examples directory likely for a good while.

  • Upstream typst documentation is always a valuable resource!

Note: I really do not have the time to write structured documentation, but the code contains quality type hints and docstrings.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

typenaut-0.0.2-py3-none-any.whl (71.1 kB view details)

Uploaded Python 3

File details

Details for the file typenaut-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: typenaut-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 71.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for typenaut-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8e3283955b964db8857cf97c51360ac745ced6f1c5810b894660d7ee89463544
MD5 b167d3bc78308961b76324862e87e668
BLAKE2b-256 7497fdf034968007dbe5e6ac97727ed0ca39c8387604dd2860fe4678eac728f1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page