Skip to main content

R to Python transpiler

Project description

📜 What is Rhyton

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

🧲 Installation

The project is published on PyPi, so you can install it via pip

$: pip install rhyton

🚀 Launch

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'
)

🛠 How it works

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

📊 Feature plan

  • ✅ 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

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

rhyton-0.0.4.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

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

rhyton-0.0.4-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file rhyton-0.0.4.tar.gz.

File metadata

  • Download URL: rhyton-0.0.4.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.9.11 Windows/10

File hashes

Hashes for rhyton-0.0.4.tar.gz
Algorithm Hash digest
SHA256 e66b178ea12fabedbd1a004d04b59f9acfaf8078e68f4a630c1fd6c9b5a31caa
MD5 7456bf63beb334288c494be0f179377c
BLAKE2b-256 bee5c03363fc564d58dc04bdd6da0eb9210acf8a7eabc374ef11f876d7958420

See more details on using hashes here.

File details

Details for the file rhyton-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: rhyton-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.9.11 Windows/10

File hashes

Hashes for rhyton-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 38b6de956109825f29da40412616099d200aed54d232a51a963f5dbafa74a091
MD5 72c53efc0c00baa5a826e82db057bfc9
BLAKE2b-256 68240e4b27477ba7757f45d952b39a4ee98d672fcee8ed5628d7d40cb5d05ce2

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