Skip to main content

A Python library to run code from multiple programming languages.

Project description

Intro

CrossLang is a Python library that allows developers to run code written in various programming languages directly from their Python scripts. This can be particularly useful for multi-language projects, testing, and automation.

Supports multiple programming languages including Rust, C, Java, Ruby, Lua, Go, JavaScript, PHP, Perl, Scala, Shell, and Kotlin. Automatically compiles and runs code snippets. Easy to integrate into existing Python projects.

Installation

To install CrossLang, you can use pip:

pip install python-crosslang

Installing Compilers and Interpreters

CrossLang relies on various external compilers and interpreters to execute code in different languages. You can use the provided installation scripts to set up the necessary dependencies.

For Unix-based Systems (Linux/macOS): Run the following script to install the required compilers and interpreters:

chmod +x debian.sh; ./debian.sh

For Arch Linux:
Run the following script to install the required compilers and interpreters:

chmod +x arch.sh; ./arch.sh

For Windows:
Run the following PowerShell script to install the required compilers and interpreters:

.\windows.ps1

Usage

Here's an example of how to use CrossLang in your Python script:

from CrossLang import Translator

# Running Rust code
code = """
fn main() {
    println!("Hello, world!");
}
"""

output = Translator('rust', code)
print(output)

# Running C code
code = """
#include <stdio.h>

int main() {
    printf("Hello, World!\\n");
    return 0;
}
"""

output = Translator('c', code)
print(output)

# Running Java code
code = """
public class Main {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}
"""

output = Translator('java', code)
print(output)

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

python_crosslang-0.1.6.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

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

python_crosslang-0.1.6-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file python_crosslang-0.1.6.tar.gz.

File metadata

  • Download URL: python_crosslang-0.1.6.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for python_crosslang-0.1.6.tar.gz
Algorithm Hash digest
SHA256 34cbd60dafaf5d0f23bd9128ba6011091e2c1eedbe7e6b2bd5d1730f1d539d6a
MD5 301ebce73b8369b8559eb9e335f0068e
BLAKE2b-256 974c2787e41c2c50a3bd49bd4a9113973ec5edbbec314ea22dc4d75e1a788574

See more details on using hashes here.

File details

Details for the file python_crosslang-0.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for python_crosslang-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 73ce71903bb6f3021b6a7f244ca759387ec20d16c453696e0871be0cf8bf8dd9
MD5 40b654dd909a1ca18f921d6f2f9a2e67
BLAKE2b-256 6c0604bf6c38b6f3a923a847b0b07d8d0a7f3175bcdb1d6560efda00800c56a5

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