Skip to content

syberia/python.sy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Modules for R License: MIT Join the chat at https://gitter.im/syberia/Lobby

Python is known for a stellar module and import system that makes it incredibly easy to manage dependencies and track the etiology of local variables and functions.

This project offers a "port" to R of Python's module system using syberia, a development framework for R.

Installation

To create a new python.sy project simply create a directory with this syberia engine:

# config/application.R
name <- "python.sy project"

# config/engines.R
engine("python", type = "github", repo = "syberia/python.sy", mount = TRUE)

Example

You can then start working with R as if it's python:

# toplevel.R
from(first.second.third) %import% c("chocolate", "coconut")

list(
  chocolate = chocolate("happy"),
  coconut   = coconut("delighted")
)

# first/second/third.R
chocolate <- function(adjective) {
  sprintf("Chocolate makes me %s!", adjective)
}

coconut <- function(adjective) {
  sprintf("Eating coconut leaves one feeling %s.", adjective)
}

Opening the R console from the root of the project, we notice

syberia_engine(".")$resource("toplevel")
# $chocolate
# [1] "Chocolate makes me happy!"
# 
# $coconut
# [1] "Eating coconut leaves one feeling delighted."

Check out the repo for this example.

About

A Syberia engine that mimics Python's module system and hierarchical directory structures in R

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages