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-2.0.0.tar.gz (16.4 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-2.0.0-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: the_pyro_lang-2.0.0.tar.gz
  • Upload date:
  • Size: 16.4 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-2.0.0.tar.gz
Algorithm Hash digest
SHA256 6868e52ca290e4301982e4d96dc022781ef141f1e306cfa3ca7611e0cb375d17
MD5 309fbc67fae334eec157a1dfaeaf69a6
BLAKE2b-256 5699a3171ef85505e3aa4fab97f6a038be5276e4cc515e6c1188b2ef7e7ff4fc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: the_pyro_lang-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 13.8 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-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 87a225f63fa4ea31cdefc71176c3f6d82334f09656b280419b337bf75908a97f
MD5 3b22ef071936b0e4bb8d918ee9e1672c
BLAKE2b-256 1d9078f84991ee316bf321bed34da5fe62eee8635f27d55bfa2468d09cc228eb

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