Skip to main content

A friendlier Python that compiles to Python — readable by default

Project description

Pyro – A friendlier Python (v4.0.0)

Pyro is a programming language built around one core philosophy: "Readable by default." If you can say it in English, you can write it in Pyro.

It removes Python's rough edges—like indentation errors, mandatory self, and def—and introduces highly readable constructs like unless, repeat 5 times, match ... case, async ... await, and data classes.

The best part? It compiles exactly to standard Python bytecode and supports seamless interoperability. You can import .py files from .pyro, and you can even import pyro_module directly from regular Python files!

✨ New in 4.0.0

Pyro 4.0.0 is a massive upgrade that brings modern language features, a comprehensive build system, and first-class IDE tooling to the ecosystem:

  • Pattern Matching: match subject: case value: syntax with if guards.
  • Async capabilities: Full support for async func, await, async with, and async for.
  • Enums and Data Classes: Built-in keywords enum and data (immutable dataclasses).
  • Tooling: A built-in LSP (pyro lsp), an interactive debugger (pyro debug), a document extractor (pyro doc), and an executable packager (pyro build).
  • Standard Library: A cleanly wrapped pyro.stdlib featuring http, fs, json, math_extras, process and more.
  • Build optimizations: Automatic byte-caching .pyro.pyc and constant-folding.

The Python vs. Pyro Difference

Feature Python Pyro
Blocks Indentation sensitive if ... end (no indentation errors)
Functions def or lambda func/fn and lambda
Object Scope self.name this.name
Variables x = 1 make x: int = 1 or x = 1
Ranges range(1, 6) 1..5 (inclusive)
Match/Case match x: case 1: match x: case 1: (with _ if guards)
Enums from enum import Enum enum Color: RED GREEN BLUE end
Dataclasses @dataclass data Point(x: int, y: int) end
Print Output print("hi") print "hi" (or with parens)

Installation

To install Pyro globally (works flawlessly from a USB drive across Linux/Windows/Mac):

# In the project root directory:
pip install .

Note: This automatically registers the pyro.pth hook into your site-packages, completely unlocking Python global interoperability!

Zero-Config Python Interop (# coding: pyro)

You can tell Python to natively run a .py file as Pyro syntax. Just add this to the very top:

# coding: pyro

print f"This is actually Pyro code!"
repeat 3 times
    print "Magic!"
end

When you run python script.py, Python detects the codec, transpiles it instantly in memory, and runs it seamlessly.

Quick Examples

print "Hello from Pyro 4.0!"

# Variables & String Interpolation
make name = "Pyro"
make v = 4
print f"Welcome to {name} v{v}"

# Pattern Matching
func http_status(code):
    match code:
        case 200:
            return "OK"
        case _ if code >= 500:
            return "Server Error"
        case _:
            return "Unknown"
    end
end

# Data Classes
data Point(x: int, y: int = 0):
end
p = Point(10)
print f"Point X: {p.x}"

# Enums
enum FileState:
    OPEN
    CLOSED
end

# Try / Catch / Cleanup
try:
    print 10 / 0
catch error:
    print f"Whoops: {error}"
cleanup:
    print "Moving on..."
end

# Repeat Loops
repeat 5 times:
    print "This is so readable!"
end

Robust CLI

Pyro comes with a full suite of professional tools:

# Compile and run
pyro run script.pyro

# Build a standalone standalone executable out of your script (zero deps!)
pyro build script.pyro -n my_app

# Start the interactive debugger
pyro debug script.pyro

# Generate docs for your project
pyro doc script.pyro

# Start the Language Server for VS Code integration
pyro lsp

# Install Python packages safely into your environment
pyro install requests

vscode-pyro Extension

To install the VS Code extension, open the vscode-pyro folder, run npm install and npm run package to create a vsix file and install it into your editor for real time syntax highlighting and auto-completion.

License

MIT – use it anywhere, even in commercial projects.

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.

the_pyro_lang-4.0.1-py3-none-any.whl (40.5 kB view details)

Uploaded Python 3

File details

Details for the file the_pyro_lang-4.0.1-py3-none-any.whl.

File metadata

  • Download URL: the_pyro_lang-4.0.1-py3-none-any.whl
  • Upload date:
  • Size: 40.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for the_pyro_lang-4.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 66b9248932f5c5d6dc673beb025f850cb3188c1e0e69065806a49ea85cf3026d
MD5 3bf600c1d4f563624f3cadb5fd4d906c
BLAKE2b-256 8b37c2ab7813e826d46c90e1848b7cbca6db3d6ce841e65aafe565176d9bbb36

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