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.3.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.3-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rhyton-0.0.3.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.3.tar.gz
Algorithm Hash digest
SHA256 2c874905027fdfa16c768bbfc3c0e2a5e8615d8e960ae39bdecb4c23e4649125
MD5 7b04e18a512f5005c87bc057b7a1e6be
BLAKE2b-256 4ece8a364ce8214816b558d1d1b8cbb9ff4a3ef22ead3d0cd082d1f0072819bd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rhyton-0.0.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c03b3ab239b16e3f812233c1fe3f4e8bf8328cf2f0ea892b1d9b968aae2297b8
MD5 163ce14ce7724c2e66ceb9f463c53c76
BLAKE2b-256 ecbf25010a325b28fe34f3c6de1c5a2346eb5180ef265ac48f07384e729eb30c

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