Skip to main content

pyastgen

Builder for generating Python source, inspired by llvmlite.

For example, the following code generates a fibonacci function:

import pyastgen

module, builder = pyastgen.new_module()

fib = builder.declare("fib")
(n,), fib_builder = builder.new_function(fib, pyastgen.Parameters("n"))
then, _else = fib_builder.if_(n.lt(pyastgen.constant(2)))
then.return_(n)
fib_builder.return_(
    fib.call(n.sub(pyastgen.constant(1))).add(
        fib.call(n.sub(pyastgen.constant(2)))
    )
)

print(pyastgen.unparse(module))

Output:

def fib(n, /):
    if n < 2:
        return n
    return fib(n - 1) + fib(n - 2)

Metadata

Release files for pyastgen 0.1.1

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

Source distribution (sdist)

Source distribution for pyastgen 0.1.1
File Size Uploaded
pyastgen-0.1.1.tar.gz 5.5 kB Details

Built distribution (wheel)

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

Total release size: 11.8 kB

Release files / pyastgen-0.1.1.tar.gz

Download URL pyastgen-0.1.1.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
89cfe047b8a650cb303a7cfaf3e80435152a61036eeddc90f68ded898ebf28d1
BLAKE2b-256 checksum
How to use checksums
f5c16f0b0e7e90988dee6896292f34320a116e62ac49c3f465f43337fee582d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Mar 7, 2025.

Transparency log

Release files / pyastgen-0.1.1-py3-none-any.whl

Download URL pyastgen-0.1.1-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8e4dfd2ce80e903f9ddac4c4544480789e4106eb2fb280af49661bef22bbd884
BLAKE2b-256 checksum
How to use checksums
56739205e75efbf0c42df930fe51aae765fd885e1d02919b34f58e4204172a14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Mar 7, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

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