Rust bindings for the Python interpreter
Go to file
Daniel Grunwald 5c74f55862 Change `py_func!(py, f)` to `py_fn(f)`. 2015-06-25 00:02:56 +02:00
examples
extensions Change `py_func!(py, f)` to `py_fn(f)`. 2015-06-25 00:02:56 +02:00
python3-sys Use pkg-config 0.3.5 2015-06-18 22:50:15 +02:00
python27-sys Use pkg-config 0.3.5 2015-06-18 22:50:15 +02:00
src Change `py_func!(py, f)` to `py_fn(f)`. 2015-06-25 00:02:56 +02:00
tests Split rustobject module. 2015-06-22 00:35:01 +02:00
.gitignore
.travis.yml Disable python3 build on travis -- not sure if there's any python3 installed on the build machine 2015-05-24 21:14:53 +02:00
Cargo.toml Add support for creating instances of PyRustObjects that involve inheritance. 2015-06-20 16:02:09 +02:00
LICENSE
Makefile
README.md
build.rs windows support for build script 2015-05-28 11:17:14 +01:00

README.md

rust-cpython Build Status

Rust bindings for the python interpreter.


Copyright (c) 2015 Daniel Grunwald. Rust-cpython is licensed under the MIT license. Python is licensed under the Python License.

Usage

cpython is available on crates.io so you can use it like this (in your Cargo.toml):

[dependencies.cpython]
version = "*"

Example program displaying the value of sys.version:

extern crate cpython;

use cpython::{PythonObject, Python};

fn main() {
    let gil_guard = Python::acquire_gil();
    let py = gil_guard.python();
    let sys = py.import("sys").unwrap();
    let version = sys.get("version").unwrap().extract::<String>().unwrap();
    println!("Hello Python {}", version);
}