Skip to main content

texmodel

CI License: MIT

Declare a LaTeX document family once, in Python types. texmodel renders it to plain, readable, git-trackable .sty source: commit it, diff it, compile it with whatever LaTeX setup you already have. The same declarations give you documents as Python objects, a JSON Schema for their data, checks that committed files are current, and typed compile diagnostics.

Status: alpha. The public API may change before 1.0. What is missing today: known limitations.

pip install texmodel                 # the library and the texmodel-build command
pip install 'texmodel[proof-pdf]'    # plus the proof-pdf verifier
from texmodel.components import Command, Value
from texmodel.package import Package
from texmodel.types import Length, Text

pkg = Package("acme-cards", prefix="ac", version="1.4.0", date="2026/10/21")


@pkg.value
class FactGap(Value[Length]):
    """Space under each fact."""

    default = Length("2mm")


@pkg.command
class Fact(Command):
    """One short sentence under the title."""

    text: Text
    body = r"\par\noindent #text\par\vspace{\acFactGap}"


print(pkg.render())                       # the .sty
print(pkg.document(Fact("50% of $5")))    # \acFact{50\% of \$5}, escaped
texmodel build     # writes generated/acme-cards.sty
texmodel check     # exit 1 if a committed generated file is stale, missing or orphaned
  • Deterministic. No timestamps or hashes; the header records the generator version.
  • Checked early. A bad declaration is refused when the class is defined, with a stable code (TM-M0xx) and the class named. A bad document reports everything wrong at once, each with a path.
  • Typed. Text is escaped, Raw passes through; Length, colours, flags, choices and key lists are values, not strings.
  • No TeX needed to run. The library never starts a process. texmodel-build is the optional latexmk driver.

Documentation

Getting started declare, render, check: a worked first package
Guide components, arguments, values, documents, adopting existing TeX, testing
Cookbook worked examples
Known limitations what it does not do
Plan and decisions the target specification and the decisions log

pdm run mkdocs serve builds the same pages as a site.

Development

See CONTRIBUTING.md. Public API is the top-level modules of each package; everything under _internal may change. Report vulnerabilities as described in SECURITY.md.

Licence

MIT. The reference images carry their own licences (Ghostscript is AGPL); texmodel-build runs them as a separate process and ships none of their code.

Metadata

Release files for texmodel 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for texmodel 0.5.0
File Size Uploaded Provenance Actions
texmodel-0.5.0.tar.gz 229.0 kB With provenance Details for texmodel-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for texmodel 0.5.0
File Interpreter ABI Platform Actions
texmodel-0.5.0-py3-none-any.whl Python 3 none any Details for texmodel-0.5.0-py3-none-any.whl

Total release size: 363.7 kB

Release files / texmodel-0.5.0.tar.gz

Download URL texmodel-0.5.0.tar.gz
Size 229.0 kB
Tags Source
SHA-256 checksum
How to use checksums
36ebd3dee49b32a1302c94cf0a98212c3cbcf7856b62d7856d9f2c312bbfa2dc
BLAKE2b-256 checksum
How to use checksums
9a26e194134f0f6941c161155cd55a2abd3fb6c7ff1ca5fec34d7d35955d53e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Release files / texmodel-0.5.0-py3-none-any.whl

Download URL texmodel-0.5.0-py3-none-any.whl
Size 134.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
10c8065a1194da7ab9cd1a11316bbb99e346cdd4138158cc245f65a240d81612
BLAKE2b-256 checksum
How to use checksums
aadfa6e6a6a2bd3517db9d3814f5e6c51b6d08134e5aa8e50bd11e3cbdf449d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Security for texmodel 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for texmodel-0.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page