Rhyton is a type of ancient Greek drinking vessel that is in the shape of an animal's head or horn and has a hole in the bottom for pouring the liquid. It was often used in religious ceremonies or feasts.
The name came after combination of language names: R and Python
This library helps you to move R codebase to Python. Right now it supports conversion of math equations, expressions, conditions, function definitions and calls
The project is published on PyPi, so you can install it via pip
$: pip install rhyton
Use transpile or transpile_file to translate your R code
from rhyton import transpile, transpile_file
transpile('x <- 7') # returns transpiled string
# or
transpile_file(
in_path='<path to your R file>.r',
out_path='<Path to generated Python file>.py'
)
Rhyton uses tree-sitter under the hood, to compute AST (Abstract Syntax Tree), after that it converts it to new AST that is valid for Python. After that it generates a code, using ast module and astor
-
✅ Add tree parsers
-
✅ Semantic analysis for AST
- ✅ Statements and expressions
- ✅ Math operations
- ✅ Conditions: if, else
- ✅ Function definitions
- ✅ Function calls
- ❌ Cycles while and for
- ❌ Arrays and operations
- ❌ Function analogs
- ❌ Import statements
- ❌ Nested transpilation
-
✅ Package demo publication
-
✅ Project site