Skip to main content

ASTx

ASTx is a language-agnostic Python model for abstract syntax trees. It provides typed nodes and common metadata that parsers, analyzers, transpilers, and compiler backends can share without adopting a particular source grammar.

Status: functional and actively evolving. ASTx models more constructs than any one backend necessarily supports.

Scope

ASTx currently models:

  • source locations, identifiers, expressions, statements, and blocks
  • scalar, string, temporal, collection, generic, and union types
  • functions, defaults, modules, packages, and imports
  • conditionals, loops, generators, comprehensions, and context managers
  • classes, structs, inheritance, member access, and modifiers
  • templates, FFI pointers/opaque handles, and semantic helper metadata
  • lists, buffer views, tensors, DataFrames, and Series
  • YAML, JSON, Mermaid, PNG, and optional console visualization paths

ASTx does not lex or parse source and does not generate LLVM by itself. IRx is the Arx ecosystem backend that analyzes and lowers the supported ASTx subset.

Install

pip install astx

For ASCII visualization through mermaid-ascii:

pip install 'astx[console]'

Example

import astx

args = astx.Arguments(
    astx.Argument(name="x", type_=astx.Int32()),
    astx.Argument(name="y", type_=astx.Int32()),
)

body = astx.Block()
body.append(
    astx.FunctionReturn(
        astx.BinaryOp(
            op_code="+",
            lhs=astx.Variable("x"),
            rhs=astx.Variable("y"),
        )
    )
)

add = astx.FunctionDef(
    prototype=astx.FunctionPrototype(
        name="add",
        args=args,
        return_type=astx.Int32(),
    ),
    body=body,
)

print(add.to_yaml())

Relationship to Arrow

ASTx defines the compiler-facing node and type vocabulary for arrays, buffer views, Tensors, DataFrames, and Series. It deliberately does not depend on Apache Arrow or own native storage. IRx maps those nodes to its Arrow C++ runtime.

Documentation: https://arxlang.org/astx/

License: Apache-2.0.

Metadata

Release files for astx 1.27.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 astx 1.27.0
File Size Uploaded Provenance Actions
astx-1.27.0.tar.gz 56.3 kB Without provenance Details for astx-1.27.0.tar.gz

Built distribution (wheel)

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

Total release size: 138.8 kB

Release files / astx-1.27.0.tar.gz

Download URL astx-1.27.0.tar.gz
Size 56.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6a24a1be0eca5a0149b81b1db1b9a87e45a2fcadf1f532470e456bc4197617b1
BLAKE2b-256 checksum
How to use checksums
b8e8c7449ef4490993c5a0da9568a6cb199edaf63d524138d123ec968c02de01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.2 CPython/3.10.22 Linux/7.0.0-1017-azure

Release files / astx-1.27.0-py3-none-any.whl

Download URL astx-1.27.0-py3-none-any.whl
Size 82.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aa05a91f0e92d11702c96566b4da1023f57ab5db4e6fe5afda489fe703f5d7ac
BLAKE2b-256 checksum
How to use checksums
06f16c7da1c6ccc1efc8bda531ae6f25a23ddf56ea7a3694b7e86ff00e88e10a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.2 CPython/3.10.22 Linux/7.0.0-1017-azure

Security for astx 1.27.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

1.27.0 This release

2 release files No provenance

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