Skip to main content

A friendlier Python that compiles to Python

Project description

Pyro – A friendlier Python

Pyro is a programming language that feels like Python but removes the rough edges: no indentation errors, no self, no mandatory print() parentheses, and blocks end with end.

It compiles to standard Python – so you can use any Python library (NumPy, Django, TensorFlow) without change.

Why Pyro?

Feature Python Pyro
Blocks Indentation sensitive if ... end (no indentation errors)
Function definition def func (standard) or fn (Mojo-style Fast execution path!)
Method first argument self this (shorter)
print print("hello") print "hello" (or with parens)
Colons after headers Required Optional
Variable assignment x = 1 make x: int = 1 or x = 1 (MyPy typing supported)
Ranges range(1,6) 1..5 (inclusive)
Functional Pipelines print(add(x, 10)) `x

🔥 NEW in v1.0.0 🔥

  • Beginner Tracebacks: Pyret-inspired visually pinpointed (^) error handlers.
  • Typing out-the-box: MyPy support for .pyro definitions.
  • Mojo Speeds: fn explicitly caches and wraps using numba.njit implicitly.
  • Browser Sandbox: Comes with an interactive HTML examples/browser_playground.html inspired by Brython/Skulpt.
  • MCU & Web Compilation: Use --target mcu or --target js (RapydScript) for direct integrations.

Example

print "Hello from Pyro!"

make x = 10
y = 20
print "Sum: " + str(x + y)

if x > 5
    print "x is large"
else
    print "x is small"
end

func greet(name)
    print "Hello, " + name
end

greet("world")

for i in 1..5
    print i
end

class Person
    constructor(name)
        this.name = name
    end
    func say_hello()
        print "My name is " + this.name
    end
end

p = Person("Pyro")
p.say_hello()

Installation

To install Pyro globally or to update to the latest v1.0.0 release:

pip install --upgrade the-pyro-lang==1.0.0

Usage

Compile a .pyro file to Python:

pyro compile input.pyro -o output.py

Run directly:

pyro run input.pyro

Or use as a Python module:

from pyro import compile_pyro
py_code = compile_pyro(source)
exec(py_code)

Roadmap

  • MVP (variables, arithmetic, if/else, loops, functions, classes)

  • Compile to Python source

  • Import system

  • Exception handling (try/catch)

  • List/dict comprehensions

  • Standalone bytecode compiler (direct .pyc output)

  • Self‑hosting (compiler written in Pyro itself)

Contributing

See CONTRIBUTING.md (to be added). For now, open issues or PRs on GitHub. 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 Distribution

the_pyro_lang-1.0.1.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

the_pyro_lang-1.0.1-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file the_pyro_lang-1.0.1.tar.gz.

File metadata

  • Download URL: the_pyro_lang-1.0.1.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for the_pyro_lang-1.0.1.tar.gz
Algorithm Hash digest
SHA256 aea14eead5e39b1e963504d56ae8164e9a16f26d204fe39c4c7590172f4c4528
MD5 831f33b97cc4cbfdddd5c9eddab54234
BLAKE2b-256 135e9646b17f7dbcff0769ca9e5398ee4b68dee6dfec1927c09809d465b30003

See more details on using hashes here.

File details

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

File metadata

  • Download URL: the_pyro_lang-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 12.6 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-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5abe98386a1470d920d56467c38b0a72aecdc644f5130fdf08cece84fbc2d410
MD5 ec9bbb2c6d256c89c672d6ed0ce050a5
BLAKE2b-256 dac8e9ac35c6013ad89268d5d0aa31aa140a710dc95422f01e352513ba29b70e

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