Skip to main content

pyinto

A framework for transforming Python source code into outputs of arbitrary formats (code in other languages, binaries, or anything else) and content.

  • However, not all Python code can be used as source input.
  • It is not a tool for porting existing, working Python programs to other languages. Its purpose is conversion, and source is treated as a description that passes information to Targets.
  • Except when __pyinto_runtime__ is used, source is not expected to run as Python.

Still in Alpha, so breaking changes will occur.

For the current implementation status, see STATUS.

Installation

Python 3.11 or later is required.

pip install pyinto

Conceptual model

A conversion with pyinto proceeds as follows.

Source ──(Host)──▶ Model ──(Realizer)──▶ Artifact
  • Source: the Python text written for pyinto.
  • Host: pyinto itself. It reads the Source, builds the Model, and calls the Realizer.
  • Model: the tree of Constructs (the kinds of parts) built from one Source. It does not depend on any particular output format.
  • Target: the output language or format (C, Rust, JSON, and so on).
  • Realizer: the implementation for one Target. Each rule inside it is a Realization, and its entry declaration is the Target Pack.
  • Artifact: what the Realizer produces.

Each stage contains the following.

              Typed Python Source
                       │
                       ▼
              ┌─────────────────┐
              │   pyinto Host   │
              │                 │
              │    Frontend     │
              │       ↓         │
              │ Construct Model │
              │       ↓         │
              │    Admission    │
              │       ↓         │
              │    Dispatch     │
              └────────┬────────┘
                       │
                       ▼
              ┌─────────────────┐
              │    Realizer     │
              │                 │
              │  Realizations   │
              │       ↓         │
              │ Artifact State  │
              │       ↓         │
              │  Finalization   │
              └────────┬────────┘
                       │
                       ▼
                    Artifact
  • Python syntax that the Host does not model is rejected when it is given to the Host.
  • Even if the Host accepts the input, it is also rejected if the Realizer does not support it.
  • In other words, this framework cannot use arbitrary Python code as conversion input. It can use only restricted Python code that the Host can model and that the Realizer supports.

Main use cases and other possible applications

Conversion into source files in other languages

This was the original motivation for creating pyinto. By creating a Realizer, it should be possible to convert code into any programming language. However, at present, there is no completed Realizer that performs conversion into a specific language.

The combination of Model and Realization also applies to libraries

When implementing basic conversion into a particular language, it is not necessary to implement support for all the libraries used by that language at the same time.

The Host does not provide Models even for the Python standard library.

Library interfaces can be modeled as needed, and corresponding Realizations must then be created.

Since a modeled library interface does not have to depend on a particular language, it may be possible to develop reusable assets based on general procedures rather than on a specific language. This is still at the experimental stage, however, and has yet to be demonstrated clearly.

Generating artifacts from Python syntax and module execution results

Rather than seeing restricted Python code as a disadvantage, it can be used positively as a mini-language. Only when an execution Target (purpose = "execution") is selected does the Host execute the source as ordinary Python. The static information obtained through AST analysis and the dynamic state obtained by that execution are combined to produce final artifacts.

A function defined with the name __pyinto_runtime__ has a special meaning within the module and is excluded from AST analysis. Its return value is supplied by the Host when the Realizer produces the final artifact, allowing that information to be reflected in the artifact. Because such a source is executed, a source that defines __pyinto_runtime__ cannot use pyinto.kinds, the vocabulary for conversion.

Kind vocabulary (pyinto.kinds)

To pass type, memory, and declaration information to Targets, pyinto.kinds provides vocabulary. It is split into the surfaces datatypes (what a value is), memory (where a value lives, who owns it, and when it is released), and declarations (the character of a declaration such as a class), each with two tiers.

  • general: general vocabulary that every language Target interprets. Python's built-in types (int, float, and so on) together with Wide[int], Unsigned[int], Size, Owned[T], Memory.release, and so on. Source written only with these can be converted by any Target that supports the general vocabulary.
  • detailed: choices close to particular languages, such as Int[32], Pointer[T], Null, and @Interface. A Target that does not support them may reject them.
from pyinto.kinds.datatypes.general import Unsigned, Wide
from pyinto.kinds.memory.general import Memory, Owned

total: Unsigned[Wide[int]] = 0
cell: Owned[int] = Memory.new(int, 7)
Memory.release(cell)

The Host defines no meaning for these words; it only records them in the Model as labels and passes them to Targets. How to write them concretely is chosen by the Target.

Collaborative development with LLMs

This approach of keeping the Host small and defining everything else outside it assumes implementation with the assistance of LLMs.

For how to implement a Realizer, see the Realizer Guide.

Documentation

For details, see the following documents.

Document Description
STATUS Current development status, implemented features, and limitations
Realizer Guide Guidelines for developing Realizers
Specification pyinto specifications and behavioral contracts
Glossary Definitions of terms used in the project
Changelog Development history and changes

The Realizer Guide is organized particularly with LLM-assisted implementation work in mind.

Official documentation is currently maintained in Japanese.

License

For license information, see the repository's LICENSE file.

Metadata

Release files for pyinto 0.3.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 pyinto 0.3.0
File Size Uploaded
pyinto-0.3.0.tar.gz 382.0 kB Details

Built distribution (wheel)

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

Total release size: 524.8 kB

Release files / pyinto-0.3.0.tar.gz

Download URL pyinto-0.3.0.tar.gz
Size 382.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8775feaedef03b2539e7d7aaf71582104249d13b59b77a81575bc6af77a7ac04
BLAKE2b-256 checksum
How to use checksums
40f1f21f1b120b5df4b2bb68fad377c93fcb91f68f91e2d66fc15f9038f38a02
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 15, 2026.

Transparency log

Release files / pyinto-0.3.0-py3-none-any.whl

Download URL pyinto-0.3.0-py3-none-any.whl
Size 142.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
07e27d8912504066d3f144064d287aafcf4faa7f0299dfe62ed752abdda5603d
BLAKE2b-256 checksum
How to use checksums
5161d697f887c12d8f37e458b7516c8606baf525ea854aaf0eb7b909f9d9a8ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 15, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.1

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